Displaying fiat value of invoice's order amount in details

This commit is contained in:
rockstardev
2018-05-11 12:15:26 -05:00
parent be1128a886
commit 3770adb7d3
3 changed files with 8 additions and 9 deletions

View File

@@ -239,9 +239,9 @@ namespace BTCPayServer.Controllers
CustomCSSLink = storeBlob.CustomCSS?.AbsoluteUri,
CustomLogoLink = storeBlob.CustomLogo?.AbsoluteUri,
BtcAddress = paymentMethodDetails.GetPaymentDestination(),
OrderAmount = (accounting.TotalDue - accounting.NetworkFee).ToString(),
BtcDue = accounting.Due.ToString(),
FiatDue = FiatDue(accounting.Due, paymentMethod),
OrderAmount = (accounting.TotalDue - accounting.NetworkFee).ToString(),
OrderAmountFiat = OrderAmountFiat(invoice.ProductInformation),
CustomerEmail = invoice.RefundMail,
RequiresRefundEmail = storeBlob.RequiresRefundEmail,
ExpirationSeconds = Math.Max(0, (int)(invoice.ExpirationTime - DateTimeOffset.UtcNow).TotalSeconds),
@@ -295,10 +295,9 @@ namespace BTCPayServer.Controllers
{
return price.ToString("C", _CurrencyNameTable.GetCurrencyProvider(currency)) + $" ({currency})";
}
private string FiatDue(Money btcDue, PaymentMethod paymentMethod)
private string OrderAmountFiat(ProductInformation productInformation)
{
var currency = paymentMethod.ParentEntity.ProductInformation.Currency;
return FormatCurrency(btcDue.ToUnit(MoneyUnit.BTC) * paymentMethod.Rate, currency);
return FormatCurrency(productInformation.Price, productInformation.Currency);
}
[HttpGet]