mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-15 11:14:24 +01:00
Update price display (#4736)
* Update price display As proposed by @dstrukt in #4364. * Update format * Unify price display across the app * Add DisplayFormatter * Replace DisplayFormatCurrency method * Use symbol currency format for invoice * Unify currency formats on backend pages * Revert recent changes * Do not show exchange rate and fiat order amount for crypto denominations * Fix test and add test cases
This commit is contained in:
@@ -14,6 +14,7 @@ using BTCPayServer.Forms.Models;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Models.PaymentRequestViewModels;
|
||||
using BTCPayServer.PaymentRequest;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Services.Invoices;
|
||||
using BTCPayServer.Services.PaymentRequests;
|
||||
using BTCPayServer.Services.Rates;
|
||||
@@ -37,6 +38,7 @@ namespace BTCPayServer.Controllers
|
||||
private readonly PaymentRequestService _PaymentRequestService;
|
||||
private readonly EventAggregator _EventAggregator;
|
||||
private readonly CurrencyNameTable _Currencies;
|
||||
private readonly DisplayFormatter _displayFormatter;
|
||||
private readonly InvoiceRepository _InvoiceRepository;
|
||||
private readonly StoreRepository _storeRepository;
|
||||
|
||||
@@ -50,6 +52,7 @@ namespace BTCPayServer.Controllers
|
||||
PaymentRequestService paymentRequestService,
|
||||
EventAggregator eventAggregator,
|
||||
CurrencyNameTable currencies,
|
||||
DisplayFormatter displayFormatter,
|
||||
StoreRepository storeRepository,
|
||||
InvoiceRepository invoiceRepository,
|
||||
FormComponentProviders formProviders,
|
||||
@@ -61,6 +64,7 @@ namespace BTCPayServer.Controllers
|
||||
_PaymentRequestService = paymentRequestService;
|
||||
_EventAggregator = eventAggregator;
|
||||
_Currencies = currencies;
|
||||
_displayFormatter = displayFormatter;
|
||||
_storeRepository = storeRepository;
|
||||
_InvoiceRepository = invoiceRepository;
|
||||
FormProviders = formProviders;
|
||||
@@ -89,7 +93,7 @@ namespace BTCPayServer.Controllers
|
||||
var blob = data.GetBlob();
|
||||
return new ViewPaymentRequestViewModel(data)
|
||||
{
|
||||
AmountFormatted = _Currencies.DisplayFormatCurrency(blob.Amount, blob.Currency)
|
||||
AmountFormatted = _displayFormatter.Currency(blob.Amount, blob.Currency)
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user