Added if webhook to stop 500 in webhook absence
This commit is contained in:
parent
52956a62a2
commit
ae59c74c24
1 changed files with 16 additions and 15 deletions
|
|
@ -54,21 +54,22 @@ async def set_ticket_paid(payment_hash: str) -> Tickets:
|
||||||
)
|
)
|
||||||
|
|
||||||
ticket = await get_ticket(payment_hash)
|
ticket = await get_ticket(payment_hash)
|
||||||
async with httpx.AsyncClient() as client:
|
if formdata.webhook:
|
||||||
try:
|
async with httpx.AsyncClient() as client:
|
||||||
r = await client.post(
|
try:
|
||||||
formdata.webhook,
|
r = await client.post(
|
||||||
json={
|
formdata.webhook,
|
||||||
"form": ticket.form,
|
json={
|
||||||
"name": ticket.name,
|
"form": ticket.form,
|
||||||
"email": ticket.email,
|
"name": ticket.name,
|
||||||
"content": ticket.ltext
|
"email": ticket.email,
|
||||||
},
|
"content": ticket.ltext
|
||||||
timeout=40,
|
},
|
||||||
)
|
timeout=40,
|
||||||
except AssertionError:
|
)
|
||||||
webhook = None
|
except AssertionError:
|
||||||
return ticket
|
webhook = None
|
||||||
|
return ticket
|
||||||
ticket = await get_ticket(payment_hash)
|
ticket = await get_ticket(payment_hash)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue