From 5655f223974beac4c6ec21ece1f9c807bcd4c7f9 Mon Sep 17 00:00:00 2001 From: "Samuel B. Atwood" Date: Wed, 20 Oct 2021 01:34:04 -0400 Subject: [PATCH] Fix default payment bug (#2975) * Fix default payment bug This attempts to fix the default payment bug described in #2963. Update to complete #2986 This takes into account #2986 and @NicolasDorier 's suggestion to add a default payment type as an empty (valueless) option that is selected by default. * Fix tests Co-authored-by: nicolas.dorier --- BTCPayServer.Tests/SeleniumTester.cs | 6 ++++-- BTCPayServer/Views/Invoice/CreateInvoice.cshtml | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/BTCPayServer.Tests/SeleniumTester.cs b/BTCPayServer.Tests/SeleniumTester.cs index fb0929af9..8b0dd664f 100644 --- a/BTCPayServer.Tests/SeleniumTester.cs +++ b/BTCPayServer.Tests/SeleniumTester.cs @@ -21,6 +21,7 @@ using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Support.Extensions; using Xunit; +using OpenQA.Selenium.Support.UI; namespace BTCPayServer.Tests { @@ -352,7 +353,7 @@ namespace BTCPayServer.Tests decimal? amount = 100, string currency = "USD", string refundEmail = "", - string defaultPaymentMethod = "BTC" + string defaultPaymentMethod = null ) { GoToInvoices(); @@ -364,7 +365,8 @@ namespace BTCPayServer.Tests currencyEl.SendKeys(currency); Driver.FindElement(By.Id("BuyerEmail")).SendKeys(refundEmail); Driver.FindElement(By.Name("StoreId")).SendKeys(storeName); - Driver.FindElement(By.Name("DefaultPaymentMethod")).SendKeys(defaultPaymentMethod); + if (defaultPaymentMethod is string) + new SelectElement(Driver.FindElement(By.Name("DefaultPaymentMethod"))).SelectByValue(defaultPaymentMethod); Driver.FindElement(By.Id("Create")).Click(); var statusElement = FindAlertMessage(); diff --git a/BTCPayServer/Views/Invoice/CreateInvoice.cshtml b/BTCPayServer/Views/Invoice/CreateInvoice.cshtml index 7a8b61049..da59403a7 100644 --- a/BTCPayServer/Views/Invoice/CreateInvoice.cshtml +++ b/BTCPayServer/Views/Invoice/CreateInvoice.cshtml @@ -81,7 +81,9 @@
- +