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