Fix ticket create (#13)

* don't set ticket as paid on create
* use crud fn in tasks.py
* create ticket is unpaid by default
This commit is contained in:
Tiago Vasconcelos 2023-08-18 07:18:44 +01:00 committed by GitHub
parent c8b31d8e3f
commit 00f552c751
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 24 deletions

View file

@ -20,6 +20,7 @@ from .crud import (
get_ticket,
get_tickets,
reg_ticket,
set_ticket_paid,
update_event,
)
from .models import CreateEvent, CreateTicket
@ -138,7 +139,9 @@ async def api_ticket_send_ticket(event_id, payment_hash):
)
payment = await get_standalone_payment(payment_hash)
assert payment
if not payment.pending and event.price_per_ticket * 1000 == payment.amount:
await set_ticket_paid(payment_hash)
return {"paid": True, "ticket_id": ticket.id}
return {"paid": False}