mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +01:00
Validating that Store has Pay Button enabled
This commit is contained in:
parent
e39d9067f2
commit
b5626ef01c
@ -17,7 +17,7 @@ namespace BTCPayServer.Controllers
|
||||
_InvoiceController = invoiceController;
|
||||
_StoreRepository = storeRepository;
|
||||
}
|
||||
|
||||
|
||||
private InvoiceController _InvoiceController;
|
||||
private StoreRepository _StoreRepository;
|
||||
|
||||
@ -30,9 +30,15 @@ namespace BTCPayServer.Controllers
|
||||
var store = await _StoreRepository.FindStore(storeId);
|
||||
if (store == null)
|
||||
ModelState.AddModelError("Store", "Invalid store");
|
||||
else
|
||||
{
|
||||
var storeBlob = store.GetStoreBlob();
|
||||
if (!storeBlob.PayButtonEnabled)
|
||||
ModelState.AddModelError("Store", "Store has not enabled Pay Button");
|
||||
}
|
||||
|
||||
// TODO: extract validation to model
|
||||
if (model.Price <= 0)
|
||||
if (model == null || model.Price <= 0)
|
||||
ModelState.AddModelError("Price", "Price must be greater than 0");
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
|
@ -302,6 +302,8 @@ namespace BTCPayServer.Data
|
||||
|
||||
public string RateScript { get; set; }
|
||||
|
||||
public bool PayButtonEnabled { get; set; }
|
||||
|
||||
|
||||
string _LightningDescriptionTemplate;
|
||||
public string LightningDescriptionTemplate
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div class="container" id="payButtonCtrl">
|
||||
<div class="row">
|
||||
|
||||
<form method="POST" action="http://127.0.0.1:14142/pay/4b1AnMtMNuxwG7io2dUcB3TrT3yUbgajjGfJjVfdhBDu">
|
||||
<form method="POST" action="http://127.0.0.1:14142/pay/9Jy2oFziB7ZPGHVHTBun2VMyvnBz6GELbpxPeJbSfQDw">
|
||||
<input type="hidden" name="price" value="10" />
|
||||
<input type="hidden" name="currency" value="USD" />
|
||||
<input type="image" src="http://127.0.0.1:14142/img/paybutton/pay.png" name="submit" style="width:209px" alt="Pay with BtcPay, Self-Hosted Bitcoin Payment Processor">
|
||||
|
Loading…
Reference in New Issue
Block a user