From a729dd1380ad30444cf975738818c2a8d3e7f1f5 Mon Sep 17 00:00:00 2001 From: Kukks Date: Fri, 6 Nov 2020 08:41:03 +0100 Subject: [PATCH] Separate views of Bitcoin and LN --- BTCPayServer/BTCPayServer.csproj | 4 - .../Payments/IPaymentMethodHandler.cs | 8 +- .../Lightning/LightningLikePaymentHandler.cs | 11 ++ BTCPayServer/Payments/PaymentTypes.Bitcoin.cs | 2 +- .../Payments/PaymentTypes.Lightning.cs | 2 +- .../EthereumLikePaymentMethodHandler.cs | 2 +- .../Services/NBXSyncSummaryProvider.cs | 2 +- .../BitcoinLikeMethodCheckout.cshtml} | 68 +------ .../BitcoinLikeMethodCheckoutNoScript.cshtml} | 4 - .../{ => Bitcoin}/NBXSyncSummary.cshtml | 0 .../ViewBitcoinLikePaymentData.cshtml | 0 .../LightningLikeMethodCheckout.cshtml | 174 ++++++++++++++++++ ...LightningLikeMethodCheckoutNoScript.cshtml | 9 + .../ViewLightningLikePaymentData.cshtml | 0 14 files changed, 210 insertions(+), 76 deletions(-) rename BTCPayServer/Views/Shared/{Bitcoin_Lightning_LikeMethodCheckout.cshtml => Bitcoin/BitcoinLikeMethodCheckout.cshtml} (76%) rename BTCPayServer/Views/Shared/{Bitcoin_Lightning_LikeMethodCheckoutNoScript.cshtml => Bitcoin/BitcoinLikeMethodCheckoutNoScript.cshtml} (79%) rename BTCPayServer/Views/Shared/{ => Bitcoin}/NBXSyncSummary.cshtml (100%) rename BTCPayServer/Views/Shared/{ => Bitcoin}/ViewBitcoinLikePaymentData.cshtml (100%) create mode 100644 BTCPayServer/Views/Shared/Lightning/LightningLikeMethodCheckout.cshtml create mode 100644 BTCPayServer/Views/Shared/Lightning/LightningLikeMethodCheckoutNoScript.cshtml rename BTCPayServer/Views/Shared/{ => Lightning}/ViewLightningLikePaymentData.cshtml (100%) diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index fc1a654ac..692df20b9 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -21,10 +21,6 @@ - - true - PreserveNewest - diff --git a/BTCPayServer/Payments/IPaymentMethodHandler.cs b/BTCPayServer/Payments/IPaymentMethodHandler.cs index acf5a4d1a..adb639591 100644 --- a/BTCPayServer/Payments/IPaymentMethodHandler.cs +++ b/BTCPayServer/Payments/IPaymentMethodHandler.cs @@ -76,10 +76,10 @@ namespace BTCPayServer.Payments { return new CheckoutUIPaymentMethodSettings() { - ExtensionPartial = "Bitcoin_Lightning_LikeMethodCheckout", - CheckoutBodyVueComponentName = "BitcoinLightningLikeMethodCheckout", - CheckoutHeaderVueComponentName = "BitcoinLightningLikeMethodCheckoutHeader", - NoScriptPartialName = "Bitcoin_Lightning_LikeMethodCheckoutNoScript" + ExtensionPartial = "Bitcoin/BitcoinLikeMethodCheckout", + CheckoutBodyVueComponentName = "BitcoinLikeMethodCheckout", + CheckoutHeaderVueComponentName = "BitcoinLikeMethodCheckoutHeader", + NoScriptPartialName = "Bitcoin/BitcoinLikeMethodCheckoutNoScript" }; } diff --git a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs index b1a7cacec..5490aba5f 100644 --- a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs @@ -199,6 +199,17 @@ namespace BTCPayServer.Payments.Lightning return GetPaymentMethodName(network); } + public override CheckoutUIPaymentMethodSettings GetCheckoutUISettings() + { + return new CheckoutUIPaymentMethodSettings() + { + ExtensionPartial = "Lightning/LightningLikeMethodCheckout", + CheckoutBodyVueComponentName = "LightningLikeMethodCheckout", + CheckoutHeaderVueComponentName = "LightningLikeMethodCheckoutHeader", + NoScriptPartialName = "Lightning/LightningLikeMethodCheckoutNoScript" + }; + } + private string GetPaymentMethodName(BTCPayNetworkBase network) { return $"{network.DisplayName} (Lightning)"; diff --git a/BTCPayServer/Payments/PaymentTypes.Bitcoin.cs b/BTCPayServer/Payments/PaymentTypes.Bitcoin.cs index 0f2580e21..0c509540c 100644 --- a/BTCPayServer/Payments/PaymentTypes.Bitcoin.cs +++ b/BTCPayServer/Payments/PaymentTypes.Bitcoin.cs @@ -81,6 +81,6 @@ namespace BTCPayServer.Payments return bip21; } - public override string InvoiceViewPaymentPartialName { get; } = "ViewBitcoinLikePaymentData"; + public override string InvoiceViewPaymentPartialName { get; } = "Bitcoin/ViewBitcoinLikePaymentData"; } } diff --git a/BTCPayServer/Payments/PaymentTypes.Lightning.cs b/BTCPayServer/Payments/PaymentTypes.Lightning.cs index d69c4bb38..e63848580 100644 --- a/BTCPayServer/Payments/PaymentTypes.Lightning.cs +++ b/BTCPayServer/Payments/PaymentTypes.Lightning.cs @@ -61,6 +61,6 @@ namespace BTCPayServer.Payments $"lightning:{paymentMethodDetails.GetPaymentDestination().ToUpperInvariant().Replace("LIGHTNING:", "", StringComparison.InvariantCultureIgnoreCase)}"; } - public override string InvoiceViewPaymentPartialName { get; } = "ViewLightningLikePaymentData"; + public override string InvoiceViewPaymentPartialName { get; } = "Lightning/ViewLightningLikePaymentData"; } } diff --git a/BTCPayServer/Services/Altcoins/Ethereum/Payments/EthereumLikePaymentMethodHandler.cs b/BTCPayServer/Services/Altcoins/Ethereum/Payments/EthereumLikePaymentMethodHandler.cs index ffc6ba91b..69c8d5d08 100644 --- a/BTCPayServer/Services/Altcoins/Ethereum/Payments/EthereumLikePaymentMethodHandler.cs +++ b/BTCPayServer/Services/Altcoins/Ethereum/Payments/EthereumLikePaymentMethodHandler.cs @@ -108,7 +108,7 @@ namespace BTCPayServer.Services.Altcoins.Ethereum.Payments ExtensionPartial = "Ethereum/EthereumLikeMethodCheckout", CheckoutBodyVueComponentName = "EthereumLikeMethodCheckout", CheckoutHeaderVueComponentName = "EthereumLikeMethodCheckoutHeader", - NoScriptPartialName = "Bitcoin_Lightning_LikeMethodCheckoutNoScript" + NoScriptPartialName = "Bitcoin/BitcoinLikeMethodCheckoutNoScript" }; } diff --git a/BTCPayServer/Services/NBXSyncSummaryProvider.cs b/BTCPayServer/Services/NBXSyncSummaryProvider.cs index 32d4451af..460d03e10 100644 --- a/BTCPayServer/Services/NBXSyncSummaryProvider.cs +++ b/BTCPayServer/Services/NBXSyncSummaryProvider.cs @@ -17,6 +17,6 @@ namespace BTCPayServer.Services return _nbXplorerDashboard.IsFullySynched(); } - public string Partial { get; } = "NBXSyncSummary"; + public string Partial { get; } = "Bitcoin/NBXSyncSummary"; } } diff --git a/BTCPayServer/Views/Shared/Bitcoin_Lightning_LikeMethodCheckout.cshtml b/BTCPayServer/Views/Shared/Bitcoin/BitcoinLikeMethodCheckout.cshtml similarity index 76% rename from BTCPayServer/Views/Shared/Bitcoin_Lightning_LikeMethodCheckout.cshtml rename to BTCPayServer/Views/Shared/Bitcoin/BitcoinLikeMethodCheckout.cshtml index 5fa2c1dc5..1974104a0 100644 --- a/BTCPayServer/Views/Shared/Bitcoin_Lightning_LikeMethodCheckout.cshtml +++ b/BTCPayServer/Views/Shared/Bitcoin/BitcoinLikeMethodCheckout.cshtml @@ -1,25 +1,9 @@ @using BTCPayServer.Services @model BTCPayServer.Models.InvoicingModels.PaymentModel - - + + + + diff --git a/BTCPayServer/Views/Shared/Lightning/LightningLikeMethodCheckoutNoScript.cshtml b/BTCPayServer/Views/Shared/Lightning/LightningLikeMethodCheckoutNoScript.cshtml new file mode 100644 index 000000000..1492adf31 --- /dev/null +++ b/BTCPayServer/Views/Shared/Lightning/LightningLikeMethodCheckoutNoScript.cshtml @@ -0,0 +1,9 @@ +@model PaymentModel +
+

To complete payment, please send @Model.BtcDue @Model.CryptoCode to @Model.BtcAddress

+

Time remaining: @Model.TimeLeft

+

+ @Model.InvoiceBitcoinUrl +

+

Peer Info: @Model.PeerInfo

+
diff --git a/BTCPayServer/Views/Shared/ViewLightningLikePaymentData.cshtml b/BTCPayServer/Views/Shared/Lightning/ViewLightningLikePaymentData.cshtml similarity index 100% rename from BTCPayServer/Views/Shared/ViewLightningLikePaymentData.cshtml rename to BTCPayServer/Views/Shared/Lightning/ViewLightningLikePaymentData.cshtml