mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Minor refactoring about DefaultPaymentMethod
This commit is contained in:
@@ -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++)
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user