mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
Greenfield: Make checkout type V2 default for new stores (#5495)
This commit is contained in:
@@ -37,8 +37,11 @@ namespace BTCPayServer.Client.Models
|
|||||||
public bool AnyoneCanCreateInvoice { get; set; }
|
public bool AnyoneCanCreateInvoice { get; set; }
|
||||||
public string DefaultCurrency { get; set; }
|
public string DefaultCurrency { get; set; }
|
||||||
public bool RequiresRefundEmail { get; set; }
|
public bool RequiresRefundEmail { get; set; }
|
||||||
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public CheckoutType CheckoutType { get; set; }
|
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public CheckoutType? CheckoutType { get; set; }
|
||||||
|
|
||||||
public bool LightningAmountInSatoshi { get; set; }
|
public bool LightningAmountInSatoshi { get; set; }
|
||||||
public bool LightningPrivateRouteHints { get; set; }
|
public bool LightningPrivateRouteHints { get; set; }
|
||||||
public bool OnChainWithLnInvoiceFallback { get; set; }
|
public bool OnChainWithLnInvoiceFallback { get; set; }
|
||||||
|
|||||||
@@ -1284,15 +1284,18 @@ namespace BTCPayServer.Tests
|
|||||||
var client = await user.CreateClient(Policies.Unrestricted);
|
var client = await user.CreateClient(Policies.Unrestricted);
|
||||||
|
|
||||||
//create store
|
//create store
|
||||||
var newStore = await client.CreateStore(new CreateStoreRequest() { Name = "A" });
|
var newStore = await client.CreateStore(new CreateStoreRequest { Name = "A" });
|
||||||
|
Assert.Equal("A", newStore.Name);
|
||||||
|
Assert.Equal(CheckoutType.V2, newStore.CheckoutType);
|
||||||
|
|
||||||
//update store
|
//update store
|
||||||
Assert.Empty(newStore.PaymentMethodCriteria);
|
Assert.Empty(newStore.PaymentMethodCriteria);
|
||||||
await client.GenerateOnChainWallet(newStore.Id, "BTC", new GenerateOnChainWalletRequest());
|
await client.GenerateOnChainWallet(newStore.Id, "BTC", new GenerateOnChainWalletRequest());
|
||||||
var updatedStore = await client.UpdateStore(newStore.Id, new UpdateStoreRequest()
|
var updatedStore = await client.UpdateStore(newStore.Id, new UpdateStoreRequest
|
||||||
{
|
{
|
||||||
Name = "B",
|
Name = "B",
|
||||||
PaymentMethodCriteria = new List<PaymentMethodCriteriaData>()
|
CheckoutType = CheckoutType.V1,
|
||||||
|
PaymentMethodCriteria = new List<PaymentMethodCriteriaData>
|
||||||
{
|
{
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
@@ -1304,6 +1307,7 @@ namespace BTCPayServer.Tests
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.Equal("B", updatedStore.Name);
|
Assert.Equal("B", updatedStore.Name);
|
||||||
|
Assert.Equal(CheckoutType.V1, updatedStore.CheckoutType);
|
||||||
var s = (await client.GetStore(newStore.Id));
|
var s = (await client.GetStore(newStore.Id));
|
||||||
Assert.Equal("B", s.Name);
|
Assert.Equal("B", s.Name);
|
||||||
var pmc = Assert.Single(s.PaymentMethodCriteria);
|
var pmc = Assert.Single(s.PaymentMethodCriteria);
|
||||||
|
|||||||
@@ -185,7 +185,6 @@ namespace BTCPayServer.Controllers.Greenfield
|
|||||||
blob.NetworkFeeMode = restModel.NetworkFeeMode;
|
blob.NetworkFeeMode = restModel.NetworkFeeMode;
|
||||||
blob.DefaultCurrency = restModel.DefaultCurrency;
|
blob.DefaultCurrency = restModel.DefaultCurrency;
|
||||||
blob.RequiresRefundEmail = restModel.RequiresRefundEmail;
|
blob.RequiresRefundEmail = restModel.RequiresRefundEmail;
|
||||||
blob.CheckoutType = restModel.CheckoutType;
|
|
||||||
blob.ReceiptOptions = InvoiceDataBase.ReceiptOptions.Merge(restModel.Receipt, null);
|
blob.ReceiptOptions = InvoiceDataBase.ReceiptOptions.Merge(restModel.Receipt, null);
|
||||||
blob.LightningAmountInSatoshi = restModel.LightningAmountInSatoshi;
|
blob.LightningAmountInSatoshi = restModel.LightningAmountInSatoshi;
|
||||||
blob.LightningPrivateRouteHints = restModel.LightningPrivateRouteHints;
|
blob.LightningPrivateRouteHints = restModel.LightningPrivateRouteHints;
|
||||||
@@ -206,6 +205,8 @@ namespace BTCPayServer.Controllers.Greenfield
|
|||||||
blob.LightningDescriptionTemplate = restModel.LightningDescriptionTemplate;
|
blob.LightningDescriptionTemplate = restModel.LightningDescriptionTemplate;
|
||||||
blob.PaymentTolerance = restModel.PaymentTolerance;
|
blob.PaymentTolerance = restModel.PaymentTolerance;
|
||||||
blob.PayJoinEnabled = restModel.PayJoinEnabled;
|
blob.PayJoinEnabled = restModel.PayJoinEnabled;
|
||||||
|
if (restModel.CheckoutType.HasValue)
|
||||||
|
blob.CheckoutType = restModel.CheckoutType.Value;
|
||||||
if (restModel.AutoDetectLanguage.HasValue)
|
if (restModel.AutoDetectLanguage.HasValue)
|
||||||
blob.AutoDetectLanguage = restModel.AutoDetectLanguage.Value;
|
blob.AutoDetectLanguage = restModel.AutoDetectLanguage.Value;
|
||||||
if (restModel.ShowPayInWalletButton.HasValue)
|
if (restModel.ShowPayInWalletButton.HasValue)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace BTCPayServer.Data
|
|||||||
public NetworkFeeMode NetworkFeeMode { get; set; }
|
public NetworkFeeMode NetworkFeeMode { get; set; }
|
||||||
|
|
||||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||||
[DefaultValue(CheckoutType.V1)]
|
[DefaultValue(CheckoutType.V2)]
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
public CheckoutType CheckoutType { get; set; }
|
public CheckoutType CheckoutType { get; set; }
|
||||||
public bool RequiresRefundEmail { get; set; }
|
public bool RequiresRefundEmail { get; set; }
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "`\"V1\"`: The original checkout form \n`\"V2\"`: The new experimental checkout form",
|
"description": "`\"V1\"`: The original checkout form \n`\"V2\"`: The new experimental checkout form",
|
||||||
"nullable": true,
|
"nullable": true,
|
||||||
"default": "V1",
|
"default": "V2",
|
||||||
"x-enumNames": [
|
"x-enumNames": [
|
||||||
"V1",
|
"V1",
|
||||||
"V2"
|
"V2"
|
||||||
|
|||||||
Reference in New Issue
Block a user