@using BTCPayServer.Payments.Lightning @using BTCPayServer.Plugins.PointOfSale.Models @using BTCPayServer.Services @using BTCPayServer.Services.Stores @using LNURL @inject BTCPayNetworkProvider BTCPayNetworkProvider @inject StoreRepository StoreRepository @model BTCPayServer.Plugins.PointOfSale.Models.ViewPointOfSaleViewModel @inject DisplayFormatter DisplayFormatter @{ 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 supported = store.GetSupportedPaymentMethods(BTCPayNetworkProvider).OfType().OrderBy(method => method.CryptoCode == cryptoCode).FirstOrDefault(); if (supported != null && !store.GetEnabledPaymentIds(BTCPayNetworkProvider).Contains(supported.PaymentId)) { 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[] { new ViewPointOfSaleViewModel.Item() { Description = "Create invoice to pay custom amount", Title = "Custom amount", BuyButtonText = Model.CustomButtonText, PriceType = ViewPointOfSaleViewModel.ItemPriceType.Topup } }).ToArray(); } }
@for (var x = 0; x < Model.Items.Length; x++) { var item = Model.Items[x];

@Safe.Raw(item.Title)

@if (!string.IsNullOrEmpty(item.Description)) {

@Safe.Raw(item.Description)

}
@{ var formatted = DisplayFormatter.Currency(item.Price ?? 0, Model.CurrencyCode, DisplayFormatter.CurrencyFormat.Symbol); } @switch (item.PriceType) { case ViewPointOfSaleViewModel.ItemPriceType.Topup: Any amount break; case ViewPointOfSaleViewModel.ItemPriceType.Minimum: @formatted minimum break; case ViewPointOfSaleViewModel.ItemPriceType.Fixed: @formatted break; default: throw new ArgumentOutOfRangeException(); }
@if (!item.Inventory.HasValue || item.Inventory.Value > 0) { if (supported != null) { var lnurlEndpoint = new Uri(Url.Action("GetLNURLForApp", "UILNURL", 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); } }
}