@using BTCPayServer.Abstractions.TagHelpers @using BTCPayServer.Client.Models @using BTCPayServer.Components.QRCode @using BTCPayServer.Payments @using BTCPayServer.Payments.Lightning @using BTCPayServer.Services @using BTCPayServer.Services.Invoices @using BTCPayServer.Services.Stores @using LNURL @using Microsoft.AspNetCore.Mvc.TagHelpers @inject StoreRepository StoreRepository @inject PaymentMethodHandlerDictionary Handlers @inject DisplayFormatter DisplayFormatter @model BTCPayServer.Plugins.PointOfSale.Models.ViewPointOfSaleViewModel @{ var store = await StoreRepository.FindStore(Model.StoreId); Layout = "PointOfSale/Public/_Layout"; Context.Request.Query.TryGetValue("cryptocode", out var cryptoCodeValues); var cryptoCode = cryptoCodeValues.FirstOrDefault() ?? "BTC"; var pmi = PaymentTypes.LNURL.GetPaymentMethodId(cryptoCode); var supported = store.GetPaymentMethodConfig(pmi, Handlers); if (supported is not null && !store.GetEnabledPaymentIds().Contains(pmi)) { supported = null; } } @section PageHeadContent { } @if (supported is null) { } else { }
@if (!string.IsNullOrEmpty(Model.Description)) {
@Safe.Raw(Model.Description)
}
@if (supported is not null) { if (Model.ShowCustomAmount) { Model.Items = Model.Items.Concat([ new AppItem { Description = "Create invoice to pay custom amount", Title = "Custom amount", BuyButtonText = Model.CustomButtonText, PriceType = AppItemPriceType.Topup } ]).ToArray(); } }
@for (var x = 0; x < Model.Items.Length; x++) { var item = Model.Items[x]; var formatted = DisplayFormatter.Currency(item.Price ?? 0, Model.CurrencyCode, DisplayFormatter.CurrencyFormat.Symbol); if (item.PriceType == AppItemPriceType.Fixed && item.Price == 0) continue;
@Safe.Raw(item.Title)
@switch (item.PriceType) { case AppItemPriceType.Topup: Any amount break; case AppItemPriceType.Minimum: @formatted minimum break; case AppItemPriceType.Fixed: @formatted break; default: throw new ArgumentOutOfRangeException(); } @if (item.Inventory.HasValue) { @if (item.Inventory > 0) { @ViewLocalizer["{0} left", item.Inventory.ToString()] } else { Sold out } }
@if (!string.IsNullOrWhiteSpace(item.Description)) {

@Safe.Raw(item.Description)

}
@if (item.Inventory is null or > 0) { if (supported != null) { var lnurlEndpoint = new Uri(Url.Action("GetLNURLForApp", "UILNURL", new { cryptoCode = cryptoCode, appid = Model.AppId, ItemCode = item.Id }, Context.Request.Scheme, Context.Request.Host.ToString())); var lnUrl = LNURL.EncodeUri(lnurlEndpoint, "payRequest", supported.UseBech32Scheme); } }
}