From 88c07acc2cb0deecbc752b4a8705ce7de236d522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Wed, 23 Aug 2023 12:45:19 +0200 Subject: [PATCH] [FEAT] save fiat amount in api_create_invoice (#1869) save user input into extra when he chooses a currency for api_create invoice --- lnbits/core/views/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lnbits/core/views/api.py b/lnbits/core/views/api.py index 801731a6..704428a2 100644 --- a/lnbits/core/views/api.py +++ b/lnbits/core/views/api.py @@ -187,6 +187,7 @@ async def api_payments_paginated( async def api_payments_create_invoice(data: CreateInvoice, wallet: Wallet): + extra = data.extra or {} if data.description_hash or data.unhashed_description: try: description_hash = ( @@ -217,6 +218,7 @@ async def api_payments_create_invoice(data: CreateInvoice, wallet: Wallet): assert data.unit is not None, "unit not set" price_in_sats = await fiat_amount_as_satoshis(data.amount, data.unit) amount = price_in_sats + extra.update({"fiat_amount": data.amount, "fiat_currency": data.unit}) async with db.connect() as conn: try: