diff --git a/BTCPayServer/Plugins/PointOfSale/PointOfSalePlugin.cs b/BTCPayServer/Plugins/PointOfSale/PointOfSalePlugin.cs index 47b284a71..50ecd957b 100644 --- a/BTCPayServer/Plugins/PointOfSale/PointOfSalePlugin.cs +++ b/BTCPayServer/Plugins/PointOfSale/PointOfSalePlugin.cs @@ -51,7 +51,6 @@ namespace BTCPayServer.Plugins.PointOfSale private readonly LinkGenerator _linkGenerator; private readonly IOptions _btcPayServerOptions; private readonly DisplayFormatter _displayFormatter; - private readonly HtmlSanitizer _htmlSanitizer; public const string AppType = "PointOfSale"; public PointOfSaleAppType( @@ -65,7 +64,6 @@ namespace BTCPayServer.Plugins.PointOfSale _linkGenerator = linkGenerator; _btcPayServerOptions = btcPayServerOptions; _displayFormatter = displayFormatter; - _htmlSanitizer = htmlSanitizer; } public override Task ConfigureLink(AppData app) diff --git a/BTCPayServer/Services/Apps/PointOfSaleSettings.cs b/BTCPayServer/Services/Apps/PointOfSaleSettings.cs index 4cefcffe9..e028909a5 100644 --- a/BTCPayServer/Services/Apps/PointOfSaleSettings.cs +++ b/BTCPayServer/Services/Apps/PointOfSaleSettings.cs @@ -34,44 +34,44 @@ namespace BTCPayServer.Services.Apps new() { Id = "rooibos", - Title = "Rooibos", + Title = "Rooibos (limited)", Description = "Rooibos is a dramatic red tea made from a South African herb that contains polyphenols and flavonoids. Often called 'African redbush tea', Rooibos herbal tea delights the senses and delivers potential health benefits with each caffeine-free sip.", Image = "~/img/pos-sample/rooibos.jpg", PriceType = ViewPointOfSaleViewModel.ItemPriceType.Fixed, - Price = 1.2m + Price = 1.2m, + Inventory = 5, }, new() { Id = "pu-erh", - Title = "Pu Erh", + Title = "Pu Erh (free)", Description = "This loose pur-erh tea is produced in Yunnan Province, China. The process in a relatively high humidity environment has mellowed the elemental character of the tea when compared to young Pu-erh.", Image = "~/img/pos-sample/pu-erh.jpg", PriceType = ViewPointOfSaleViewModel.ItemPriceType.Fixed, - Price = 2 + Price = 0 }, new() { Id = "herbal-tea", - Title = "Herbal Tea", + Title = "Herbal Tea (minimum)", Description = "Chamomile tea is made from the flower heads of the chamomile plant. The medicinal use of chamomile dates back to the ancient Egyptians, Romans and Greeks. Pay us what you want!", Image = "~/img/pos-sample/herbal-tea.jpg", PriceType = ViewPointOfSaleViewModel.ItemPriceType.Minimum, Price = 1.8m, - Disabled = true + Disabled = false }, new() { Id = "fruit-tea", - Title = "Fruit Tea", + Title = "Fruit Tea (any amount)", Description = "The Tibetan Himalayas, the land is majestic and beautiful—a spiritual place where, despite the perilous environment, many journey seeking enlightenment. Pay us what you want!", Image = "~/img/pos-sample/fruit-tea.jpg", PriceType = ViewPointOfSaleViewModel.ItemPriceType.Topup, - Inventory = 5, - Disabled = true + Disabled = false } }); DefaultView = PosViewType.Static; diff --git a/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml b/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml index b4bee7f11..bef16c403 100644 --- a/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml +++ b/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml @@ -255,7 +255,7 @@ @{ - var buttonText = string.IsNullOrEmpty(item.BuyButtonText) ? item.PriceType != ViewPointOfSaleViewModel.ItemPriceType.Fixed ? Model.CustomButtonText : Model.ButtonText : item.BuyButtonText; + var buttonText = string.IsNullOrEmpty(item.BuyButtonText) ? item.PriceType == ViewPointOfSaleViewModel.ItemPriceType.Topup ? Model.CustomButtonText : Model.ButtonText : item.BuyButtonText; if (item.PriceType != ViewPointOfSaleViewModel.ItemPriceType.Topup) { var formatted = DisplayFormatter.Currency(item.Price ?? 0, Model.CurrencyCode, DisplayFormatter.CurrencyFormat.Symbol); diff --git a/BTCPayServer/wwwroot/cart/js/cart.js b/BTCPayServer/wwwroot/cart/js/cart.js index 873058dd7..0d42c7968 100644 --- a/BTCPayServer/wwwroot/cart/js/cart.js +++ b/BTCPayServer/wwwroot/cart/js/cart.js @@ -112,7 +112,7 @@ Cart.prototype.getTotalProducts = function() { typeof this.content[key] != 'undefined' && !this.content[key].disabled ) { - const price = this.toCents(this.content[key].price.value ||0); + const price = this.toCents(this.content[key].price ||0); amount += (this.content[key].count * price); } } @@ -438,7 +438,7 @@ Cart.prototype.listItems = function() { 'title': this.escape(item.title), 'count': this.escape(item.count), 'inventory': this.escape(item.inventory < 0? 99999: item.inventory), - 'price': this.escape(item.price.formatted || 0) + 'price': this.escape(item.price || 0) }); list.push($(tableTemplate)); }