mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
Making Currency a textbox instead of dropdown
This commit is contained in:
@@ -778,7 +778,6 @@ namespace BTCPayServer.Controllers
|
||||
public IActionResult PayButton()
|
||||
{
|
||||
var store = StoreData;
|
||||
var currencyDropdown = supportedCurrencies(store);
|
||||
|
||||
var appUrl = HttpContext.Request.GetAbsoluteRoot().WithTrailingSlash();
|
||||
var model = new PayButtonViewModel
|
||||
@@ -787,23 +786,12 @@ namespace BTCPayServer.Controllers
|
||||
Currency = DEFAULT_CURRENCY,
|
||||
ButtonSize = 2,
|
||||
UrlRoot = appUrl,
|
||||
CurrencyDropdown = currencyDropdown,
|
||||
PayButtonImageUrl = appUrl + "img/paybutton/pay.png",
|
||||
StoreId = store.Id
|
||||
};
|
||||
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]
|
||||
[Route("{storeId}/pay")]
|
||||
[IgnoreAntiforgeryToken]
|
||||
@@ -816,11 +804,6 @@ namespace BTCPayServer.Controllers
|
||||
if (model.Price <= 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)
|
||||
return View();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user