Can inject currency data in CurrencyNameTable (#6276)

This commit is contained in:
Nicolas Dorier
2024-10-04 22:24:44 +09:00
committed by GitHub
parent 206d222455
commit 64ba8248d2
13 changed files with 179 additions and 53 deletions

View File

@@ -875,9 +875,10 @@ namespace BTCPayServer.Controllers
return extension?.Image ?? "";
}
// Show the "Common divisibility" rather than the payment method disibility.
// For example, BTC has commonly 8 digits, but on lightning it has 11. In this case, pick 8.
if (this._CurrencyNameTable.GetCurrencyData(prompt.Currency, false)?.Divisibility is not int divisibility)
var cd = this._CurrencyNameTable.GetCurrencyData(prompt.Currency, false);
// Show the "Common divisibility" rather than the payment method disibility.
// For example, BTC has commonly 8 digits, but on lightning it has 11. In this case, pick 8.
if (cd?.Divisibility is not int divisibility)
divisibility = prompt.Divisibility;
string ShowMoney(decimal value) => MoneyExtensions.ShowMoney(value, divisibility);