mirror of
https://github.com/lnbits/lnbits.git
synced 2025-03-29 11:12:11 +01:00
Added if webhook to stop 500 in webhook absence
This commit is contained in:
parent
52956a62a2
commit
ae59c74c24
@ -54,21 +54,22 @@ async def set_ticket_paid(payment_hash: str) -> Tickets:
|
||||
)
|
||||
|
||||
ticket = await get_ticket(payment_hash)
|
||||
async with httpx.AsyncClient() as client:
|
||||
try:
|
||||
r = await client.post(
|
||||
formdata.webhook,
|
||||
json={
|
||||
"form": ticket.form,
|
||||
"name": ticket.name,
|
||||
"email": ticket.email,
|
||||
"content": ticket.ltext
|
||||
},
|
||||
timeout=40,
|
||||
)
|
||||
except AssertionError:
|
||||
webhook = None
|
||||
return ticket
|
||||
if formdata.webhook:
|
||||
async with httpx.AsyncClient() as client:
|
||||
try:
|
||||
r = await client.post(
|
||||
formdata.webhook,
|
||||
json={
|
||||
"form": ticket.form,
|
||||
"name": ticket.name,
|
||||
"email": ticket.email,
|
||||
"content": ticket.ltext
|
||||
},
|
||||
timeout=40,
|
||||
)
|
||||
except AssertionError:
|
||||
webhook = None
|
||||
return ticket
|
||||
ticket = await get_ticket(payment_hash)
|
||||
return
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user