diff --git a/BTCPayServer/Controllers/InvoiceController.UI.cs b/BTCPayServer/Controllers/InvoiceController.UI.cs index b37f71e5f..6a79b1511 100644 --- a/BTCPayServer/Controllers/InvoiceController.UI.cs +++ b/BTCPayServer/Controllers/InvoiceController.UI.cs @@ -65,6 +65,7 @@ namespace BTCPayServer.Controllers OrderId = invoice.OrderId, BuyerInformation = invoice.BuyerInformation, Fiat = _CurrencyNameTable.DisplayFormatCurrency(dto.Price, dto.Currency), + TaxIncluded = _CurrencyNameTable.DisplayFormatCurrency(invoice.ProductInformation.TaxIncluded, dto.Currency), NotificationEmail = invoice.NotificationEmail, NotificationUrl = invoice.NotificationURL, RedirectUrl = invoice.RedirectURL, @@ -81,9 +82,9 @@ namespace BTCPayServer.Controllers var paymentMethodId = data.GetId(); var cryptoPayment = new InvoiceDetailsModel.CryptoPayment(); cryptoPayment.PaymentMethod = ToString(paymentMethodId); - cryptoPayment.Due = $"{accounting.Due} {paymentMethodId.CryptoCode}"; - cryptoPayment.Paid = $"{accounting.CryptoPaid} {paymentMethodId.CryptoCode}"; - cryptoPayment.Overpaid = $"{accounting.OverpaidHelper} {paymentMethodId.CryptoCode}"; + cryptoPayment.Due = _CurrencyNameTable.DisplayFormatCurrency(accounting.Due.ToDecimal(MoneyUnit.BTC), paymentMethodId.CryptoCode); + cryptoPayment.Paid = _CurrencyNameTable.DisplayFormatCurrency(accounting.CryptoPaid.ToDecimal(MoneyUnit.BTC), paymentMethodId.CryptoCode); + cryptoPayment.Overpaid = _CurrencyNameTable.DisplayFormatCurrency(accounting.OverpaidHelper.ToDecimal(MoneyUnit.BTC), paymentMethodId.CryptoCode); var onchainMethod = data.GetPaymentMethodDetails() as Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod; if (onchainMethod != null) diff --git a/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs b/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs index 081141b51..1c1af53ec 100644 --- a/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs +++ b/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs @@ -105,6 +105,7 @@ namespace BTCPayServer.Models.InvoicingModels get; set; } + public string TaxIncluded { get; set; } public BuyerInformation BuyerInformation { get; diff --git a/BTCPayServer/Services/Rates/CurrencyNameTable.cs b/BTCPayServer/Services/Rates/CurrencyNameTable.cs index 50bec5c8a..961d97f88 100644 --- a/BTCPayServer/Services/Rates/CurrencyNameTable.cs +++ b/BTCPayServer/Services/Rates/CurrencyNameTable.cs @@ -121,15 +121,18 @@ namespace BTCPayServer.Services.Rates var provider = GetNumberFormatInfo(currency, true); var currencyData = GetCurrencyData(currency, true); var divisibility = currencyData.Divisibility; - while (true) + if (value != 0m) { - var rounded = decimal.Round(value, divisibility, MidpointRounding.AwayFromZero); - if ((Math.Abs(rounded - value) / value) < 0.001m) + while (true) { - value = rounded; - break; + var rounded = decimal.Round(value, divisibility, MidpointRounding.AwayFromZero); + if ((Math.Abs(rounded - value) / value) < 0.001m) + { + value = rounded; + break; + } + divisibility++; } - divisibility++; } if (divisibility != provider.CurrencyDecimalDigits) { diff --git a/BTCPayServer/Views/Invoice/Invoice.cshtml b/BTCPayServer/Views/Invoice/Invoice.cshtml index e078fdae1..00e7e13ac 100644 --- a/BTCPayServer/Views/Invoice/Invoice.cshtml +++ b/BTCPayServer/Views/Invoice/Invoice.cshtml @@ -155,11 +155,11 @@