pass custom extra on payment out (#2089)
This commit is contained in:
parent
6a27b91fcb
commit
90c54f2c30
1 changed files with 7 additions and 3 deletions
|
|
@ -332,9 +332,13 @@ async def api_payments_create_invoice(data: CreateInvoice, wallet: Wallet):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async def api_payments_pay_invoice(bolt11: str, wallet: Wallet):
|
async def api_payments_pay_invoice(
|
||||||
|
bolt11: str, wallet: Wallet, extra: Optional[dict] = None
|
||||||
|
):
|
||||||
try:
|
try:
|
||||||
payment_hash = await pay_invoice(wallet_id=wallet.id, payment_request=bolt11)
|
payment_hash = await pay_invoice(
|
||||||
|
wallet_id=wallet.id, payment_request=bolt11, extra=extra
|
||||||
|
)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise HTTPException(status_code=HTTPStatus.BAD_REQUEST, detail=str(e))
|
raise HTTPException(status_code=HTTPStatus.BAD_REQUEST, detail=str(e))
|
||||||
except PermissionError as e:
|
except PermissionError as e:
|
||||||
|
|
@ -375,7 +379,7 @@ async def api_payments_create(
|
||||||
detail="BOLT11 string is invalid or not given",
|
detail="BOLT11 string is invalid or not given",
|
||||||
)
|
)
|
||||||
return await api_payments_pay_invoice(
|
return await api_payments_pay_invoice(
|
||||||
invoiceData.bolt11, wallet.wallet
|
invoiceData.bolt11, wallet.wallet, invoiceData.extra
|
||||||
) # admin key
|
) # admin key
|
||||||
elif not invoiceData.out:
|
elif not invoiceData.out:
|
||||||
# invoice key
|
# invoice key
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue