mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Making Currency a textbox instead of dropdown
This commit is contained in:
@@ -778,7 +778,6 @@ namespace BTCPayServer.Controllers
|
|||||||
public IActionResult PayButton()
|
public IActionResult PayButton()
|
||||||
{
|
{
|
||||||
var store = StoreData;
|
var store = StoreData;
|
||||||
var currencyDropdown = supportedCurrencies(store);
|
|
||||||
|
|
||||||
var appUrl = HttpContext.Request.GetAbsoluteRoot().WithTrailingSlash();
|
var appUrl = HttpContext.Request.GetAbsoluteRoot().WithTrailingSlash();
|
||||||
var model = new PayButtonViewModel
|
var model = new PayButtonViewModel
|
||||||
@@ -787,23 +786,12 @@ namespace BTCPayServer.Controllers
|
|||||||
Currency = DEFAULT_CURRENCY,
|
Currency = DEFAULT_CURRENCY,
|
||||||
ButtonSize = 2,
|
ButtonSize = 2,
|
||||||
UrlRoot = appUrl,
|
UrlRoot = appUrl,
|
||||||
CurrencyDropdown = currencyDropdown,
|
|
||||||
PayButtonImageUrl = appUrl + "img/paybutton/pay.png",
|
PayButtonImageUrl = appUrl + "img/paybutton/pay.png",
|
||||||
StoreId = store.Id
|
StoreId = store.Id
|
||||||
};
|
};
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<string> supportedCurrencies(StoreData store)
|
|
||||||
{
|
|
||||||
var paymentMethods = store.GetSupportedPaymentMethods(_NetworkProvider)
|
|
||||||
.Select(a => a.PaymentId.ToString()).ToList();
|
|
||||||
var currencyDropdown = new List<string>();
|
|
||||||
currencyDropdown.Add(DEFAULT_CURRENCY);
|
|
||||||
currencyDropdown.AddRange(paymentMethods);
|
|
||||||
return currencyDropdown;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("{storeId}/pay")]
|
[Route("{storeId}/pay")]
|
||||||
[IgnoreAntiforgeryToken]
|
[IgnoreAntiforgeryToken]
|
||||||
@@ -816,11 +804,6 @@ namespace BTCPayServer.Controllers
|
|||||||
if (model.Price <= 0)
|
if (model.Price <= 0)
|
||||||
ModelState.AddModelError("Price", "Price must be greater than 0");
|
ModelState.AddModelError("Price", "Price must be greater than 0");
|
||||||
|
|
||||||
var curr = supportedCurrencies(store);
|
|
||||||
if (!curr.Contains(model.Currency))
|
|
||||||
ModelState.AddModelError("Currency", $"Selected currency {model.Currency} is not supported in this store");
|
|
||||||
//
|
|
||||||
|
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
return View();
|
return View();
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label> </label>
|
<label> </label>
|
||||||
<select class="form-control" v-model="srvModel.currency" v-on:change="inputChanges">
|
<input name="price" type="text" class="form-control"
|
||||||
@foreach (var item in Model.CurrencyDropdown)
|
v-model="srvModel.currency" v-on:change="inputChanges"
|
||||||
{
|
:class="{'is-invalid': errors.has('currency') }">
|
||||||
<option>@item</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
Reference in New Issue
Block a user