Minor refactoring about DefaultPaymentMethod

This commit is contained in:
nicolas.dorier
2023-05-08 09:14:58 +09:00
parent 18e34b3cbe
commit 03b94e2be3
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."); ModelState.AddModelError(nameof(request.Amount), "The amount should be 0 or more.");
} }
request.Checkout ??= new CreateInvoiceRequest.CheckoutOptions(); request.Checkout ??= new CreateInvoiceRequest.CheckoutOptions();
request.Checkout.DefaultPaymentMethod ??= store.GetDefaultPaymentId()?.ToStringNormalized();
if (request.Checkout.PaymentMethods?.Any() is true) if (request.Checkout.PaymentMethods?.Any() is true)
{ {
for (int i = 0; i < request.Checkout.PaymentMethods.Length; i++) 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.SpeedPolicy = invoice.Checkout.SpeedPolicy ?? store.SpeedPolicy;
entity.DefaultLanguage = invoice.Checkout.DefaultLanguage; 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.RedirectAutomatically = invoice.Checkout.RedirectAutomatically ?? storeBlob.RedirectAutomatically;
entity.CheckoutType = invoice.Checkout.CheckoutType; entity.CheckoutType = invoice.Checkout.CheckoutType;
entity.RequiresRefundEmail = invoice.Checkout.RequiresRefundEmail; entity.RequiresRefundEmail = invoice.Checkout.RequiresRefundEmail;