mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-11 01:35:22 +01:00
(bug) handle null XMR settings (#5909)
Co-authored-by: Henry Hollingworth <henry.hollingworth@alcoa.com>
This commit is contained in:
parent
6846a7cef5
commit
b9cea968e5
1 changed files with 17 additions and 10 deletions
|
@ -109,14 +109,19 @@ namespace BTCPayServer.Services.Altcoins.Monero.UI
|
||||||
new SelectListItem(
|
new SelectListItem(
|
||||||
$"{account.AccountIndex} - {(string.IsNullOrEmpty(account.Label) ? "No label" : account.Label)}",
|
$"{account.AccountIndex} - {(string.IsNullOrEmpty(account.Label) ? "No label" : account.Label)}",
|
||||||
account.AccountIndex.ToString(CultureInfo.InvariantCulture)));
|
account.AccountIndex.ToString(CultureInfo.InvariantCulture)));
|
||||||
var settlementThresholdChoice = settings.InvoiceSettledConfirmationThreshold switch
|
|
||||||
|
var settlementThresholdChoice = MoneroLikeSettlementThresholdChoice.StoreSpeedPolicy;
|
||||||
|
if (settings != null && settings.InvoiceSettledConfirmationThreshold is { } confirmations)
|
||||||
|
{
|
||||||
|
settlementThresholdChoice = confirmations switch
|
||||||
{
|
{
|
||||||
null => MoneroLikeSettlementThresholdChoice.StoreSpeedPolicy,
|
|
||||||
0 => MoneroLikeSettlementThresholdChoice.ZeroConfirmation,
|
0 => MoneroLikeSettlementThresholdChoice.ZeroConfirmation,
|
||||||
1 => MoneroLikeSettlementThresholdChoice.AtLeastOne,
|
1 => MoneroLikeSettlementThresholdChoice.AtLeastOne,
|
||||||
10 => MoneroLikeSettlementThresholdChoice.AtLeastTen,
|
10 => MoneroLikeSettlementThresholdChoice.AtLeastTen,
|
||||||
_ => MoneroLikeSettlementThresholdChoice.Custom
|
_ => MoneroLikeSettlementThresholdChoice.Custom
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return new MoneroLikePaymentMethodViewModel()
|
return new MoneroLikePaymentMethodViewModel()
|
||||||
{
|
{
|
||||||
WalletFileFound = System.IO.File.Exists(fileAddress),
|
WalletFileFound = System.IO.File.Exists(fileAddress),
|
||||||
|
@ -129,7 +134,9 @@ namespace BTCPayServer.Services.Altcoins.Monero.UI
|
||||||
Accounts = accounts == null ? null : new SelectList(accounts, nameof(SelectListItem.Value),
|
Accounts = accounts == null ? null : new SelectList(accounts, nameof(SelectListItem.Value),
|
||||||
nameof(SelectListItem.Text)),
|
nameof(SelectListItem.Text)),
|
||||||
SettlementConfirmationThresholdChoice = settlementThresholdChoice,
|
SettlementConfirmationThresholdChoice = settlementThresholdChoice,
|
||||||
CustomSettlementConfirmationThreshold = settlementThresholdChoice is MoneroLikeSettlementThresholdChoice.Custom
|
CustomSettlementConfirmationThreshold =
|
||||||
|
settings != null &&
|
||||||
|
settlementThresholdChoice is MoneroLikeSettlementThresholdChoice.Custom
|
||||||
? settings.InvoiceSettledConfirmationThreshold
|
? settings.InvoiceSettledConfirmationThreshold
|
||||||
: null
|
: null
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue