Do not crash if payment method disabled when store supports it

This commit is contained in:
nicolas.dorier 2024-10-03 19:21:01 +09:00
parent 0f79526566
commit a698aa8a5b
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE

View File

@ -121,9 +121,11 @@ namespace BTCPayServer.Payments
}
foreach (var paymentMethodConfig in store.GetPaymentMethodConfigs())
{
var ctx = new PaymentMethodContext(store, storeBlob, paymentMethodConfig.Value, handlers[paymentMethodConfig.Key], invoiceEntity, invoiceLogs);
if (!handlers.TryGetValue(paymentMethodConfig.Key, out var handler))
continue;
var ctx = new PaymentMethodContext(store, storeBlob, paymentMethodConfig.Value, handler, invoiceEntity, invoiceLogs);
PaymentMethodContexts.Add(paymentMethodConfig.Key, ctx);
if (excludeFilter.Match(paymentMethodConfig.Key) || !handlers.Support(paymentMethodConfig.Key))
if (excludeFilter.Match(paymentMethodConfig.Key))
ctx.Status = PaymentMethodContext.ContextStatus.Excluded;
}
}