Making Currency a textbox instead of dropdown

This commit is contained in:
nicolas.dorier
2018-08-23 11:17:54 +09:00
parent d50dc2e68e
commit e0f1c50534
2 changed files with 3 additions and 23 deletions

View File

@@ -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();