diff --git a/BTCPayServer.Client/Models/StoreBaseData.cs b/BTCPayServer.Client/Models/StoreBaseData.cs index f4dccdd18..e2eba71ca 100644 --- a/BTCPayServer.Client/Models/StoreBaseData.cs +++ b/BTCPayServer.Client/Models/StoreBaseData.cs @@ -73,6 +73,17 @@ namespace BTCPayServer.Client.Models public bool PayJoinEnabled { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool? AutoDetectLanguage { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool? ShowPayInWalletButton { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool? ShowStoreHeader { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool? CelebratePayment { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool? PlaySoundOnPayment { get; set; } + public InvoiceData.ReceiptOptions Receipt { get; set; } diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoresController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoresController.cs index 63be188fd..08d094366 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoresController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoresController.cs @@ -153,13 +153,18 @@ namespace BTCPayServer.Controllers.Greenfield LightningDescriptionTemplate = storeBlob.LightningDescriptionTemplate, PaymentTolerance = storeBlob.PaymentTolerance, PayJoinEnabled = storeBlob.PayJoinEnabled, - PaymentMethodCriteria = storeBlob.PaymentMethodCriteria?.Where(criteria => criteria.Value is not null)?.Select(criteria => new PaymentMethodCriteriaData() + AutoDetectLanguage = storeBlob.AutoDetectLanguage, + ShowPayInWalletButton = storeBlob.ShowPayInWalletButton, + ShowStoreHeader = storeBlob.ShowStoreHeader, + CelebratePayment = storeBlob.CelebratePayment, + PlaySoundOnPayment = storeBlob.PlaySoundOnPayment, + PaymentMethodCriteria = storeBlob.PaymentMethodCriteria?.Where(criteria => criteria.Value is not null).Select(criteria => new PaymentMethodCriteriaData { Above = criteria.Above, Amount = criteria.Value.Value, CurrencyCode = criteria.Value.Currency, PaymentMethod = criteria.PaymentMethod.ToStringNormalized() - })?.ToList() ?? new List() + }).ToList() ?? new List() }; } @@ -201,11 +206,21 @@ namespace BTCPayServer.Controllers.Greenfield blob.LightningDescriptionTemplate = restModel.LightningDescriptionTemplate; blob.PaymentTolerance = restModel.PaymentTolerance; blob.PayJoinEnabled = restModel.PayJoinEnabled; + if (restModel.AutoDetectLanguage.HasValue) + blob.AutoDetectLanguage = restModel.AutoDetectLanguage.Value; + if (restModel.ShowPayInWalletButton.HasValue) + blob.ShowPayInWalletButton = restModel.ShowPayInWalletButton.Value; + if (restModel.ShowStoreHeader.HasValue) + blob.ShowStoreHeader = restModel.ShowStoreHeader.Value; + if (restModel.CelebratePayment.HasValue) + blob.CelebratePayment = restModel.CelebratePayment.Value; + if (restModel.PlaySoundOnPayment.HasValue) + blob.PlaySoundOnPayment = restModel.PlaySoundOnPayment.Value; blob.PaymentMethodCriteria = restModel.PaymentMethodCriteria?.Select(criteria => - new PaymentMethodCriteria() + new PaymentMethodCriteria { Above = criteria.Above, - Value = new CurrencyValue() + Value = new CurrencyValue { Currency = criteria.CurrencyCode, Value = criteria.Amount diff --git a/BTCPayServer/Data/StoreBlob.cs b/BTCPayServer/Data/StoreBlob.cs index 9da287e02..89625fdbd 100644 --- a/BTCPayServer/Data/StoreBlob.cs +++ b/BTCPayServer/Data/StoreBlob.cs @@ -241,7 +241,7 @@ namespace BTCPayServer.Data [DefaultValue(false)] [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] - public bool PlaySoundOnPayment { get; set; } = false; + public bool PlaySoundOnPayment { get; set; } public string SoundFileId { get; set; } diff --git a/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores.json b/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores.json index b6583723b..186083b0b 100644 --- a/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores.json +++ b/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores.json @@ -542,6 +542,31 @@ "default": false, "description": "If true, payjoin will be proposed in the checkout page if possible. ([More information](https://docs.btcpayserver.org/Payjoin/))" }, + "autoDetectLanguage": { + "type": "boolean", + "default": false, + "description": "If true, the language on the checkout page will adapt to the language defined by the user's browser settings" + }, + "showPayInWalletButton": { + "type": "boolean", + "default": true, + "description": "If true, the \"Pay in wallet\" button will be shown on the checkout page (Checkout V2)" + }, + "showStoreHeader": { + "type": "boolean", + "default": true, + "description": "If true, the store header will be shown on the checkout page (Checkout V2)" + }, + "celebratePayment": { + "type": "boolean", + "default": true, + "description": "If true, payments on the checkout page will be celebrated with confetti (Checkout V2)" + }, + "playSoundOnPayment": { + "type": "boolean", + "default": false, + "description": "If true, sounds on the checkout page will be enabled (Checkout V2)" + }, "lazyPaymentMethods": { "type": "boolean", "default": false,