mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-06 18:02:38 +02:00
[FEAT] save fiat amount in api_create_invoice (#1869)
save user input into extra when he chooses a currency for api_create invoice
This commit is contained in:
@@ -187,6 +187,7 @@ async def api_payments_paginated(
|
|||||||
|
|
||||||
|
|
||||||
async def api_payments_create_invoice(data: CreateInvoice, wallet: Wallet):
|
async def api_payments_create_invoice(data: CreateInvoice, wallet: Wallet):
|
||||||
|
extra = data.extra or {}
|
||||||
if data.description_hash or data.unhashed_description:
|
if data.description_hash or data.unhashed_description:
|
||||||
try:
|
try:
|
||||||
description_hash = (
|
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"
|
assert data.unit is not None, "unit not set"
|
||||||
price_in_sats = await fiat_amount_as_satoshis(data.amount, data.unit)
|
price_in_sats = await fiat_amount_as_satoshis(data.amount, data.unit)
|
||||||
amount = price_in_sats
|
amount = price_in_sats
|
||||||
|
extra.update({"fiat_amount": data.amount, "fiat_currency": data.unit})
|
||||||
|
|
||||||
async with db.connect() as conn:
|
async with db.connect() as conn:
|
||||||
try:
|
try:
|
||||||
|
Reference in New Issue
Block a user