From abe29f21f0f14f7d33ea8a78c09505cfbaea29ae Mon Sep 17 00:00:00 2001 From: d11n Date: Thu, 9 Mar 2023 21:36:11 +0100 Subject: [PATCH] Checkout v2: Option to display amount in Sats in BIP21 case (#4730) --- BTCPayServer.Rating/Currencies.json | 2 +- BTCPayServer.Tests/CheckoutUITests.cs | 2 +- BTCPayServer.Tests/Checkoutv2Tests.cs | 16 ++++++++++++++-- BTCPayServer.Tests/FastTests.cs | 10 +++++----- BTCPayServer.Tests/PayJoinTests.cs | 2 +- .../Controllers/UIStoresController.cs | 3 ++- .../CheckoutAppearanceViewModel.cs | 3 +++ .../Bitcoin/BitcoinLikePaymentHandler.cs | 13 ++++++++++++- .../Payments/IPaymentMethodHandler.cs | 15 +++++++++++++++ .../LNURLPay/LNURLPayPaymentHandler.cs | 19 +++---------------- .../Lightning/LightningLikePaymentHandler.cs | 14 +++----------- .../Views/UIInvoice/Checkout-Body.cshtml | 8 ++++---- BTCPayServer/Views/UIInvoice/Checkout.cshtml | 2 -- .../Views/UIInvoice/CheckoutV2.cshtml | 4 ++-- .../Views/UIStores/CheckoutAppearance.cshtml | 4 ++++ BTCPayServer/wwwroot/checkout-v2/checkout.js | 5 +---- 16 files changed, 71 insertions(+), 51 deletions(-) diff --git a/BTCPayServer.Rating/Currencies.json b/BTCPayServer.Rating/Currencies.json index 324a451ba..4283faf0a 100644 --- a/BTCPayServer.Rating/Currencies.json +++ b/BTCPayServer.Rating/Currencies.json @@ -1305,7 +1305,7 @@ "name":"Satoshis", "code":"SATS", "divisibility":0, - "symbol":"Sats", + "symbol":"sats", "crypto":true }, { diff --git a/BTCPayServer.Tests/CheckoutUITests.cs b/BTCPayServer.Tests/CheckoutUITests.cs index 028875413..b48711e2b 100644 --- a/BTCPayServer.Tests/CheckoutUITests.cs +++ b/BTCPayServer.Tests/CheckoutUITests.cs @@ -182,7 +182,7 @@ namespace BTCPayServer.Tests var invoiceId = s.CreateInvoice(10, "USD", "a@g.com"); s.GoToInvoiceCheckout(invoiceId); - Assert.Contains("Sats", s.Driver.FindElement(By.ClassName("payment__currencies_noborder")).Text); + Assert.Contains("sats", s.Driver.FindElement(By.ClassName("payment__currencies_noborder")).Text); } [Fact(Timeout = TestTimeout)] diff --git a/BTCPayServer.Tests/Checkoutv2Tests.cs b/BTCPayServer.Tests/Checkoutv2Tests.cs index 66ab1f1b3..fca082f6b 100644 --- a/BTCPayServer.Tests/Checkoutv2Tests.cs +++ b/BTCPayServer.Tests/Checkoutv2Tests.cs @@ -102,7 +102,7 @@ namespace BTCPayServer.Tests s.Driver.ElementDoesNotExist(By.Id("Address_BTC")); s.Driver.FindElement(By.Id("PayByLNURL")); - // Lightning amount in Sats + // Lightning amount in sats Assert.Contains("BTC", s.Driver.FindElement(By.Id("AmountDue")).Text); s.GoToHome(); s.GoToLightningSettings(); @@ -111,7 +111,7 @@ namespace BTCPayServer.Tests Assert.Contains("BTC Lightning settings successfully updated", s.FindAlertMessage().Text); s.GoToInvoiceCheckout(invoiceId); s.Driver.WaitUntilAvailable(By.Id("Checkout-v2")); - Assert.Contains("Sats", s.Driver.FindElement(By.Id("AmountDue")).Text); + Assert.Contains("sats", s.Driver.FindElement(By.Id("AmountDue")).Text); // Expire var expirySeconds = s.Driver.FindElement(By.Id("ExpirySeconds")); @@ -193,6 +193,7 @@ namespace BTCPayServer.Tests s.GoToHome(); s.GoToStore(StoreNavPages.CheckoutAppearance); s.Driver.SetCheckbox(By.Id("OnChainWithLnInvoiceFallback"), true); + s.Driver.SetCheckbox(By.Id("LightningAmountInSatoshi"), false); s.Driver.FindElement(By.Id("Save")).Click(); Assert.Contains("Store successfully updated", s.FindAlertMessage().Text); @@ -200,6 +201,7 @@ namespace BTCPayServer.Tests s.GoToInvoiceCheckout(invoiceId); s.Driver.WaitUntilAvailable(By.Id("Checkout-v2")); Assert.Empty(s.Driver.FindElements(By.CssSelector(".payment-method"))); + Assert.Contains("BTC", s.Driver.FindElement(By.Id("AmountDue")).Text); qrValue = s.Driver.FindElement(By.CssSelector(".qr-container")).GetAttribute("data-qr-value"); address = s.Driver.FindElement(By.CssSelector(".qr-container")).GetAttribute("data-clipboard"); payUrl = s.Driver.FindElement(By.Id("PayInWallet")).GetAttribute("href"); @@ -214,6 +216,16 @@ namespace BTCPayServer.Tests Assert.StartsWith($"bitcoin:{address.ToUpperInvariant()}?amount=", qrValue); Assert.Contains("&lightning=LNBCRT", qrValue); s.Driver.FindElement(By.Id("PayByLNURL")); + + // Switch to amount displayed in sats + s.GoToHome(); + s.GoToStore(StoreNavPages.CheckoutAppearance); + s.Driver.SetCheckbox(By.Id("LightningAmountInSatoshi"), true); + s.Driver.FindElement(By.Id("Save")).Click(); + Assert.Contains("Store successfully updated", s.FindAlertMessage().Text); + s.GoToInvoiceCheckout(invoiceId); + s.Driver.WaitUntilAvailable(By.Id("Checkout-v2")); + Assert.Contains("sats", s.Driver.FindElement(By.Id("AmountDue")).Text); // BIP21 with LN as default payment method s.GoToHome(); diff --git a/BTCPayServer.Tests/FastTests.cs b/BTCPayServer.Tests/FastTests.cs index aae0681f1..03fe2c645 100644 --- a/BTCPayServer.Tests/FastTests.cs +++ b/BTCPayServer.Tests/FastTests.cs @@ -326,7 +326,7 @@ namespace BTCPayServer.Tests var networkProvider = new BTCPayNetworkProvider(ChainName.Regtest); var paymentMethodHandlerDictionary = new PaymentMethodHandlerDictionary(new IPaymentMethodHandler[] { - new BitcoinLikePaymentHandler(null, networkProvider, null, null, null), + new BitcoinLikePaymentHandler(null, networkProvider, null, null, null, null), new LightningLikePaymentHandler(null, null, networkProvider, null, null, null), }); var entity = new InvoiceEntity(); @@ -512,7 +512,7 @@ namespace BTCPayServer.Tests var networkProvider = new BTCPayNetworkProvider(ChainName.Regtest); var paymentMethodHandlerDictionary = new PaymentMethodHandlerDictionary(new IPaymentMethodHandler[] { - new BitcoinLikePaymentHandler(null, networkProvider, null, null, null), + new BitcoinLikePaymentHandler(null, networkProvider, null, null, null, null), new LightningLikePaymentHandler(null, null, networkProvider, null, null, null), }); var entity = new InvoiceEntity(); @@ -1466,14 +1466,14 @@ namespace BTCPayServer.Tests Assert.Equal(1m / 0.000061m, rule2.BidAsk.Bid); // testing rounding - rule2 = rules.GetRuleFor(CurrencyPair.Parse("Sats_EUR")); + rule2 = rules.GetRuleFor(CurrencyPair.Parse("SATS_EUR")); rule2.ExchangeRates.SetRate("coinbase", CurrencyPair.Parse("BTC_EUR"), new BidAsk(1.23m, 2.34m)); Assert.True(rule2.Reevaluate()); Assert.Equal("0.00000001 * (1.23, 2.34)", rule2.ToString(true)); Assert.Equal(0.0000000234m, rule2.BidAsk.Ask); Assert.Equal(0.0000000123m, rule2.BidAsk.Bid); - rule2 = rules.GetRuleFor(CurrencyPair.Parse("EUR_Sats")); + rule2 = rules.GetRuleFor(CurrencyPair.Parse("EUR_SATS")); rule2.ExchangeRates.SetRate("coinbase", CurrencyPair.Parse("BTC_EUR"), new BidAsk(1.23m, 2.34m)); Assert.True(rule2.Reevaluate()); Assert.Equal("1 / (0.00000001 * (1.23, 2.34))", rule2.ToString(true)); @@ -1715,7 +1715,7 @@ namespace BTCPayServer.Tests var networkProvider = new BTCPayNetworkProvider(ChainName.Regtest); var paymentMethodHandlerDictionary = new PaymentMethodHandlerDictionary(new IPaymentMethodHandler[] { - new BitcoinLikePaymentHandler(null, networkProvider, null, null, null), + new BitcoinLikePaymentHandler(null, networkProvider, null, null, null, null), new LightningLikePaymentHandler(null, null, networkProvider, null, null, null), }); var networkBTC = networkProvider.GetNetwork("BTC"); diff --git a/BTCPayServer.Tests/PayJoinTests.cs b/BTCPayServer.Tests/PayJoinTests.cs index 2e6560b67..481d9b918 100644 --- a/BTCPayServer.Tests/PayJoinTests.cs +++ b/BTCPayServer.Tests/PayJoinTests.cs @@ -221,7 +221,7 @@ namespace BTCPayServer.Tests var receiverCoin = await receiverUser.ReceiveUTXO(Money.Satoshis(810), network); string errorCode = receiverAddressType == senderAddressType ? null : "unavailable|any UTXO available"; - var invoice = receiverUser.BitPay.CreateInvoice(new Invoice() { Price = 50000, Currency = "sats", FullNotifications = true }); + var invoice = receiverUser.BitPay.CreateInvoice(new Invoice() { Price = 50000, Currency = "SATS", FullNotifications = true }); if (unsupportedFormats.Contains(receiverAddressType)) { Assert.Null(TestAccount.GetPayjoinBitcoinUrl(invoice, cashCow.Network)); diff --git a/BTCPayServer/Controllers/UIStoresController.cs b/BTCPayServer/Controllers/UIStoresController.cs index 8fc88d6e6..b54d622c2 100644 --- a/BTCPayServer/Controllers/UIStoresController.cs +++ b/BTCPayServer/Controllers/UIStoresController.cs @@ -27,7 +27,6 @@ using BTCPayServer.Services.Stores; using BTCPayServer.Services.Wallets; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.DataProtection; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; @@ -388,6 +387,7 @@ namespace BTCPayServer.Controllers vm.UseNewCheckout = storeBlob.CheckoutType == Client.Models.CheckoutType.V2; vm.OnChainWithLnInvoiceFallback = storeBlob.OnChainWithLnInvoiceFallback; + vm.LightningAmountInSatoshi = storeBlob.LightningAmountInSatoshi; vm.RequiresRefundEmail = storeBlob.RequiresRefundEmail; vm.LazyPaymentMethods = storeBlob.LazyPaymentMethods; vm.RedirectAutomatically = storeBlob.RedirectAutomatically; @@ -507,6 +507,7 @@ namespace BTCPayServer.Controllers blob.CheckoutType = model.UseNewCheckout ? Client.Models.CheckoutType.V2 : Client.Models.CheckoutType.V1; blob.OnChainWithLnInvoiceFallback = model.OnChainWithLnInvoiceFallback; + blob.LightningAmountInSatoshi = model.LightningAmountInSatoshi; blob.RequiresRefundEmail = model.RequiresRefundEmail; blob.LazyPaymentMethods = model.LazyPaymentMethods; blob.RedirectAutomatically = model.RedirectAutomatically; diff --git a/BTCPayServer/Models/StoreViewModels/CheckoutAppearanceViewModel.cs b/BTCPayServer/Models/StoreViewModels/CheckoutAppearanceViewModel.cs index 01f9ea017..70aba10d4 100644 --- a/BTCPayServer/Models/StoreViewModels/CheckoutAppearanceViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/CheckoutAppearanceViewModel.cs @@ -26,6 +26,9 @@ namespace BTCPayServer.Models.StoreViewModels [Display(Name = "Unify on-chain and lightning payment URL/QR code")] public bool OnChainWithLnInvoiceFallback { get; set; } + [Display(Name = "Display Lightning payment amounts in Satoshis")] + public bool LightningAmountInSatoshi { get; set; } + [Display(Name = "Default payment method on checkout")] public string DefaultPaymentMethod { get; set; } diff --git a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs index 431cc983a..abf00fda9 100644 --- a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs @@ -10,6 +10,7 @@ using BTCPayServer.Models; using BTCPayServer.Models.InvoicingModels; using BTCPayServer.Services; using BTCPayServer.Services.Invoices; +using BTCPayServer.Services.Rates; using NBitcoin; using NBitcoin.DataEncoders; using NBXplorer.Models; @@ -23,12 +24,14 @@ namespace BTCPayServer.Payments.Bitcoin private readonly BTCPayNetworkProvider _networkProvider; private readonly IFeeProviderFactory _FeeRateProviderFactory; private readonly NBXplorerDashboard _dashboard; + private readonly CurrencyNameTable _currencyNameTable; private readonly Services.Wallets.BTCPayWalletProvider _WalletProvider; private readonly Dictionary _bech32Prefix; public BitcoinLikePaymentHandler(ExplorerClientProvider provider, BTCPayNetworkProvider networkProvider, IFeeProviderFactory feeRateProviderFactory, + CurrencyNameTable currencyNameTable, NBXplorerDashboard dashboard, Services.Wallets.BTCPayWalletProvider walletProvider) { @@ -37,6 +40,7 @@ namespace BTCPayServer.Payments.Bitcoin _FeeRateProviderFactory = feeRateProviderFactory; _dashboard = dashboard; _WalletProvider = walletProvider; + _currencyNameTable = currencyNameTable; _bech32Prefix = networkProvider.GetAll().OfType() .Where(network => network.NBitcoinNetwork?.Consensus?.SupportSegwit is true).ToDictionary(network => network.CryptoCode, @@ -63,8 +67,10 @@ namespace BTCPayServer.Payments.Bitcoin model.FeeRate = paymentMethodDetails.GetFeeRate(); model.PaymentMethodName = GetPaymentMethodName(network); + var bip21Case = network.SupportLightning && storeBlob.OnChainWithLnInvoiceFallback; + var amountInSats = bip21Case && storeBlob.LightningAmountInSatoshi && model.CryptoCode == "BTC"; string lightningFallback = null; - if (model.Activated && network.SupportLightning && storeBlob.OnChainWithLnInvoiceFallback) + if (model.Activated && bip21Case) { var lightningInfo = invoiceResponse.CryptoInfo.FirstOrDefault(a => a.GetpaymentMethodId() == new PaymentMethodId(model.CryptoCode, PaymentTypes.LightningLike)); @@ -135,6 +141,11 @@ namespace BTCPayServer.Payments.Bitcoin { model.InvoiceBitcoinUrl = model.InvoiceBitcoinUrlQR = string.Empty; } + + if (model.Activated && amountInSats) + { + base.PreparePaymentModelForAmountInSats(model, paymentMethod, _currencyNameTable); + } } public override string GetCryptoImage(PaymentMethodId paymentMethodId) diff --git a/BTCPayServer/Payments/IPaymentMethodHandler.cs b/BTCPayServer/Payments/IPaymentMethodHandler.cs index 52c6c5f75..13304880c 100644 --- a/BTCPayServer/Payments/IPaymentMethodHandler.cs +++ b/BTCPayServer/Payments/IPaymentMethodHandler.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Logging; @@ -98,6 +99,20 @@ namespace BTCPayServer.Payments { return null; } + + public virtual void PreparePaymentModelForAmountInSats(PaymentModel model, IPaymentMethod paymentMethod, CurrencyNameTable currencyNameTable) + { + var satoshiCulture = new CultureInfo(CultureInfo.InvariantCulture.Name) + { + NumberFormat = { NumberGroupSeparator = " " } + }; + model.CryptoCode = "sats"; + model.BtcDue = Money.Parse(model.BtcDue).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture); + model.BtcPaid = Money.Parse(model.BtcPaid).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture); + model.OrderAmount = Money.Parse(model.OrderAmount).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture); + model.NetworkFee = new Money(model.NetworkFee, MoneyUnit.BTC).ToUnit(MoneyUnit.Satoshi); + model.Rate = currencyNameTable.DisplayFormatCurrency(paymentMethod.Rate / 100_000_000, model.InvoiceCurrency); + } public Task CreatePaymentMethodDetails(InvoiceLogs logs, ISupportedPaymentMethod supportedPaymentMethod, PaymentMethod paymentMethod, diff --git a/BTCPayServer/Payments/LNURLPay/LNURLPayPaymentHandler.cs b/BTCPayServer/Payments/LNURLPay/LNURLPayPaymentHandler.cs index abbfe1e07..89592a278 100644 --- a/BTCPayServer/Payments/LNURLPay/LNURLPayPaymentHandler.cs +++ b/BTCPayServer/Payments/LNURLPay/LNURLPayPaymentHandler.cs @@ -1,23 +1,17 @@ #nullable enable -using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; -using System.Threading; using System.Threading.Tasks; using BTCPayServer.Client.Models; using BTCPayServer.Configuration; using BTCPayServer.Data; -using BTCPayServer.HostedServices; using BTCPayServer.Lightning; using BTCPayServer.Logging; using BTCPayServer.Models; using BTCPayServer.Models.InvoicingModels; -using BTCPayServer.Services; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Rates; using Microsoft.Extensions.Options; -using NBitcoin; namespace BTCPayServer.Payments.Lightning { @@ -112,23 +106,16 @@ namespace BTCPayServer.Payments.Lightning var network = _networkProvider.GetNetwork(model.CryptoCode); var cryptoInfo = invoiceResponse.CryptoInfo.First(o => o.GetpaymentMethodId() == paymentMethodId); var lnurl = cryptoInfo.PaymentUrls?.AdditionalData["LNURLP"].ToObject(); + model.PaymentMethodName = GetPaymentMethodName(network); model.BtcAddress = lnurl?.Replace(UriScheme, ""); model.InvoiceBitcoinUrl = lnurl; model.InvoiceBitcoinUrlQR = lnurl?.ToUpperInvariant().Replace(UriScheme.ToUpperInvariant(), UriScheme); model.PeerInfo = ((LNURLPayPaymentMethodDetails)paymentMethod.GetPaymentMethodDetails()).NodeInfo; + if (storeBlob.LightningAmountInSatoshi && model.CryptoCode == "BTC") { - var satoshiCulture = new CultureInfo(CultureInfo.InvariantCulture.Name); - satoshiCulture.NumberFormat.NumberGroupSeparator = " "; - model.CryptoCode = "Sats"; - model.BtcDue = Money.Parse(model.BtcDue).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture); - model.BtcPaid = Money.Parse(model.BtcPaid).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture); - model.OrderAmount = Money.Parse(model.OrderAmount).ToUnit(MoneyUnit.Satoshi) - .ToString("N0", satoshiCulture); - model.NetworkFee = new Money(model.NetworkFee, MoneyUnit.BTC).ToUnit(MoneyUnit.Satoshi); - model.Rate = - _currencyNameTable.DisplayFormatCurrency(paymentMethod.Rate / 100_000_000, model.InvoiceCurrency); + base.PreparePaymentModelForAmountInSats(model, paymentMethod, _currencyNameTable); } } diff --git a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs index 62c0cf8e8..9c0c13b71 100644 --- a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs @@ -1,7 +1,6 @@ #nullable enable using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -212,24 +211,17 @@ namespace BTCPayServer.Payments.Lightning StoreBlob storeBlob, IPaymentMethod paymentMethod) { var paymentMethodId = paymentMethod.GetId(); - var cryptoInfo = invoiceResponse.CryptoInfo.First(o => o.GetpaymentMethodId() == paymentMethodId); var network = _networkProvider.GetNetwork(model.CryptoCode); + model.PaymentMethodName = GetPaymentMethodName(network); model.InvoiceBitcoinUrl = cryptoInfo.PaymentUrls?.BOLT11; model.InvoiceBitcoinUrlQR = $"lightning:{cryptoInfo.PaymentUrls?.BOLT11?.ToUpperInvariant()?.Substring("LIGHTNING:".Length)}"; - model.PeerInfo = ((LightningLikePaymentMethodDetails)paymentMethod.GetPaymentMethodDetails()).NodeInfo; + if (storeBlob.LightningAmountInSatoshi && model.CryptoCode == "BTC") { - var satoshiCulture = new CultureInfo(CultureInfo.InvariantCulture.Name); - satoshiCulture.NumberFormat.NumberGroupSeparator = " "; - model.CryptoCode = "Sats"; - model.BtcDue = Money.Parse(model.BtcDue).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture); - model.BtcPaid = Money.Parse(model.BtcPaid).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture); - model.OrderAmount = Money.Parse(model.OrderAmount).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture); - model.NetworkFee = new Money(model.NetworkFee, MoneyUnit.BTC).ToUnit(MoneyUnit.Satoshi); - model.Rate = _currencyNameTable.DisplayFormatCurrency(paymentMethod.Rate / 100_000_000, model.InvoiceCurrency); + base.PreparePaymentModelForAmountInSats(model, paymentMethod, _currencyNameTable); } } public override string GetCryptoImage(PaymentMethodId paymentMethodId) diff --git a/BTCPayServer/Views/UIInvoice/Checkout-Body.cshtml b/BTCPayServer/Views/UIInvoice/Checkout-Body.cshtml index 412bb5a54..06e1ff10f 100644 --- a/BTCPayServer/Views/UIInvoice/Checkout-Body.cshtml +++ b/BTCPayServer/Views/UIInvoice/Checkout-Body.cshtml @@ -50,7 +50,7 @@
- {{srvModel.paymentMethodName}} ({{srvModel.cryptoCodeSrv}}) + {{srvModel.paymentMethodName}} ({{srvModel.cryptoCode}}) @@ -75,7 +75,7 @@ {
- {{srvModel.paymentMethodName}} ({{srvModel.cryptoCodeSrv}}) + {{srvModel.paymentMethodName}} ({{srvModel.cryptoCode}})
} @@ -102,8 +102,8 @@ {{ srvModel.btcDue }} {{ srvModel.cryptoCode }}
- 1 Sat = {{ srvModel.rate }} - 1 {{ srvModel.cryptoCodeSrv }} = {{ srvModel.rate }} + 1 sat = {{ srvModel.rate }} + 1 {{ srvModel.cryptoCode }} = {{ srvModel.rate }}
diff --git a/BTCPayServer/Views/UIInvoice/Checkout.cshtml b/BTCPayServer/Views/UIInvoice/Checkout.cshtml index ffa68d3ef..7716a59f4 100644 --- a/BTCPayServer/Views/UIInvoice/Checkout.cshtml +++ b/BTCPayServer/Views/UIInvoice/Checkout.cshtml @@ -358,8 +358,6 @@ if (jsonData.paymentMethodId === this.srvModel.paymentMethodId) { this.changingCurrencies = false; } - // displaying satoshis for lightning payments - jsonData.cryptoCodeSrv = jsonData.cryptoCode; // expand line items to show details on amount due for multi-transaction payment if (this.srvModel.txCount === 1 && jsonData.txCount > 1) { this.onlyExpandLineItems(); diff --git a/BTCPayServer/Views/UIInvoice/CheckoutV2.cshtml b/BTCPayServer/Views/UIInvoice/CheckoutV2.cshtml index 2300b1474..907b00482 100644 --- a/BTCPayServer/Views/UIInvoice/CheckoutV2.cshtml +++ b/BTCPayServer/Views/UIInvoice/CheckoutV2.cshtml @@ -193,8 +193,8 @@
- - + +
diff --git a/BTCPayServer/Views/UIStores/CheckoutAppearance.cshtml b/BTCPayServer/Views/UIStores/CheckoutAppearance.cshtml index 12586c612..68a98084c 100644 --- a/BTCPayServer/Views/UIStores/CheckoutAppearance.cshtml +++ b/BTCPayServer/Views/UIStores/CheckoutAppearance.cshtml @@ -94,6 +94,10 @@
+
+ + +
diff --git a/BTCPayServer/wwwroot/checkout-v2/checkout.js b/BTCPayServer/wwwroot/checkout-v2/checkout.js index 16dfe4d93..341a6bce4 100644 --- a/BTCPayServer/wwwroot/checkout-v2/checkout.js +++ b/BTCPayServer/wwwroot/checkout-v2/checkout.js @@ -260,10 +260,7 @@ function initApp() { const { status } = data; window.parent.postMessage({ invoiceId, status }, '*'); } - - // displaying satoshis for lightning payments - data.cryptoCodeSrv = data.cryptoCode; - + const newEnd = new Date(); newEnd.setSeconds(newEnd.getSeconds() + data.expirationSeconds); this.endDate = newEnd;