Greenfield: Add missing checkout (V2) settings (#5406)

* Greenfield: Add missing checkout (V2) settings

Closes #5403.

* Fix swagger
This commit is contained in:
d11n 2023-10-18 12:20:05 +02:00 committed by GitHub
parent ec076d1560
commit 097ffbf8a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 5 deletions

View file

@ -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; }

View file

@ -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<PaymentMethodCriteriaData>()
}).ToList() ?? new List<PaymentMethodCriteriaData>()
};
}
@ -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

View file

@ -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; }

View file

@ -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,