diff --git a/BTCPayServer.Tests/CheckoutUITests.cs b/BTCPayServer.Tests/CheckoutUITests.cs index 294d1eae6..0d50b8355 100644 --- a/BTCPayServer.Tests/CheckoutUITests.cs +++ b/BTCPayServer.Tests/CheckoutUITests.cs @@ -164,7 +164,7 @@ namespace BTCPayServer.Tests var invoiceId = s.CreateInvoice(defaultPaymentMethod: "BTC_LightningLike"); s.GoToInvoiceCheckout(invoiceId); - Assert.Equal("Bitcoin (Lightning) (BTC)", s.Driver.FindElement(By.ClassName("payment__currencies")).Text); + Assert.Equal("Bitcoin (Lightning)", s.Driver.FindElement(By.ClassName("payment__currencies")).Text); s.Driver.Quit(); } @@ -187,7 +187,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("buyerTotalLine")).Text); } [Fact(Timeout = TestTimeout)] diff --git a/BTCPayServer/Controllers/UIInvoiceController.UI.cs b/BTCPayServer/Controllers/UIInvoiceController.UI.cs index ad9b607f4..01fc7b3f8 100644 --- a/BTCPayServer/Controllers/UIInvoiceController.UI.cs +++ b/BTCPayServer/Controllers/UIInvoiceController.UI.cs @@ -671,7 +671,7 @@ namespace BTCPayServer.Controllers var displayedPaymentMethods = invoice.GetPaymentMethods().Select(p => p.GetId()).ToList(); // Exclude Lightning if OnChainWithLnInvoiceFallback is active and we have both payment methods - if (storeBlob is { CheckoutType: CheckoutType.V2, OnChainWithLnInvoiceFallback: true } && + if (storeBlob is { OnChainWithLnInvoiceFallback: true } && displayedPaymentMethods.Contains(btcId)) { displayedPaymentMethods.Remove(lnId); @@ -787,11 +787,13 @@ namespace BTCPayServer.Controllers Request.Host, Request.PathBase) : null; + var isAltcoinsBuild = false; +#if ALTCOINS + isAltcoinsBuild = true, +#endif + var model = new PaymentModel { -#if ALTCOINS - AltcoinsBuild = true, -#endif Activated = paymentMethodDetails.Activated, CryptoCode = network.CryptoCode, RootPath = Request.PathBase.Value.WithTrailingSlash(), @@ -856,12 +858,15 @@ namespace BTCPayServer.Controllers { var availableCryptoPaymentMethodId = kv.GetId(); var availableCryptoHandler = _paymentMethodHandlerDictionary[availableCryptoPaymentMethodId]; + var pmName = availableCryptoHandler.GetPaymentMethodName(availableCryptoPaymentMethodId); return new PaymentModel.AvailableCrypto { Displayed = displayedPaymentMethods.Contains(kv.GetId()), PaymentMethodId = kv.GetId().ToString(), CryptoCode = kv.Network?.CryptoCode ?? kv.GetId().CryptoCode, - PaymentMethodName = availableCryptoHandler.GetPaymentMethodName(availableCryptoPaymentMethodId), + PaymentMethodName = isAltcoinsBuild + ? pmName + : pmName.Replace("Bitcoin (", "").Replace(")", "").Replace("Lightning ", ""), IsLightning = kv.GetId().PaymentType == PaymentTypes.LightningLike, CryptoImage = Request.GetRelativePathOrAbsolute(availableCryptoHandler.GetCryptoImage(availableCryptoPaymentMethodId)), diff --git a/BTCPayServer/Models/InvoicingModels/PaymentModel.cs b/BTCPayServer/Models/InvoicingModels/PaymentModel.cs index 3d1a62188..7afd6abf6 100644 --- a/BTCPayServer/Models/InvoicingModels/PaymentModel.cs +++ b/BTCPayServer/Models/InvoicingModels/PaymentModel.cs @@ -78,7 +78,6 @@ namespace BTCPayServer.Models.InvoicingModels public bool Activated { get; set; } public string InvoiceCurrency { get; set; } public string ReceiptLink { get; set; } - public bool AltcoinsBuild { get; set; } public CheckoutType CheckoutType { get; set; } public int? RequiredConfirmations { get; set; } public long? ReceivedConfirmations { get; set; } diff --git a/BTCPayServer/Views/UIInvoice/Checkout-Body.cshtml b/BTCPayServer/Views/UIInvoice/Checkout-Body.cshtml index bb0f7b842..670206c38 100644 --- a/BTCPayServer/Views/UIInvoice/Checkout-Body.cshtml +++ b/BTCPayServer/Views/UIInvoice/Checkout-Body.cshtml @@ -52,8 +52,7 @@
- {{srvModel.paymentMethodName}} ({{srvModel.cryptoCode}}) - + {{srvModel.paymentMethodName}}
@@ -65,8 +64,6 @@ @crypto.PaymentMethodName @crypto.PaymentMethodName - @(crypto.IsLightning ? Html.Raw("⚡") : null) - @crypto.CryptoCode } @@ -77,7 +74,7 @@ {
- {{srvModel.paymentMethodName}} ({{srvModel.cryptoCode}}) + {{srvModel.paymentMethodName}}
} diff --git a/BTCPayServer/Views/UIInvoice/CheckoutV2.cshtml b/BTCPayServer/Views/UIInvoice/CheckoutV2.cshtml index 82319490a..1b5e386c5 100644 --- a/BTCPayServer/Views/UIInvoice/CheckoutV2.cshtml +++ b/BTCPayServer/Views/UIInvoice/CheckoutV2.cshtml @@ -15,13 +15,6 @@ var displayedPaymentMethods = Model.AvailableCryptos.Where(c => c.Displayed).ToList(); } @functions { - private string PaymentMethodName(PaymentModel.AvailableCrypto pm) - { - return Model.AltcoinsBuild - ? pm.PaymentMethodName - : pm.PaymentMethodName.Replace("Bitcoin (", "").Replace(")", "").Replace("Lightning ", ""); - } - private string ToJsValue(object value) { return Safe.Json(value).ToString()?.Replace("\"", "'"); @@ -96,7 +89,7 @@ class="btcpay-pill m-0 payment-method" :class="{ active: pmId === @ToJsValue(crypto.PaymentMethodId) }" v-on:click.prevent="changePaymentMethod(@ToJsValue(crypto.PaymentMethodId))"> - @PaymentMethodName(crypto) + @crypto.PaymentMethodName } @await Component.InvokeAsync("UiExtensionPoint", new { location = "checkout-payment-method", model = Model })