mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-24 06:48:02 +01:00
fixup events bugs, tickets
This commit is contained in:
parent
dd645f8822
commit
d371dac84c
1 changed files with 20 additions and 18 deletions
|
@ -123,25 +123,27 @@ async def api_ticket_send_ticket(event_id, payment_hash, data: CreateTicket):
|
|||
status_code=HTTPStatus.NOT_FOUND,
|
||||
detail=f"Event could not be fetched.",
|
||||
)
|
||||
try:
|
||||
status = await api_payment(payment_hash)
|
||||
if status["paid"]:
|
||||
ticket = await create_ticket(
|
||||
payment_hash=payment_hash,
|
||||
wallet=event.wallet,
|
||||
event=event_id,
|
||||
name=data.name,
|
||||
email=data.email,
|
||||
)
|
||||
if not ticket:
|
||||
raise HTTPException(
|
||||
status_code=HTTPStatus.NOT_FOUND,
|
||||
detail=f"Event could not be fetched.",
|
||||
)
|
||||
|
||||
return {"paid": True, "ticket_id": ticket.id}
|
||||
except Exception:
|
||||
raise HTTPException(status_code=HTTPStatus.NOT_FOUND, detail="Not paid")
|
||||
status = await api_payment(payment_hash)
|
||||
if status["paid"]:
|
||||
|
||||
exists = await get_ticket(payment_hash)
|
||||
if exists:
|
||||
return {"paid": True, "ticket_id": exists.id}
|
||||
|
||||
ticket = await create_ticket(
|
||||
payment_hash=payment_hash,
|
||||
wallet=event.wallet,
|
||||
event=event_id,
|
||||
name=data.name,
|
||||
email=data.email,
|
||||
)
|
||||
if not ticket:
|
||||
raise HTTPException(
|
||||
status_code=HTTPStatus.NOT_FOUND,
|
||||
detail=f"Event could not be fetched.",
|
||||
)
|
||||
return {"paid": True, "ticket_id": ticket.id}
|
||||
return {"paid": False}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue