diff --git a/views_api.py b/views_api.py index cfc950a..2be05b1 100644 --- a/views_api.py +++ b/views_api.py @@ -842,9 +842,10 @@ async def api_settle_receivable( ) amount_in_sats = data.amount_sats line_metadata = { - "fiat_currency": data.currency, - "fiat_amount": str(data.amount), - "exchange_rate": data.amount_sats / float(data.amount) + "fiat_currency": data.currency.upper(), + "fiat_amount": str(data.amount.quantize(Decimal("0.001"))), + "fiat_rate": float(data.amount_sats) / float(data.amount) if data.amount > 0 else 0, + "btc_rate": float(data.amount) / float(data.amount_sats) * 100_000_000 if data.amount_sats > 0 else 0, } else: # Satoshi payment @@ -988,9 +989,10 @@ async def api_pay_user( ) amount_in_sats = data.amount_sats line_metadata = { - "fiat_currency": data.currency, - "fiat_amount": str(data.amount), - "exchange_rate": data.amount_sats / float(data.amount) + "fiat_currency": data.currency.upper(), + "fiat_amount": str(data.amount.quantize(Decimal("0.001"))), + "fiat_rate": float(data.amount_sats) / float(data.amount) if data.amount > 0 else 0, + "btc_rate": float(data.amount) / float(data.amount_sats) * 100_000_000 if data.amount_sats > 0 else 0, } else: # Satoshi payment