mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-22 15:57:28 +02:00
Should be working
This commit is contained in:
@@ -2,6 +2,7 @@ import asyncio
|
|||||||
import json
|
import json
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
|
from lnbits.core.crud import get_wallet
|
||||||
from lnbits.core import db as core_db
|
from lnbits.core import db as core_db
|
||||||
from lnbits.core.models import Payment
|
from lnbits.core.models import Payment
|
||||||
from lnbits.tasks import register_invoice_listener
|
from lnbits.tasks import register_invoice_listener
|
||||||
@@ -19,15 +20,11 @@ async def wait_for_paid_invoices():
|
|||||||
|
|
||||||
|
|
||||||
async def on_invoice_paid(payment: Payment) -> None:
|
async def on_invoice_paid(payment: Payment) -> None:
|
||||||
print(payment)
|
|
||||||
if "lnurlpayout" != payment.extra.get("tag"):
|
|
||||||
# not an lnurlpayout invoice
|
|
||||||
return
|
|
||||||
|
|
||||||
if payment.extra.get("wh_status"):
|
if payment.extra.get("wh_status"):
|
||||||
# this webhook has already been sent
|
# this webhook has already been sent
|
||||||
return
|
return
|
||||||
|
# check link
|
||||||
pay_link = await get_lnurlpayout(payment.extra.get("link", -1))
|
pay_link = await get_lnurlpayout(payment.extra.get("link", -1))
|
||||||
if pay_link and pay_link.webhook_url:
|
if pay_link and pay_link.webhook_url:
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
@@ -57,4 +54,4 @@ async def mark_webhook_sent(payment: Payment, status: int) -> None:
|
|||||||
WHERE hash = ?
|
WHERE hash = ?
|
||||||
""",
|
""",
|
||||||
(json.dumps(payment.extra), payment.payment_hash),
|
(json.dumps(payment.extra), payment.payment_hash),
|
||||||
)
|
)
|
Reference in New Issue
Block a user