Adjust Pay Button (#3354)

* updates padding

* padding adjustments

* updates

* Redirect to paybutton enable page when disabling

* Fix test

* Fix test

Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
Co-authored-by: Dennis Reimann <mail@dennisreimann.de>
This commit is contained in:
dstrukt
2022-01-25 21:55:48 -08:00
committed by GitHub
parent 70883c0869
commit cc1233e8d5
5 changed files with 20 additions and 17 deletions

View File

@@ -513,6 +513,7 @@ namespace BTCPayServer.Tests
s.Driver.FindElement(By.Id("enable-pay-button")).Click(); s.Driver.FindElement(By.Id("enable-pay-button")).Click();
s.Driver.FindElement(By.Id("disable-pay-button")).Click(); s.Driver.FindElement(By.Id("disable-pay-button")).Click();
s.FindAlertMessage(); s.FindAlertMessage();
s.GoToStore(StoreNavPages.General);
Assert.False(s.Driver.FindElement(By.Id("AnyoneCanCreateInvoice")).Selected); Assert.False(s.Driver.FindElement(By.Id("AnyoneCanCreateInvoice")).Selected);
s.Driver.SetCheckbox(By.Id("AnyoneCanCreateInvoice"), true); s.Driver.SetCheckbox(By.Id("AnyoneCanCreateInvoice"), true);
s.Driver.FindElement(By.Id("Save")).Click(); s.Driver.FindElement(By.Id("Save")).Click();

View File

@@ -969,7 +969,7 @@ namespace BTCPayServer.Controllers
CurrentStore.SetStoreBlob(blob); CurrentStore.SetStoreBlob(blob);
TempData[WellKnownTempData.SuccessMessage] = "Feature disabled"; TempData[WellKnownTempData.SuccessMessage] = "Feature disabled";
await _Repo.UpdateStore(CurrentStore); await _Repo.UpdateStore(CurrentStore);
return RedirectToAction(nameof(GeneralSettings), new { storeId }); return RedirectToAction(nameof(PayButton), new { storeId = storeId });
} }
[Route("{storeId}/paybutton")] [Route("{storeId}/paybutton")]

View File

@@ -23,6 +23,7 @@ namespace BTCPayServer.Data
public StoreBlob() public StoreBlob()
{ {
InvoiceExpiration = TimeSpan.FromMinutes(15); InvoiceExpiration = TimeSpan.FromMinutes(15);
RefundBOLT11Expiration = TimeSpan.FromDays(30);
MonitoringExpiration = TimeSpan.FromDays(1); MonitoringExpiration = TimeSpan.FromDays(1);
PaymentTolerance = 0; PaymentTolerance = 0;
ShowRecommendedFee = true; ShowRecommendedFee = true;

View File

@@ -130,7 +130,7 @@
<partial name="_StatusMessage" /> <partial name="_StatusMessage" />
<h2 class="mt-1 mb-4">@ViewData["Title"]</h2> <h2 class="mt-1 mb-4">@ViewData["Title"]</h2>
<div class="alert alert-warning alert-dismissible mb-5" role="alert"> <div class="alert alert-warning alert-dismissible mb-4" role="alert">
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
<vc:icon symbol="close" /> <vc:icon symbol="close" />
</button> </button>
@@ -138,7 +138,7 @@
<p>By activating this feature, a malicious user can trick you into thinking an order has been processed by creating a new invoice, reusing the same Order Id of another valid order but different amount or currency.</p> <p>By activating this feature, a malicious user can trick you into thinking an order has been processed by creating a new invoice, reusing the same Order Id of another valid order but different amount or currency.</p>
<form asp-action="DisableAnyoneCanCreateInvoice" asp-route-storeId="@Context.GetRouteValue("storeId")" method="post"> <form asp-action="DisableAnyoneCanCreateInvoice" asp-route-storeId="@Context.GetRouteValue("storeId")" method="post">
<button name="command" id="disable-pay-button" type="submit" class="btn btn-danger px-4 mt-3" value="Save">Disable payment button</button> <button name="command" id="disable-pay-button" type="submit" class="btn btn-danger mt-0" value="Save">Disable payment button</button>
</form> </form>
</div> </div>
<div id="payButtonCtrl"> <div id="payButtonCtrl">

View File

@@ -2,16 +2,17 @@
ViewData.SetActivePage(StoreNavPages.PayButton, "Pay Button", Context.GetStoreData().Id); ViewData.SetActivePage(StoreNavPages.PayButton, "Pay Button", Context.GetStoreData().Id);
} }
<partial name="_StatusMessage" />
<h2 class="mt-1 mb-4">@ViewData["Title"]</h2> <h2 class="mt-1 mb-4">@ViewData["Title"]</h2>
<div class="row"> <div class="row">
<div class="col-md-10"> <div class="col-md-10">
<div class="alert alert-warning alert-dismissible mb-5" role="alert"> <div class="alert alert-warning alert-dismissible mb-4" role="alert">
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
<vc:icon symbol="close" /> <vc:icon symbol="close" />
</button> </button>
<p><strong>Warning:</strong> This feature should not be activated on a BTCPay Server store processing commercial transactions.</p> <p><strong>Warning:</strong> This feature should not be activated on a BTCPay Server store processing commercial transactions.</p>
<p>By activating this feature, a malicious user can trick you into thinking an order has been processed by creating a new invoice, reusing the same Order Id of another valid order but different amount or currency.</p> <p class="mb-0">By activating this feature, a malicious user can trick you into thinking an order has been processed by creating a new invoice, reusing the same Order Id of another valid order but different amount or currency.</p>
</div> </div>
<p> <p>
To start using Pay Button, you need to enable this feature explicitly. To start using Pay Button, you need to enable this feature explicitly.