fixup events bugs, tickets
This commit is contained in:
parent
dd645f8822
commit
d371dac84c
1 changed files with 20 additions and 18 deletions
|
|
@ -123,9 +123,14 @@ async def api_ticket_send_ticket(event_id, payment_hash, data: CreateTicket):
|
||||||
status_code=HTTPStatus.NOT_FOUND,
|
status_code=HTTPStatus.NOT_FOUND,
|
||||||
detail=f"Event could not be fetched.",
|
detail=f"Event could not be fetched.",
|
||||||
)
|
)
|
||||||
try:
|
|
||||||
status = await api_payment(payment_hash)
|
status = await api_payment(payment_hash)
|
||||||
if status["paid"]:
|
if status["paid"]:
|
||||||
|
|
||||||
|
exists = await get_ticket(payment_hash)
|
||||||
|
if exists:
|
||||||
|
return {"paid": True, "ticket_id": exists.id}
|
||||||
|
|
||||||
ticket = await create_ticket(
|
ticket = await create_ticket(
|
||||||
payment_hash=payment_hash,
|
payment_hash=payment_hash,
|
||||||
wallet=event.wallet,
|
wallet=event.wallet,
|
||||||
|
|
@ -138,10 +143,7 @@ async def api_ticket_send_ticket(event_id, payment_hash, data: CreateTicket):
|
||||||
status_code=HTTPStatus.NOT_FOUND,
|
status_code=HTTPStatus.NOT_FOUND,
|
||||||
detail=f"Event could not be fetched.",
|
detail=f"Event could not be fetched.",
|
||||||
)
|
)
|
||||||
|
|
||||||
return {"paid": True, "ticket_id": ticket.id}
|
return {"paid": True, "ticket_id": ticket.id}
|
||||||
except Exception:
|
|
||||||
raise HTTPException(status_code=HTTPStatus.NOT_FOUND, detail="Not paid")
|
|
||||||
return {"paid": False}
|
return {"paid": False}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue