From bfd9ca68e42187ffcf358cfcb0a24ed057ce3c7b Mon Sep 17 00:00:00 2001 From: Ben Arc Date: Wed, 18 Aug 2021 21:40:50 +0100 Subject: [PATCH] Broken, trying to convert --- lnbits/core/views/api.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lnbits/core/views/api.py b/lnbits/core/views/api.py index 190e440cd..c7e75f7a4 100644 --- a/lnbits/core/views/api.py +++ b/lnbits/core/views/api.py @@ -92,7 +92,18 @@ async def api_payments(): "webhook": {"type": "string", "empty": False, "required": False}, } ) -async def api_payments_create_invoice(): +# async def api_payments_create_invoice(amount: List[str] = Query([type: str = Query(None)])): + + +class Memo(BaseModel): + type: str + empty: bool + required: bool + excludes: bool + excludes: bool = Query("description_hash") + + +async def api_payments_create_invoice(amount: int = Query(...), memo: Memo ): if "description_hash" in g.data: description_hash = unhexlify(g.data["description_hash"]) memo = "" @@ -118,7 +129,7 @@ async def api_payments_create_invoice(): conn=conn, ) except InvoiceFailure as e: - return jsonify({"message": str(e)}), 520 + return jsonable_encoder({"message": str(e)}), 520 except Exception as exc: raise exc @@ -156,7 +167,7 @@ async def api_payments_create_invoice(): lnurl_response = False return ( - jsonify( + jsonable_encoder( { "payment_hash": invoice.payment_hash, "payment_request": payment_request,