mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-03-03 17:37:06 +01:00
Trying list data validation
This commit is contained in:
parent
1118b0ba56
commit
0eccfb83f0
1 changed files with 9 additions and 10 deletions
|
@ -170,26 +170,25 @@ async def api_payments_create_invoice():
|
|||
|
||||
|
||||
@api_check_wallet_key("admin")
|
||||
@api_validate_post_request(
|
||||
schema={"bolt11": {"type": "string", "empty": False, "required": True}}
|
||||
)
|
||||
async def api_payments_pay_invoice():
|
||||
async def api_payments_pay_invoice(
|
||||
bolt11: str = Query(...), wallet: Optional[List[str]] = Query(None)
|
||||
):
|
||||
try:
|
||||
payment_hash = await pay_invoice(
|
||||
wallet_id=g.wallet.id,
|
||||
payment_request=g.data["bolt11"],
|
||||
wallet_id=wallet.id,
|
||||
payment_request=bolt11,
|
||||
)
|
||||
except ValueError as e:
|
||||
return jsonify({"message": str(e)}), HTTPStatus.BAD_REQUEST
|
||||
return jsonable_encoder({"message": str(e)}), HTTPStatus.BAD_REQUEST
|
||||
except PermissionError as e:
|
||||
return jsonify({"message": str(e)}), HTTPStatus.FORBIDDEN
|
||||
return jsonable_encoder({"message": str(e)}), HTTPStatus.FORBIDDEN
|
||||
except PaymentFailure as e:
|
||||
return jsonify({"message": str(e)}), 520
|
||||
return jsonable_encoder({"message": str(e)}), 520
|
||||
except Exception as exc:
|
||||
raise exc
|
||||
|
||||
return (
|
||||
jsonify(
|
||||
jsonable_encoder(
|
||||
{
|
||||
"payment_hash": payment_hash,
|
||||
# maintain backwards compatibility with API clients:
|
||||
|
|
Loading…
Add table
Reference in a new issue