mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2024-11-19 09:54:21 +01:00
fix: update the rest of update_payment_extra
calls
This commit is contained in:
parent
b56d08a70e
commit
a434731729
@ -452,7 +452,7 @@ async def update_payment_details(
|
||||
|
||||
|
||||
async def update_payment_extra(
|
||||
hash: str,
|
||||
payment_hash: str,
|
||||
extra: dict,
|
||||
outgoing: bool = False,
|
||||
incoming: bool = False,
|
||||
@ -472,7 +472,7 @@ async def update_payment_extra(
|
||||
|
||||
row = await (conn or db).fetchone(
|
||||
f"SELECT hash, extra from apipayments WHERE hash = ? {amount_clause}",
|
||||
(hash,),
|
||||
(payment_hash,),
|
||||
)
|
||||
if not row:
|
||||
return
|
||||
@ -481,7 +481,7 @@ async def update_payment_extra(
|
||||
|
||||
await (conn or db).execute(
|
||||
f"UPDATE apipayments SET extra = ? WHERE hash = ? {amount_clause} ",
|
||||
(json.dumps(db_extra), hash),
|
||||
(json.dumps(db_extra), payment_hash),
|
||||
)
|
||||
|
||||
|
||||
|
@ -67,4 +67,6 @@ async def mark_webhook_sent(
|
||||
payment.extra["wh_message"] = reason_phrase
|
||||
payment.extra["wh_response"] = text
|
||||
|
||||
await update_payment_extra(payment.payment_hash, payment.extra)
|
||||
await update_payment_extra(
|
||||
payment_hash=payment.payment_hash, extra=payment.extra, incoming=True
|
||||
)
|
||||
|
@ -163,7 +163,7 @@ async def api_lnurl_callback(
|
||||
|
||||
r: httpx.Response = await client.post(link.webhook_url, **kwargs)
|
||||
await update_payment_extra(
|
||||
hash=payment_hash,
|
||||
payment_hash=payment_hash,
|
||||
extra={
|
||||
"wh_success": r.is_success,
|
||||
"wh_message": r.reason_phrase,
|
||||
@ -177,8 +177,9 @@ async def api_lnurl_callback(
|
||||
"Caught exception when dispatching webhook url: " + str(exc)
|
||||
)
|
||||
await update_payment_extra(
|
||||
payment_hash,
|
||||
{"wh_success": False, "wh_message": str(exc)},
|
||||
payment_hash=payment_hash,
|
||||
extra={"wh_success": False, "wh_message": str(exc)},
|
||||
outgoing=True,
|
||||
)
|
||||
|
||||
return {"status": "OK"}
|
||||
|
Loading…
Reference in New Issue
Block a user