mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
Confirmation page for enabling Pay Button
This commit is contained in:
parent
b5626ef01c
commit
deb56e16ec
4 changed files with 52 additions and 1 deletions
|
@ -127,6 +127,9 @@
|
|||
</Content>
|
||||
<Content Update="Views\Server\SSHService.cshtml">
|
||||
<Pack>$(IncludeRazorContentInPack)</Pack>
|
||||
</Content>
|
||||
<Content Update="Views\Stores\PayButtonEnable.cshtml">
|
||||
<Pack>$(IncludeRazorContentInPack)</Pack>
|
||||
</Content>
|
||||
<Content Update="Views\Stores\PayButton.cshtml">
|
||||
<Pack>$(IncludeRazorContentInPack)</Pack>
|
||||
|
|
|
@ -776,6 +776,12 @@ namespace BTCPayServer.Controllers
|
|||
{
|
||||
var store = StoreData;
|
||||
|
||||
var storeBlob = store.GetStoreBlob();
|
||||
if (!storeBlob.PayButtonEnabled)
|
||||
{
|
||||
return View("PayButtonEnable", null);
|
||||
}
|
||||
|
||||
var appUrl = HttpContext.Request.GetAbsoluteRoot().WithTrailingSlash();
|
||||
var model = new PayButtonViewModel
|
||||
{
|
||||
|
@ -788,5 +794,24 @@ namespace BTCPayServer.Controllers
|
|||
};
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("{storeId}/paybutton")]
|
||||
public async Task<IActionResult> PayButton(bool enableStore)
|
||||
{
|
||||
var blob = StoreData.GetStoreBlob();
|
||||
blob.PayButtonEnabled = enableStore;
|
||||
if (StoreData.SetStoreBlob(blob))
|
||||
{
|
||||
await _Repo.UpdateStore(StoreData);
|
||||
StatusMessage = "Store successfully updated";
|
||||
}
|
||||
|
||||
return RedirectToAction(nameof(PayButton), new
|
||||
{
|
||||
storeId = StoreData.Id
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
@model PayButtonViewModel
|
||||
@{
|
||||
Layout = "../Shared/_NavLayout.cshtml";
|
||||
ViewData.SetActivePageAndTitle(StoreNavPages.PayButton, "Pay Button");
|
||||
ViewData.SetActivePageAndTitle(StoreNavPages.PayButton);
|
||||
ViewBag.MainTitle = "Pay Button";
|
||||
}
|
||||
|
||||
<div class="container" id="payButtonCtrl">
|
||||
|
|
22
BTCPayServer/Views/Stores/PayButtonEnable.cshtml
Normal file
22
BTCPayServer/Views/Stores/PayButtonEnable.cshtml
Normal file
|
@ -0,0 +1,22 @@
|
|||
@{
|
||||
Layout = "../Shared/_NavLayout.cshtml";
|
||||
ViewData.SetActivePageAndTitle(StoreNavPages.PayButton, "Enable access");
|
||||
ViewBag.MainTitle = "Confirm enabling of Pay Button";
|
||||
}
|
||||
|
||||
<h4>@ViewData["Title"]</h4>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<p>
|
||||
To start using Pay Button you need to explicitly enable creation of Invoices by Pay Button.
|
||||
Once you do so, valid POST requests from any source will allow creation of invoices on your instance of BtcPayServer.
|
||||
</p>
|
||||
<input type="hidden" name="enableStore" value="true" />
|
||||
<button name="command" type="submit" value="save" class="btn btn-primary">Enable Pay Button</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Reference in a new issue