mirror of
https://github.com/lnbits/lnbits.git
synced 2025-04-09 12:30:13 +02:00
All works
This commit is contained in:
parent
6a4290c0e9
commit
31beec4f48
@ -51,12 +51,15 @@ async def on_invoice_paid(payment: Payment) -> None:
|
||||
timeout=40,
|
||||
)
|
||||
res = r.json()
|
||||
await pay_invoice(
|
||||
wallet_id=payment.wallet_id,
|
||||
payment_request=res["pr"],
|
||||
extra={"tag": "lnurlpayout"},
|
||||
)
|
||||
return
|
||||
try:
|
||||
await pay_invoice(
|
||||
wallet_id=payment.wallet_id,
|
||||
payment_request=res["pr"],
|
||||
extra={"tag": "lnurlpayout"},
|
||||
)
|
||||
return
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
return
|
||||
except (httpx.ConnectError, httpx.RequestError):
|
||||
|
@ -18,7 +18,7 @@ from .tasks import on_invoice_paid
|
||||
async def api_lnurlpayouts(
|
||||
all_wallets: bool = Query(None), wallet: WalletTypeInfo = Depends(get_key_type)
|
||||
):
|
||||
wallet_ids = wallet.wallet.id
|
||||
wallet_ids = [wallet.wallet.id]
|
||||
if all_wallets:
|
||||
wallet_ids = (await get_user(wallet.wallet.user)).wallet_ids
|
||||
|
||||
@ -39,7 +39,6 @@ async def api_lnurlpayout_create(
|
||||
if str(url["domain"])[0:4] != "http":
|
||||
raise HTTPException(status_code=HTTPStatus.FORBIDDEN, detail="Not valid LNURL")
|
||||
return
|
||||
print(wallet)
|
||||
lnurlpayout = await create_lnurlpayout(wallet_id=wallet.wallet.id, admin_key=wallet.wallet.adminkey, data=data)
|
||||
if not lnurlpayout:
|
||||
raise HTTPException(status_code=HTTPStatus.FORBIDDEN, detail="Failed to save LNURLPayout")
|
||||
@ -71,6 +70,13 @@ async def api_lnurlpayout_check(
|
||||
payments = await get_payments(
|
||||
wallet_id=lnurlpayout.wallet, complete=True, pending=False, outgoing=True, incoming=True
|
||||
)
|
||||
print(payments[0])
|
||||
result = await on_invoice_paid(payments[0])
|
||||
return
|
||||
return
|
||||
|
||||
# get payouts func
|
||||
# lnurlpayouts = await get_lnurlpayouts(wallet_ids)
|
||||
# for lnurlpayout in lnurlpayouts:
|
||||
# payments = await get_payments(
|
||||
# wallet_id=lnurlpayout.wallet, complete=True, pending=False, outgoing=True, incoming=True
|
||||
# )
|
||||
# await on_invoice_paid(payments[0])
|
Loading…
x
Reference in New Issue
Block a user