mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Merge pull request #170 from rockstardev/fiat
Display fiat value of invoice during checkout
This commit is contained in:
@@ -242,8 +242,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(),
|
||||
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),
|
||||
@@ -315,6 +316,17 @@ namespace BTCPayServer.Controllers
|
||||
}
|
||||
return price.ToString("C", provider) + $" ({currency})";
|
||||
}
|
||||
private string OrderAmountFiat(ProductInformation productInformation)
|
||||
{
|
||||
// check if invoice source currency is crypto... if it is there is no "order amount in fiat"
|
||||
foreach (var net in _NetworkProvider.GetAll())
|
||||
{
|
||||
if (net.CryptoCode == productInformation.Currency)
|
||||
return null;
|
||||
}
|
||||
|
||||
return FormatCurrency(productInformation.Price, productInformation.Currency);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("i/{invoiceId}/status")]
|
||||
|
||||
Reference in New Issue
Block a user