mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-10 04:22:35 +02:00
Merge pull request #372 from arcbtc/FastAPI
restored create invoice api endpoint
This commit is contained in:
@@ -86,7 +86,7 @@ class CreateInvoiceData(BaseModel):
|
|||||||
amount: int = Query(None, ge=1)
|
amount: int = Query(None, ge=1)
|
||||||
memo: str = None
|
memo: str = None
|
||||||
unit: Optional[str] = None
|
unit: Optional[str] = None
|
||||||
description_hash: str = None
|
description_hash: Optional[str] = None
|
||||||
lnurl_callback: Optional[str] = None
|
lnurl_callback: Optional[str] = None
|
||||||
lnurl_balance_check: Optional[str] = None
|
lnurl_balance_check: Optional[str] = None
|
||||||
extra: Optional[dict] = None
|
extra: Optional[dict] = None
|
||||||
@@ -101,7 +101,7 @@ async def api_payments_create_invoice(data: CreateInvoiceData, wallet: Wallet):
|
|||||||
else:
|
else:
|
||||||
description_hash = b""
|
description_hash = b""
|
||||||
memo = data.memo
|
memo = data.memo
|
||||||
if data.unit == "sat":
|
if not "unit" in data or data.unit == "sat":
|
||||||
amount = data.amount
|
amount = data.amount
|
||||||
else:
|
else:
|
||||||
price_in_sats = await fiat_amount_as_satoshis(data.amount, data.unit)
|
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(
|
@core_app.post(
|
||||||
"/api/v1/payments",
|
"/api/v1/payments",
|
||||||
deprecated=True,
|
# deprecated=True,
|
||||||
description="DEPRECATED. Use /api/v2/TBD and /api/v2/TBD instead",
|
# description="DEPRECATED. Use /api/v2/TBD and /api/v2/TBD instead",
|
||||||
status_code=HTTPStatus.CREATED,
|
status_code=HTTPStatus.CREATED,
|
||||||
)
|
)
|
||||||
async def api_payments_create(
|
async def api_payments_create(
|
||||||
|
Reference in New Issue
Block a user