diff --git a/BTCPayServer/Views/AppsPublic/PointOfSale/Print.cshtml b/BTCPayServer/Views/AppsPublic/PointOfSale/Print.cshtml index a9195654f..89cb543e1 100644 --- a/BTCPayServer/Views/AppsPublic/PointOfSale/Print.cshtml +++ b/BTCPayServer/Views/AppsPublic/PointOfSale/Print.cshtml @@ -4,119 +4,87 @@ @inject BTCPayNetworkProvider BTCPayNetworkProvider @model BTCPayServer.Models.AppViewModels.ViewPointOfSaleViewModel + + @{ + Layout = "_LayoutPos"; Context.Request.Query.TryGetValue("cryptocode", out var cryptoCodeValues); var cryptoCode = cryptoCodeValues.FirstOrDefault() ?? "BTC"; - Layout = "_LayoutPos"; - var anyInventoryItems = Model.Items.Any(item => item.Inventory.HasValue); var supported = Model.Store.GetSupportedPaymentMethods(BTCPayNetworkProvider).OfType().OrderBy(method => method.CryptoCode == cryptoCode).FirstOrDefault(); if (supported != null && !Model.Store.GetEnabledPaymentIds(BTCPayNetworkProvider).Contains(supported.PaymentId)) { supported = null; } - } + @if (supported is null) { } -
-
- - -

@Model.Title

- @if (!string.IsNullOrEmpty(Model.Description)) - { -
-
@Safe.Raw(Model.Description)
-
- } -
- @for (int x = 0; x < Model.Items.Length; x++) - { - var item = Model.Items[x]; - var buttonText = string.IsNullOrEmpty(item.BuyButtonText) ? item.Price.Type != ViewPointOfSaleViewModel.Item.ItemPrice.ItemPriceType.Fixed ? Model.CustomButtonText : Model.ButtonText : item.BuyButtonText; - buttonText = buttonText.Replace("{0}",item.Price.Formatted) - ?.Replace("{Price}",item.Price.Formatted); - -
- @if (!String.IsNullOrWhiteSpace(item.Image)) - { - - } - @{CardBody(item.Title, item.Description);} - -
- } -
+else +{ + -
+} -@functions { - private void CardBody(string title, string description) +
+ @for (int x = 0; x < Model.Items.Length; x++) { -
-
@title
- @if (!String.IsNullOrWhiteSpace(description)) - { -

@Safe.Raw(description)

- } + var item = Model.Items[x]; +
+
+

@item.Title

+
+ @switch (item.Price.Type) + { + case ViewPointOfSaleViewModel.Item.ItemPrice.ItemPriceType.Topup: + Any amount + break; + case ViewPointOfSaleViewModel.Item.ItemPrice.ItemPriceType.Minimum: + @item.Price.Formatted minimum + break; + case ViewPointOfSaleViewModel.Item.ItemPrice.ItemPriceType.Fixed: + @item.Price.Formatted + break; + default: + throw new ArgumentOutOfRangeException(); + } +
+ @if (!item.Inventory.HasValue || item.Inventory.Value > 0) + { + if (supported != null) + { + var lnurlEndpoint = new Uri(Url.Action("GetLNURLForApp", "LNURL", new + { + cryptoCode = supported.CryptoCode, + appid = Model.AppId, + ItemCode = item.Id + }, Context.Request.Scheme, Context.Request.Host.ToString())); + var lnUrl = LNURL.EncodeUri(lnurlEndpoint, "payRequest", supported.UseBech32Scheme); + + } + } +
} -} +