Minor refactoring about DefaultPaymentMethod

This commit is contained in:
nicolas.dorier 2023-05-08 09:14:58 +09:00
parent 18e34b3cbe
commit 03b94e2be3
No known key found for this signature in database
GPG key ID: 6618763EF09186FE
2 changed files with 1 additions and 2 deletions

View file

@ -184,7 +184,6 @@ namespace BTCPayServer.Controllers.Greenfield
ModelState.AddModelError(nameof(request.Amount), "The amount should be 0 or more.");
}
request.Checkout ??= new CreateInvoiceRequest.CheckoutOptions();
request.Checkout.DefaultPaymentMethod ??= store.GetDefaultPaymentId()?.ToStringNormalized();
if (request.Checkout.PaymentMethods?.Any() is true)
{
for (int i = 0; i < request.Checkout.PaymentMethods.Length; i++)

View file

@ -245,7 +245,7 @@ namespace BTCPayServer.Controllers
}
entity.SpeedPolicy = invoice.Checkout.SpeedPolicy ?? store.SpeedPolicy;
entity.DefaultLanguage = invoice.Checkout.DefaultLanguage;
entity.DefaultPaymentMethod = invoice.Checkout.DefaultPaymentMethod;
entity.DefaultPaymentMethod = invoice.Checkout.DefaultPaymentMethod ?? store.GetDefaultPaymentId()?.ToStringNormalized() ?? new PaymentMethodId(_NetworkProvider.DefaultNetwork.CryptoCode, PaymentTypes.BTCLike).ToStringNormalized();
entity.RedirectAutomatically = invoice.Checkout.RedirectAutomatically ?? storeBlob.RedirectAutomatically;
entity.CheckoutType = invoice.Checkout.CheckoutType;
entity.RequiresRefundEmail = invoice.Checkout.RequiresRefundEmail;