From 9630d8b3631c3d3717a7ee46370e04e3f6543744 Mon Sep 17 00:00:00 2001 From: benarc Date: Tue, 2 Nov 2021 16:29:15 +0000 Subject: [PATCH] restored create invoice api endpoint --- lnbits/core/views/api.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lnbits/core/views/api.py b/lnbits/core/views/api.py index 91573bcfc..894b4a444 100644 --- a/lnbits/core/views/api.py +++ b/lnbits/core/views/api.py @@ -86,7 +86,7 @@ class CreateInvoiceData(BaseModel): amount: int = Query(None, ge=1) memo: str = None unit: Optional[str] = None - description_hash: str = None + description_hash: Optional[str] = None lnurl_callback: Optional[str] = None lnurl_balance_check: Optional[str] = None extra: Optional[dict] = None @@ -101,7 +101,7 @@ async def api_payments_create_invoice(data: CreateInvoiceData, wallet: Wallet): else: description_hash = b"" memo = data.memo - if data.unit == "sat": + if not "unit" in data or data.unit == "sat": amount = data.amount else: price_in_sats = await fiat_amount_as_satoshis(data.amount, data.unit) @@ -185,8 +185,8 @@ async def api_payments_pay_invoice(bolt11: str, wallet: Wallet): @core_app.post( "/api/v1/payments", - deprecated=True, - description="DEPRECATED. Use /api/v2/TBD and /api/v2/TBD instead", + # deprecated=True, + # description="DEPRECATED. Use /api/v2/TBD and /api/v2/TBD instead", status_code=HTTPStatus.CREATED, ) async def api_payments_create(