@using BTCPayServer.Models.AppViewModels @using BTCPayServer.Payments.Lightning @using BTCPayServer.Plugins.PointOfSale.Models @using BTCPayServer.Services.Stores @using LNURL @inject BTCPayNetworkProvider BTCPayNetworkProvider @inject StoreRepository StoreRepository @model BTCPayServer.Plugins.PointOfSale.Models.ViewPointOfSaleViewModel @{ var store = await StoreRepository.FindStore(Model.StoreId); Layout = "_LayoutPos"; 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; } } @if (supported is null) { } else { 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, Price = new ViewPointOfSaleViewModel.Item.ItemPrice() { Type = ViewPointOfSaleViewModel.Item.ItemPrice.ItemPriceType.Topup, } } }).ToArray(); } }
@for (int x = 0; x < Model.Items.Length; x++) { var item = Model.Items[x];

@item.Title

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

@item.Description

}
@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", "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); } }
}