From f6a7f46e3af779baa1a4c8f2ac3500c591f93ee1 Mon Sep 17 00:00:00 2001 From: francismars Date: Wed, 26 Jun 2024 13:36:27 +0100 Subject: [PATCH] added zap_receipt information to webhook --- tasks.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tasks.py b/tasks.py index f21651a..342d41c 100644 --- a/tasks.py +++ b/tasks.py @@ -48,10 +48,13 @@ async def on_invoice_paid(payment: Payment): ) return - await send_webhook(payment, pay_link) + if pay_link.zaps: - await send_zap(payment) + zap_receipt = await send_zap(payment) + pay_link.zap_receipt = zap_receipt + + await send_webhook(payment, pay_link) async def send_webhook(payment: Payment, pay_link: PayLink): @@ -69,7 +72,8 @@ async def send_webhook(payment: Payment, pay_link: PayLink): "comment": payment.extra.get("comment"), "webhook_data": payment.extra.get("webhook_data") or "", "lnurlp": pay_link.id, - "body": json.loads(pay_link.webhook_body) + "body": json.loads(pay_link.webhook_body), + "zap_receipt": pay_link.zap_receipt if pay_link.webhook_body else "", }, @@ -170,3 +174,5 @@ async def send_zap(payment: Payment): logger.debug(f"Closing websocket {ws.url}") ws.close() wst.join() + + return zap_receipt \ No newline at end of file