mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 06:21:44 +01:00
Cleanup v2 leftovers
This commit is contained in:
parent
4208110d57
commit
d2e9ec9494
23 changed files with 44 additions and 83 deletions
|
@ -32,7 +32,7 @@
|
||||||
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.15" />
|
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.15" />
|
||||||
<PackageReference Include="Selenium.Support" Version="4.1.1" />
|
<PackageReference Include="Selenium.Support" Version="4.1.1" />
|
||||||
<PackageReference Include="Selenium.WebDriver" Version="4.1.1" />
|
<PackageReference Include="Selenium.WebDriver" Version="4.1.1" />
|
||||||
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="121.0.6167.8500" />
|
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="123.0.6312.8600" />
|
||||||
<PackageReference Include="xunit" Version="2.6.6" />
|
<PackageReference Include="xunit" Version="2.6.6" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
|
|
@ -53,9 +53,6 @@ namespace BTCPayServer.Tests
|
||||||
// Top up/zero amount invoices
|
// Top up/zero amount invoices
|
||||||
var invoiceId = s.CreateInvoice(amount: null);
|
var invoiceId = s.CreateInvoice(amount: null);
|
||||||
s.GoToInvoiceCheckout(invoiceId);
|
s.GoToInvoiceCheckout(invoiceId);
|
||||||
|
|
||||||
// Ensure we are seeing Checkout v2
|
|
||||||
s.Driver.WaitUntilAvailable(By.Id("Checkout-v2"));
|
|
||||||
Assert.Equal(2, s.Driver.FindElements(By.CssSelector(".payment-method")).Count);
|
Assert.Equal(2, s.Driver.FindElements(By.CssSelector(".payment-method")).Count);
|
||||||
Assert.Contains("Bitcoin", s.Driver.FindElement(By.CssSelector(".payment-method.active")).Text);
|
Assert.Contains("Bitcoin", s.Driver.FindElement(By.CssSelector(".payment-method.active")).Text);
|
||||||
Assert.Contains("LNURL", s.Driver.FindElement(By.CssSelector(".payment-method:nth-child(2)")).Text);
|
Assert.Contains("LNURL", s.Driver.FindElement(By.CssSelector(".payment-method:nth-child(2)")).Text);
|
||||||
|
@ -92,7 +89,6 @@ namespace BTCPayServer.Tests
|
||||||
s.GoToHome();
|
s.GoToHome();
|
||||||
invoiceId = s.CreateInvoice(21000, "SATS", defaultPaymentMethod: "BTC-LN");
|
invoiceId = s.CreateInvoice(21000, "SATS", defaultPaymentMethod: "BTC-LN");
|
||||||
s.GoToInvoiceCheckout(invoiceId);
|
s.GoToInvoiceCheckout(invoiceId);
|
||||||
s.Driver.WaitUntilAvailable(By.Id("Checkout-v2"));
|
|
||||||
Assert.Equal(2, s.Driver.FindElements(By.CssSelector(".payment-method")).Count);
|
Assert.Equal(2, s.Driver.FindElements(By.CssSelector(".payment-method")).Count);
|
||||||
Assert.Contains("Lightning", s.Driver.WaitForElement(By.CssSelector(".payment-method.active")).Text);
|
Assert.Contains("Lightning", s.Driver.WaitForElement(By.CssSelector(".payment-method.active")).Text);
|
||||||
Assert.Contains("Bitcoin", s.Driver.WaitForElement(By.CssSelector(".payment-method")).Text);
|
Assert.Contains("Bitcoin", s.Driver.WaitForElement(By.CssSelector(".payment-method")).Text);
|
||||||
|
@ -113,7 +109,6 @@ namespace BTCPayServer.Tests
|
||||||
s.Driver.FindElement(By.Id("save")).Click();
|
s.Driver.FindElement(By.Id("save")).Click();
|
||||||
Assert.Contains("BTC Lightning settings successfully updated", s.FindAlertMessage().Text);
|
Assert.Contains("BTC Lightning settings successfully updated", s.FindAlertMessage().Text);
|
||||||
s.GoToInvoiceCheckout(invoiceId);
|
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);
|
||||||
|
|
||||||
// Details should not show exchange rate
|
// Details should not show exchange rate
|
||||||
|
@ -152,8 +147,6 @@ namespace BTCPayServer.Tests
|
||||||
s.GoToHome();
|
s.GoToHome();
|
||||||
invoiceId = s.CreateInvoice(2100, "EUR");
|
invoiceId = s.CreateInvoice(2100, "EUR");
|
||||||
s.GoToInvoiceCheckout(invoiceId);
|
s.GoToInvoiceCheckout(invoiceId);
|
||||||
s.Driver.WaitUntilAvailable(By.Id("Checkout-v2"));
|
|
||||||
|
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
address = s.Driver.FindElement(By.CssSelector("#Address_BTC-CHAIN .truncate-center-start")).Text;
|
address = s.Driver.FindElement(By.CssSelector("#Address_BTC-CHAIN .truncate-center-start")).Text;
|
||||||
var amountFraction = "0.00001";
|
var amountFraction = "0.00001";
|
||||||
|
@ -190,7 +183,6 @@ namespace BTCPayServer.Tests
|
||||||
s.GoToHome();
|
s.GoToHome();
|
||||||
invoiceId = s.CreateInvoice();
|
invoiceId = s.CreateInvoice();
|
||||||
s.GoToInvoiceCheckout(invoiceId);
|
s.GoToInvoiceCheckout(invoiceId);
|
||||||
s.Driver.WaitUntilAvailable(By.Id("Checkout-v2"));
|
|
||||||
|
|
||||||
// Details
|
// Details
|
||||||
s.Driver.ToggleCollapse("PaymentDetails");
|
s.Driver.ToggleCollapse("PaymentDetails");
|
||||||
|
@ -265,7 +257,6 @@ namespace BTCPayServer.Tests
|
||||||
|
|
||||||
invoiceId = s.CreateInvoice();
|
invoiceId = s.CreateInvoice();
|
||||||
s.GoToInvoiceCheckout(invoiceId);
|
s.GoToInvoiceCheckout(invoiceId);
|
||||||
s.Driver.WaitUntilAvailable(By.Id("Checkout-v2"));
|
|
||||||
Assert.Empty(s.Driver.FindElements(By.CssSelector(".payment-method")));
|
Assert.Empty(s.Driver.FindElements(By.CssSelector(".payment-method")));
|
||||||
Assert.Contains("BTC", s.Driver.FindElement(By.Id("AmountDue")).Text);
|
Assert.Contains("BTC", s.Driver.FindElement(By.Id("AmountDue")).Text);
|
||||||
qrValue = s.Driver.FindElement(By.CssSelector(".qr-container")).GetAttribute("data-qr-value");
|
qrValue = s.Driver.FindElement(By.CssSelector(".qr-container")).GetAttribute("data-qr-value");
|
||||||
|
@ -298,7 +289,6 @@ namespace BTCPayServer.Tests
|
||||||
s.Driver.FindElement(By.Id("Save")).Click();
|
s.Driver.FindElement(By.Id("Save")).Click();
|
||||||
Assert.Contains("Store successfully updated", s.FindAlertMessage().Text);
|
Assert.Contains("Store successfully updated", s.FindAlertMessage().Text);
|
||||||
s.GoToInvoiceCheckout(invoiceId);
|
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);
|
||||||
|
|
||||||
// Check details
|
// Check details
|
||||||
|
@ -313,7 +303,6 @@ namespace BTCPayServer.Tests
|
||||||
s.GoToHome();
|
s.GoToHome();
|
||||||
invoiceId = s.CreateInvoice(defaultPaymentMethod: "BTC-LN");
|
invoiceId = s.CreateInvoice(defaultPaymentMethod: "BTC-LN");
|
||||||
s.GoToInvoiceCheckout(invoiceId);
|
s.GoToInvoiceCheckout(invoiceId);
|
||||||
s.Driver.WaitUntilAvailable(By.Id("Checkout-v2"));
|
|
||||||
Assert.Empty(s.Driver.FindElements(By.CssSelector(".payment-method")));
|
Assert.Empty(s.Driver.FindElements(By.CssSelector(".payment-method")));
|
||||||
payUrl = s.Driver.FindElement(By.Id("PayInWallet")).GetAttribute("href");
|
payUrl = s.Driver.FindElement(By.Id("PayInWallet")).GetAttribute("href");
|
||||||
Assert.StartsWith("bitcoin:", payUrl);
|
Assert.StartsWith("bitcoin:", payUrl);
|
||||||
|
@ -335,7 +324,6 @@ namespace BTCPayServer.Tests
|
||||||
// BIP21 with top-up invoice
|
// BIP21 with top-up invoice
|
||||||
invoiceId = s.CreateInvoice(amount: null);
|
invoiceId = s.CreateInvoice(amount: null);
|
||||||
s.GoToInvoiceCheckout(invoiceId);
|
s.GoToInvoiceCheckout(invoiceId);
|
||||||
s.Driver.WaitUntilAvailable(By.Id("Checkout-v2"));
|
|
||||||
Assert.Empty(s.Driver.FindElements(By.CssSelector(".payment-method")));
|
Assert.Empty(s.Driver.FindElements(By.CssSelector(".payment-method")));
|
||||||
qrValue = s.Driver.FindElement(By.CssSelector(".qr-container")).GetAttribute("data-qr-value");
|
qrValue = s.Driver.FindElement(By.CssSelector(".qr-container")).GetAttribute("data-qr-value");
|
||||||
clipboard = s.Driver.FindElement(By.CssSelector(".qr-container")).GetAttribute("data-clipboard");
|
clipboard = s.Driver.FindElement(By.CssSelector(".qr-container")).GetAttribute("data-clipboard");
|
||||||
|
@ -385,7 +373,6 @@ namespace BTCPayServer.Tests
|
||||||
Assert.Contains("Store successfully updated", s.FindAlertMessage().Text);
|
Assert.Contains("Store successfully updated", s.FindAlertMessage().Text);
|
||||||
|
|
||||||
s.GoToInvoiceCheckout(invoiceId);
|
s.GoToInvoiceCheckout(invoiceId);
|
||||||
s.Driver.WaitUntilAvailable(By.Id("Checkout-v2"));
|
|
||||||
var paymentInfo = s.Driver.FindElement(By.Id("PaymentInfo"));
|
var paymentInfo = s.Driver.FindElement(By.Id("PaymentInfo"));
|
||||||
Assert.False(paymentInfo.Displayed);
|
Assert.False(paymentInfo.Displayed);
|
||||||
Assert.DoesNotContain("This invoice will expire in", paymentInfo.Text);
|
Assert.DoesNotContain("This invoice will expire in", paymentInfo.Text);
|
||||||
|
@ -416,7 +403,6 @@ namespace BTCPayServer.Tests
|
||||||
s.GoToHome();
|
s.GoToHome();
|
||||||
invoiceId = s.CreateInvoice(defaultPaymentMethod: "BTC-LN");
|
invoiceId = s.CreateInvoice(defaultPaymentMethod: "BTC-LN");
|
||||||
s.GoToInvoiceCheckout(invoiceId);
|
s.GoToInvoiceCheckout(invoiceId);
|
||||||
s.Driver.WaitUntilAvailable(By.Id("Checkout-v2"));
|
|
||||||
Assert.Empty(s.Driver.FindElements(By.CssSelector(".payment-method")));
|
Assert.Empty(s.Driver.FindElements(By.CssSelector(".payment-method")));
|
||||||
payUrl = s.Driver.FindElement(By.Id("PayInWallet")).GetAttribute("href");
|
payUrl = s.Driver.FindElement(By.Id("PayInWallet")).GetAttribute("href");
|
||||||
Assert.StartsWith("bitcoin:", payUrl);
|
Assert.StartsWith("bitcoin:", payUrl);
|
||||||
|
@ -459,7 +445,7 @@ namespace BTCPayServer.Tests
|
||||||
var frameElement = s.Driver.FindElement(By.Name("btcpay"));
|
var frameElement = s.Driver.FindElement(By.Name("btcpay"));
|
||||||
Assert.True(frameElement.Displayed);
|
Assert.True(frameElement.Displayed);
|
||||||
var iframe = s.Driver.SwitchTo().Frame(frameElement);
|
var iframe = s.Driver.SwitchTo().Frame(frameElement);
|
||||||
iframe.WaitUntilAvailable(By.Id("Checkout-v2"));
|
iframe.WaitUntilAvailable(By.Id("Checkout"));
|
||||||
|
|
||||||
await s.Server.ExplorerNode.SendToAddressAsync(BitcoinAddress.Create(invoice
|
await s.Server.ExplorerNode.SendToAddressAsync(BitcoinAddress.Create(invoice
|
||||||
.GetPaymentPrompt(PaymentTypes.CHAIN.GetPaymentMethodId("BTC"))
|
.GetPaymentPrompt(PaymentTypes.CHAIN.GetPaymentMethodId("BTC"))
|
||||||
|
|
|
@ -468,6 +468,7 @@ retry:
|
||||||
Driver.FindElement(By.Id("StoreNav-Invoices")).Click();
|
Driver.FindElement(By.Id("StoreNav-Invoices")).Click();
|
||||||
Driver.FindElement(By.Id($"invoice-checkout-{invoiceId}")).Click();
|
Driver.FindElement(By.Id($"invoice-checkout-{invoiceId}")).Click();
|
||||||
CheckForJSErrors();
|
CheckForJSErrors();
|
||||||
|
Driver.WaitUntilAvailable(By.Id("Checkout"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GoToInvoice(string id)
|
public void GoToInvoice(string id)
|
||||||
|
|
|
@ -1301,7 +1301,7 @@ namespace BTCPayServer.Tests
|
||||||
var frameElement = s.Driver.FindElement(By.Name("btcpay"));
|
var frameElement = s.Driver.FindElement(By.Name("btcpay"));
|
||||||
Assert.True(frameElement.Displayed);
|
Assert.True(frameElement.Displayed);
|
||||||
var iframe = s.Driver.SwitchTo().Frame(frameElement);
|
var iframe = s.Driver.SwitchTo().Frame(frameElement);
|
||||||
iframe.WaitUntilAvailable(By.Id("Checkout-v2"));
|
iframe.WaitUntilAvailable(By.Id("Checkout"));
|
||||||
|
|
||||||
var closeButton = iframe.FindElement(By.Id("close"));
|
var closeButton = iframe.FindElement(By.Id("close"));
|
||||||
Assert.True(closeButton.Displayed);
|
Assert.True(closeButton.Displayed);
|
||||||
|
@ -1456,7 +1456,7 @@ namespace BTCPayServer.Tests
|
||||||
var frameElement = s.Driver.FindElement(By.Name("btcpay"));
|
var frameElement = s.Driver.FindElement(By.Name("btcpay"));
|
||||||
Assert.True(frameElement.Displayed);
|
Assert.True(frameElement.Displayed);
|
||||||
var iframe = s.Driver.SwitchTo().Frame(frameElement);
|
var iframe = s.Driver.SwitchTo().Frame(frameElement);
|
||||||
iframe.WaitUntilAvailable(By.Id("Checkout-v2"));
|
iframe.WaitUntilAvailable(By.Id("Checkout"));
|
||||||
|
|
||||||
IWebElement closebutton = null;
|
IWebElement closebutton = null;
|
||||||
TestUtils.Eventually(() =>
|
TestUtils.Eventually(() =>
|
||||||
|
@ -1498,7 +1498,7 @@ namespace BTCPayServer.Tests
|
||||||
var frameElement = s.Driver.FindElement(By.Name("btcpay"));
|
var frameElement = s.Driver.FindElement(By.Name("btcpay"));
|
||||||
Assert.True(frameElement.Displayed);
|
Assert.True(frameElement.Displayed);
|
||||||
var iframe = s.Driver.SwitchTo().Frame(frameElement);
|
var iframe = s.Driver.SwitchTo().Frame(frameElement);
|
||||||
iframe.WaitUntilAvailable(By.Id("Checkout-v2"));
|
iframe.WaitUntilAvailable(By.Id("Checkout"));
|
||||||
|
|
||||||
// Pay full amount
|
// Pay full amount
|
||||||
s.PayInvoice();
|
s.PayInvoice();
|
||||||
|
@ -2607,7 +2607,7 @@ namespace BTCPayServer.Tests
|
||||||
|
|
||||||
// Pay
|
// Pay
|
||||||
s.Driver.FindElement(By.Id("pay-button")).Click();
|
s.Driver.FindElement(By.Id("pay-button")).Click();
|
||||||
s.Driver.WaitUntilAvailable(By.Id("Checkout-v2"));
|
s.Driver.WaitUntilAvailable(By.Id("Checkout"));
|
||||||
s.Driver.FindElement(By.Id("DetailsToggle")).Click();
|
s.Driver.FindElement(By.Id("DetailsToggle")).Click();
|
||||||
s.Driver.WaitForElement(By.Id("PaymentDetails-TotalFiat"));
|
s.Driver.WaitForElement(By.Id("PaymentDetails-TotalFiat"));
|
||||||
Assert.Contains("1 222,21 €", s.Driver.FindElement(By.Id("PaymentDetails-TotalFiat")).Text);
|
Assert.Contains("1 222,21 €", s.Driver.FindElement(By.Id("PaymentDetails-TotalFiat")).Text);
|
||||||
|
@ -2662,7 +2662,7 @@ namespace BTCPayServer.Tests
|
||||||
|
|
||||||
// Pay
|
// Pay
|
||||||
s.Driver.FindElement(By.Id("pay-button")).Click();
|
s.Driver.FindElement(By.Id("pay-button")).Click();
|
||||||
s.Driver.WaitUntilAvailable(By.Id("Checkout-v2"));
|
s.Driver.WaitUntilAvailable(By.Id("Checkout"));
|
||||||
s.Driver.FindElement(By.Id("DetailsToggle")).Click();
|
s.Driver.FindElement(By.Id("DetailsToggle")).Click();
|
||||||
s.Driver.WaitForElement(By.Id("PaymentDetails-TotalFiat"));
|
s.Driver.WaitForElement(By.Id("PaymentDetails-TotalFiat"));
|
||||||
Assert.Contains("4,23 €", s.Driver.FindElement(By.Id("PaymentDetails-TotalFiat")).Text);
|
Assert.Contains("4,23 €", s.Driver.FindElement(By.Id("PaymentDetails-TotalFiat")).Text);
|
||||||
|
@ -2822,7 +2822,7 @@ namespace BTCPayServer.Tests
|
||||||
|
|
||||||
// Check values on checkout page
|
// Check values on checkout page
|
||||||
s.Driver.FindElement(By.Id("CartSubmit")).Click();
|
s.Driver.FindElement(By.Id("CartSubmit")).Click();
|
||||||
s.Driver.WaitUntilAvailable(By.Id("Checkout-v2"));
|
s.Driver.WaitUntilAvailable(By.Id("Checkout"));
|
||||||
s.Driver.FindElement(By.Id("DetailsToggle")).Click();
|
s.Driver.FindElement(By.Id("DetailsToggle")).Click();
|
||||||
s.Driver.WaitForElement(By.Id("PaymentDetails-TotalFiat"));
|
s.Driver.WaitForElement(By.Id("PaymentDetails-TotalFiat"));
|
||||||
Assert.Contains("9,90 €", s.Driver.FindElement(By.Id("PaymentDetails-TotalFiat")).Text);
|
Assert.Contains("9,90 €", s.Driver.FindElement(By.Id("PaymentDetails-TotalFiat")).Text);
|
||||||
|
|
|
@ -522,15 +522,7 @@ retry:
|
||||||
{
|
{
|
||||||
var fullPath = Path.Combine(GetFolder(folder), $"{lang}.json");
|
var fullPath = Path.Combine(GetFolder(folder), $"{lang}.json");
|
||||||
var proj = "o:btcpayserver:p:btcpayserver";
|
var proj = "o:btcpayserver:p:btcpayserver";
|
||||||
string resource;
|
var resource = $"{proj}:r:checkout-v2";
|
||||||
if (folder == TranslationFolder.CheckoutV1)
|
|
||||||
{
|
|
||||||
resource = $"{proj}:r:enjson";
|
|
||||||
}
|
|
||||||
else // file == v2
|
|
||||||
{
|
|
||||||
resource = $"{proj}:r:checkout-v2";
|
|
||||||
}
|
|
||||||
var words = new Dictionary<string, string>();
|
var words = new Dictionary<string, string>();
|
||||||
if (File.Exists(fullPath))
|
if (File.Exists(fullPath))
|
||||||
{
|
{
|
||||||
|
|
|
@ -108,9 +108,7 @@ namespace BTCPayServer.Controllers
|
||||||
public IActionResult GetTranslations(string resource, string lang)
|
public IActionResult GetTranslations(string resource, string lang)
|
||||||
{
|
{
|
||||||
string path;
|
string path;
|
||||||
if (resource == "checkout-v1")
|
if (resource.StartsWith("checkout"))
|
||||||
path = "locales";
|
|
||||||
else if (resource == "checkout-v2")
|
|
||||||
path = "locales/checkout";
|
path = "locales/checkout";
|
||||||
else
|
else
|
||||||
return NotFound();
|
return NotFound();
|
||||||
|
|
|
@ -686,7 +686,8 @@ namespace BTCPayServer.Controllers
|
||||||
|
|
||||||
if (view == "modal")
|
if (view == "modal")
|
||||||
model.IsModal = true;
|
model.IsModal = true;
|
||||||
return View("CheckoutV2", model);
|
|
||||||
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("invoice-noscript")]
|
[HttpGet("invoice-noscript")]
|
||||||
|
@ -963,10 +964,10 @@ namespace BTCPayServer.Controllers
|
||||||
if (storeBlob.PlaySoundOnPayment)
|
if (storeBlob.PlaySoundOnPayment)
|
||||||
{
|
{
|
||||||
model.PaymentSoundUrl = string.IsNullOrEmpty(storeBlob.SoundFileId)
|
model.PaymentSoundUrl = string.IsNullOrEmpty(storeBlob.SoundFileId)
|
||||||
? string.Concat(Request.GetAbsoluteRootUri().ToString(), "checkout-v2/payment.mp3")
|
? string.Concat(Request.GetAbsoluteRootUri().ToString(), "checkout/payment.mp3")
|
||||||
: await _fileService.GetFileUrl(Request.GetAbsoluteRootUri(), storeBlob.SoundFileId);
|
: await _fileService.GetFileUrl(Request.GetAbsoluteRootUri(), storeBlob.SoundFileId);
|
||||||
model.ErrorSoundUrl = string.Concat(Request.GetAbsoluteRootUri().ToString(), "checkout-v2/error.mp3");
|
model.ErrorSoundUrl = string.Concat(Request.GetAbsoluteRootUri().ToString(), "checkout/error.mp3");
|
||||||
model.NfcReadSoundUrl = string.Concat(Request.GetAbsoluteRootUri().ToString(), "checkout-v2/nfcread.mp3");
|
model.NfcReadSoundUrl = string.Concat(Request.GetAbsoluteRootUri().ToString(), "checkout/nfcread.mp3");
|
||||||
}
|
}
|
||||||
|
|
||||||
var expiration = TimeSpan.FromSeconds(model.ExpirationSeconds);
|
var expiration = TimeSpan.FromSeconds(model.ExpirationSeconds);
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace BTCPayServer.Payments.Bitcoin
|
||||||
|
|
||||||
public void RegisterViews(PaymentMethodViewContext context)
|
public void RegisterViews(PaymentMethodViewContext context)
|
||||||
{
|
{
|
||||||
context.RegisterCheckoutUI(new CheckoutUIPaymentMethodSettings()
|
context.RegisterCheckoutUI(new CheckoutUIPaymentMethodSettings
|
||||||
{
|
{
|
||||||
ExtensionPartial = "Bitcoin/BitcoinLikeMethodCheckout",
|
ExtensionPartial = "Bitcoin/BitcoinLikeMethodCheckout",
|
||||||
CheckoutBodyVueComponentName = "BitcoinLikeMethodCheckout",
|
CheckoutBodyVueComponentName = "BitcoinLikeMethodCheckout",
|
||||||
|
|
|
@ -15,14 +15,12 @@ namespace BTCPayServer.Plugins.NFC
|
||||||
|
|
||||||
public override void Execute(IServiceCollection applicationBuilder)
|
public override void Execute(IServiceCollection applicationBuilder)
|
||||||
{
|
{
|
||||||
|
applicationBuilder.AddSingleton<IUIExtension>(new UIExtension("NFC/CheckoutEnd",
|
||||||
|
"checkout-end"));
|
||||||
applicationBuilder.AddSingleton<IUIExtension>(new UIExtension("NFC/LNURLNFCPostContent",
|
applicationBuilder.AddSingleton<IUIExtension>(new UIExtension("NFC/LNURLNFCPostContent",
|
||||||
"checkout-lightning-post-content"));
|
"checkout-lightning-post-content"));
|
||||||
applicationBuilder.AddSingleton<IUIExtension>(new UIExtension("NFC/CheckoutEnd",
|
applicationBuilder.AddSingleton<IUIExtension>(new UIExtension("NFC/LNURLNFCPostContent",
|
||||||
"checkout-v2-end"));
|
"checkout-bitcoin-post-content"));
|
||||||
applicationBuilder.AddSingleton<IUIExtension>(new UIExtension("NFC/LNURLNFCPostContent-v2",
|
|
||||||
"checkout-v2-lightning-post-content"));
|
|
||||||
applicationBuilder.AddSingleton<IUIExtension>(new UIExtension("NFC/LNURLNFCPostContent-v2",
|
|
||||||
"checkout-v2-bitcoin-post-content"));
|
|
||||||
base.Execute(applicationBuilder);
|
base.Execute(applicationBuilder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace BTCPayServer.Services.Altcoins.Monero.Payments
|
||||||
|
|
||||||
public CheckoutUIPaymentMethodSettings GetCheckoutUISettings()
|
public CheckoutUIPaymentMethodSettings GetCheckoutUISettings()
|
||||||
{
|
{
|
||||||
return new CheckoutUIPaymentMethodSettings()
|
return new CheckoutUIPaymentMethodSettings
|
||||||
{
|
{
|
||||||
ExtensionPartial = "Bitcoin/BitcoinLikeMethodCheckout",
|
ExtensionPartial = "Bitcoin/BitcoinLikeMethodCheckout",
|
||||||
CheckoutBodyVueComponentName = "BitcoinLikeMethodCheckout",
|
CheckoutBodyVueComponentName = "BitcoinLikeMethodCheckout",
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace BTCPayServer.Services.Altcoins.Zcash.Payments
|
||||||
|
|
||||||
public CheckoutUIPaymentMethodSettings GetCheckoutUISettings()
|
public CheckoutUIPaymentMethodSettings GetCheckoutUISettings()
|
||||||
{
|
{
|
||||||
return new CheckoutUIPaymentMethodSettings()
|
return new CheckoutUIPaymentMethodSettings
|
||||||
{
|
{
|
||||||
ExtensionPartial = "Bitcoin/BitcoinLikeMethodCheckout",
|
ExtensionPartial = "Bitcoin/BitcoinLikeMethodCheckout",
|
||||||
CheckoutBodyVueComponentName = "BitcoinLikeMethodCheckout",
|
CheckoutBodyVueComponentName = "BitcoinLikeMethodCheckout",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
@model BTCPayServer.Models.InvoicingModels.PaymentModel
|
@model BTCPayServer.Models.InvoicingModels.PaymentModel
|
||||||
|
|
||||||
<template id="bitcoin-method-checkout-template">
|
<template id="bitcoin-method-checkout-template">
|
||||||
@await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-v2-bitcoin-pre-content", model = Model})
|
@await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-bitcoin-pre-content", model = Model})
|
||||||
<div class="payment-box">
|
<div class="payment-box">
|
||||||
<div v-if="model.invoiceBitcoinUrlQR" class="qr-container" :data-qr-value="model.invoiceBitcoinUrlQR" :data-clipboard="model.invoiceBitcoinUrl" data-clipboard-confirm-element="#Address_@Model.PaymentMethodId [data-clipboard]">
|
<div v-if="model.invoiceBitcoinUrlQR" class="qr-container" :data-qr-value="model.invoiceBitcoinUrlQR" :data-clipboard="model.invoiceBitcoinUrl" data-clipboard-confirm-element="#Address_@Model.PaymentMethodId [data-clipboard]">
|
||||||
<div>
|
<div>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
</div>
|
</div>
|
||||||
<a v-if="model.invoiceBitcoinUrl && model.showPayInWalletButton" class="btn btn-primary rounded-pill w-100 mt-4" id="PayInWallet" target="_blank"
|
<a v-if="model.invoiceBitcoinUrl && model.showPayInWalletButton" class="btn btn-primary rounded-pill w-100 mt-4" id="PayInWallet" target="_blank"
|
||||||
:href="model.invoiceBitcoinUrl" :title="$t(hasPayjoin ? 'BIP21 payment link with PayJoin support' : 'BIP21 payment link')" v-t="'pay_in_wallet'"></a>
|
:href="model.invoiceBitcoinUrl" :title="$t(hasPayjoin ? 'BIP21 payment link with PayJoin support' : 'BIP21 payment link')" v-t="'pay_in_wallet'"></a>
|
||||||
@await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-v2-bitcoin-post-content", model = Model})
|
@await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-bitcoin-post-content", model = Model})
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<template id="lightning-method-checkout-template">
|
<template id="lightning-method-checkout-template">
|
||||||
<div class="payment-box">
|
<div class="payment-box">
|
||||||
@await Component.InvokeAsync("UiExtensionPoint" , new { location="checkout-v2-lightning-pre-content", model = Model})
|
@await Component.InvokeAsync("UiExtensionPoint" , new { location="checkout-lightning-pre-content", model = Model})
|
||||||
<div v-if="model.invoiceBitcoinUrlQR" class="qr-container" :data-qr-value="model.invoiceBitcoinUrlQR" :data-clipboard="model.invoiceBitcoinUrl" data-clipboard-confirm-element="#Lightning_@Model.PaymentMethodId [data-clipboard]">
|
<div v-if="model.invoiceBitcoinUrlQR" class="qr-container" :data-qr-value="model.invoiceBitcoinUrlQR" :data-clipboard="model.invoiceBitcoinUrl" data-clipboard-confirm-element="#Lightning_@Model.PaymentMethodId [data-clipboard]">
|
||||||
<div>
|
<div>
|
||||||
<qrcode :value="model.invoiceBitcoinUrlQR" tag="div" :options="qrOptions" />
|
<qrcode :value="model.invoiceBitcoinUrlQR" tag="div" :options="qrOptions" />
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<a v-if="model.invoiceBitcoinUrl && model.showPayInWalletButton" class="btn btn-primary rounded-pill w-100 mt-4" id="PayInWallet" target="_blank"
|
<a v-if="model.invoiceBitcoinUrl && model.showPayInWalletButton" class="btn btn-primary rounded-pill w-100 mt-4" id="PayInWallet" target="_blank"
|
||||||
:href="model.invoiceBitcoinUrl" v-t="'pay_in_wallet'"></a>
|
:href="model.invoiceBitcoinUrl" v-t="'pay_in_wallet'"></a>
|
||||||
<div v-if="!model.invoiceBitcoinUrl && !model.btcAddress" class="alert alert-danger">This payment method is not available when using an insecure connection. Please use HTTPS or Tor.</div>
|
<div v-if="!model.invoiceBitcoinUrl && !model.btcAddress" class="alert alert-danger">This payment method is not available when using an insecure connection. Please use HTTPS or Tor.</div>
|
||||||
@await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-v2-lightning-post-content", model = Model})
|
@await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-lightning-post-content", model = Model})
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,21 +1,8 @@
|
||||||
<template id="lnurl-withdraw-template">
|
<template id="lnurl-withdraw-template">
|
||||||
<div v-if="display" class="mt-4" id="NFC">
|
<div v-if="display" class="mt-4" id="NFC">
|
||||||
<div v-if="nfcErrorMessage" class="alert alert-danger" v-text="nfcErrorMessage"></div>
|
<div v-if="nfcErrorMessage" class="alert alert-danger" v-text="nfcErrorMessage"></div>
|
||||||
<template v-if="isV2">
|
<button class="btn btn-secondary rounded-pill w-100" type="button" id="PayByNFC"
|
||||||
<button class="btn btn-secondary rounded-pill w-100" type="button" id="PayByNFC"
|
:disabled="nfcScanning || submitting" v-on:click="handleClick">{{btnText}}</button>
|
||||||
:disabled="nfcScanning || submitting" v-on:click="handleClick">{{btnText}}</button>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<bp-loading-button>
|
|
||||||
<button class="action-button" style="margin: 0 45px;width:calc(100% - 90px) !important" :disabled="nfcScanning || submitting" v-on:click="handleClick" id="PayByNFC"
|
|
||||||
:class="{ 'action-button': nfcSupported, 'btn btn-text w-100': !nfcSupported }">
|
|
||||||
<span class="button-text">{{btnText}}</span>
|
|
||||||
<div class="loader-wrapper">
|
|
||||||
@await Html.PartialAsync("~/Views/UIInvoice/Checkout-Spinner.cshtml")
|
|
||||||
</div>
|
|
||||||
</button>
|
|
||||||
</bp-loading-button>
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -23,7 +10,6 @@ Vue.component("lnurl-withdraw-checkout", {
|
||||||
template: "#lnurl-withdraw-template",
|
template: "#lnurl-withdraw-template",
|
||||||
props: {
|
props: {
|
||||||
model: Object,
|
model: Object,
|
||||||
isV2: Boolean,
|
|
||||||
nfcSupported: Boolean,
|
nfcSupported: Boolean,
|
||||||
nfcScanning: Boolean,
|
nfcScanning: Boolean,
|
||||||
nfcErrorMessage: String
|
nfcErrorMessage: String
|
||||||
|
@ -54,14 +40,14 @@ Vue.component("lnurl-withdraw-checkout", {
|
||||||
btnText () {
|
btnText () {
|
||||||
if (this.nfcSupported) {
|
if (this.nfcSupported) {
|
||||||
if (this.submitting) {
|
if (this.submitting) {
|
||||||
return this.isV2 ? this.$t('submitting_nfc') : 'Submitting NFC …'
|
return this.$t('submitting_nfc')
|
||||||
} else if (this.nfcScanning) {
|
} else if (this.nfcScanning) {
|
||||||
return this.isV2 ? this.$t('scanning_nfc') : 'Scanning NFC …'
|
return this.$t('scanning_nfc')
|
||||||
} else {
|
} else {
|
||||||
return this.isV2 ? this.$t('pay_by_nfc') : 'Pay by NFC'
|
return this.$t('pay_by_nfc')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return this.isV2 ? this.$t('pay_by_lnurl') : 'Pay by LNURL-Withdraw'
|
return this.$t('pay_by_lnurl')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
<lnurl-withdraw-checkout :model="model" :is-v2="true" :nfc-supported="nfcSupported" :nfc-scanning="nfcScanning" :nfc-error-message="nfcErrorMessage" v-on="$listeners" />
|
|
|
@ -1 +1 @@
|
||||||
<lnurl-withdraw-checkout :model="srvModel" :nfc-supported="nfcSupported" :nfc-scanning="nfcScanning" :nfc-error-message="nfcErrorMessage" v-on="$listeners" />
|
<lnurl-withdraw-checkout :model="model" :nfc-supported="nfcSupported" :nfc-scanning="nfcScanning" :nfc-error-message="nfcErrorMessage" v-on="$listeners" />
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<head>
|
<head>
|
||||||
<partial name="LayoutHead"/>
|
<partial name="LayoutHead"/>
|
||||||
<meta name="robots" content="noindex,nofollow">
|
<meta name="robots" content="noindex,nofollow">
|
||||||
<link href="~/checkout-v2/checkout.css" asp-append-version="true" rel="stylesheet" />
|
<link href="~/checkout/checkout.css" asp-append-version="true" rel="stylesheet" />
|
||||||
@if (!string.IsNullOrEmpty(Model.PaymentSoundUrl))
|
@if (!string.IsNullOrEmpty(Model.PaymentSoundUrl))
|
||||||
{
|
{
|
||||||
<link rel="preload" href="@Model.PaymentSoundUrl" as="audio" />
|
<link rel="preload" href="@Model.PaymentSoundUrl" as="audio" />
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
}
|
}
|
||||||
</head>
|
</head>
|
||||||
<body class="min-vh-100">
|
<body class="min-vh-100">
|
||||||
<div id="Checkout-v2" class="public-page-wrap" v-cloak>
|
<div id="Checkout" class="public-page-wrap" v-cloak>
|
||||||
@if (Model.ShowStoreHeader)
|
@if (Model.ShowStoreHeader)
|
||||||
{
|
{
|
||||||
<partial name="_StoreHeader" model="(Model.StoreName, Model.StoreBranding)" />
|
<partial name="_StoreHeader" model="(Model.StoreName, Model.StoreBranding)" />
|
||||||
|
@ -291,7 +291,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
const i18nUrl = @Safe.Json($"{Model.RootPath}misc/translations/checkout-v2/{{{{lng}}}}?v={Env.Version}");
|
const i18nUrl = @Safe.Json($"{Model.RootPath}misc/translations/checkout/{{{{lng}}}}?v={Env.Version}");
|
||||||
const statusUrl = @Safe.Json(Url.Action("GetStatus", new { invoiceId = Model.InvoiceId }));
|
const statusUrl = @Safe.Json(Url.Action("GetStatus", new { invoiceId = Model.InvoiceId }));
|
||||||
const statusWsUrl = @Safe.Json(Url.Action("GetStatusWebSocket", new { invoiceId = Model.InvoiceId }));
|
const statusWsUrl = @Safe.Json(Url.Action("GetStatusWebSocket", new { invoiceId = Model.InvoiceId }));
|
||||||
const availableLanguages = @Safe.Json(LangService.GetLanguages().Select(language => language.Code));
|
const availableLanguages = @Safe.Json(LangService.GetLanguages().Select(language => language.Code));
|
||||||
|
@ -311,16 +311,16 @@
|
||||||
<script src="~/js/copy-to-clipboard.js" asp-append-version="true"></script>
|
<script src="~/js/copy-to-clipboard.js" asp-append-version="true"></script>
|
||||||
<script src="~/js/vue-utils.js" asp-append-version="true"></script>
|
<script src="~/js/vue-utils.js" asp-append-version="true"></script>
|
||||||
<script src="~/main/utils.js" asp-append-version="true"></script>
|
<script src="~/main/utils.js" asp-append-version="true"></script>
|
||||||
<script src="~/checkout-v2/checkout.js" asp-append-version="true"></script>
|
<script src="~/checkout/checkout.js" asp-append-version="true"></script>
|
||||||
@if (Env.CheatMode)
|
@if (Env.CheatMode)
|
||||||
{
|
{
|
||||||
<partial name="Checkout-Cheating" model="@Model" />
|
<partial name="Checkout-Cheating" model="@Model" />
|
||||||
}
|
}
|
||||||
@foreach (var extensionPartial in Model.ExtensionPartials)
|
@foreach (var extensionPartial in Model.ExtensionPartials)
|
||||||
{
|
{
|
||||||
<partial name="@extensionPartial-v2" model="@Model" />
|
<partial name="@extensionPartial" model="@Model" />
|
||||||
}
|
}
|
||||||
@await Component.InvokeAsync("UiExtensionPoint", new { location = "checkout-payment", model = Model })
|
@await Component.InvokeAsync("UiExtensionPoint", new { location = "checkout-payment", model = Model })
|
||||||
@await Component.InvokeAsync("UiExtensionPoint", new { location = "checkout-v2-end", model = Model })
|
@await Component.InvokeAsync("UiExtensionPoint", new { location = "checkout-end", model = Model })
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -156,7 +156,7 @@
|
||||||
<input asp-for="SoundFile" type="file" class="form-control flex-grow">
|
<input asp-for="SoundFile" type="file" class="form-control flex-grow">
|
||||||
@{
|
@{
|
||||||
var soundUrl = string.IsNullOrEmpty(Model.SoundFileId)
|
var soundUrl = string.IsNullOrEmpty(Model.SoundFileId)
|
||||||
? string.Concat(Context.Request.GetAbsoluteRootUri().ToString(), "checkout-v2/payment.mp3")
|
? string.Concat(Context.Request.GetAbsoluteRootUri().ToString(), "checkout/payment.mp3")
|
||||||
: await FileService.GetFileUrl(Context.Request.GetAbsoluteRootUri(), Model.SoundFileId);
|
: await FileService.GetFileUrl(Context.Request.GetAbsoluteRootUri(), Model.SoundFileId);
|
||||||
}
|
}
|
||||||
<audio controls src="@soundUrl" style="height:2.1rem;max-width:10.5rem;"></audio>
|
<audio controls src="@soundUrl" style="height:2.1rem;max-width:10.5rem;"></audio>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#Checkout-v2 {
|
#Checkout {
|
||||||
--wrap-max-width: 400px;
|
--wrap-max-width: 400px;
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
|
@ -178,7 +178,7 @@ section dl > div dd {
|
||||||
|
|
||||||
@media (max-width: 400px) {
|
@media (max-width: 400px) {
|
||||||
/* Pull it up if there's no store header */
|
/* Pull it up if there's no store header */
|
||||||
#Checkout-v2 > main.tile:first-child {
|
#Checkout > main.tile:first-child {
|
||||||
margin-top: calc(var(--wrap-padding-vertical) * -1);
|
margin-top: calc(var(--wrap-padding-vertical) * -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -77,7 +77,7 @@ const PaymentDetails = {
|
||||||
function initApp() {
|
function initApp() {
|
||||||
return new Vue({
|
return new Vue({
|
||||||
i18n,
|
i18n,
|
||||||
el: '#Checkout-v2',
|
el: '#Checkout',
|
||||||
components: {
|
components: {
|
||||||
'payment-details': PaymentDetails,
|
'payment-details': PaymentDetails,
|
||||||
},
|
},
|
Loading…
Add table
Reference in a new issue