mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04:26 +01:00
Support for displaying fiat value of invoice
This commit is contained in:
@@ -241,6 +241,7 @@ namespace BTCPayServer.Controllers
|
||||
BtcAddress = paymentMethodDetails.GetPaymentDestination(),
|
||||
OrderAmount = (accounting.TotalDue - accounting.NetworkFee).ToString(),
|
||||
BtcDue = accounting.Due.ToString(),
|
||||
FiatDue = FiatDue(accounting.Due, paymentMethod),
|
||||
CustomerEmail = invoice.RefundMail,
|
||||
RequiresRefundEmail = storeBlob.RequiresRefundEmail,
|
||||
ExpirationSeconds = Math.Max(0, (int)(invoice.ExpirationTime - DateTimeOffset.UtcNow).TotalSeconds),
|
||||
@@ -294,6 +295,11 @@ namespace BTCPayServer.Controllers
|
||||
{
|
||||
return price.ToString("C", _CurrencyNameTable.GetCurrencyProvider(currency)) + $" ({currency})";
|
||||
}
|
||||
private string FiatDue(Money btcDue, PaymentMethod paymentMethod)
|
||||
{
|
||||
var currency = paymentMethod.ParentEntity.ProductInformation.Currency;
|
||||
return FormatCurrency(btcDue.ToUnit(MoneyUnit.BTC) * paymentMethod.Rate, currency);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("i/{invoiceId}/status")]
|
||||
|
||||
Reference in New Issue
Block a user