mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
allow admin update default rate provider and default currency for stores (#5918)
* allow admin update default rate provider and default currency for stores * Updated PR on allowing server admin to update currency * update server settings to select default currency * revert standard default currency * clean up * Minor rewording --------- Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
This commit is contained in:
committed by
GitHub
parent
84df96429c
commit
11b38a7a4c
@@ -6,6 +6,7 @@ using BTCPayServer.Abstractions.Models;
|
|||||||
using BTCPayServer.Client;
|
using BTCPayServer.Client;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using BTCPayServer.Models.StoreViewModels;
|
using BTCPayServer.Models.StoreViewModels;
|
||||||
|
using BTCPayServer.Services;
|
||||||
using BTCPayServer.Services.Rates;
|
using BTCPayServer.Services.Rates;
|
||||||
using BTCPayServer.Services.Stores;
|
using BTCPayServer.Services.Stores;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
@@ -20,6 +21,7 @@ namespace BTCPayServer.Controllers
|
|||||||
public class UIUserStoresController : Controller
|
public class UIUserStoresController : Controller
|
||||||
{
|
{
|
||||||
private readonly StoreRepository _repo;
|
private readonly StoreRepository _repo;
|
||||||
|
private readonly SettingsRepository _settingsRepository;
|
||||||
private readonly UserManager<ApplicationUser> _userManager;
|
private readonly UserManager<ApplicationUser> _userManager;
|
||||||
private readonly RateFetcher _rateFactory;
|
private readonly RateFetcher _rateFactory;
|
||||||
public string CreatedStoreId { get; set; }
|
public string CreatedStoreId { get; set; }
|
||||||
@@ -27,11 +29,13 @@ namespace BTCPayServer.Controllers
|
|||||||
public UIUserStoresController(
|
public UIUserStoresController(
|
||||||
UserManager<ApplicationUser> userManager,
|
UserManager<ApplicationUser> userManager,
|
||||||
StoreRepository storeRepository,
|
StoreRepository storeRepository,
|
||||||
RateFetcher rateFactory)
|
RateFetcher rateFactory,
|
||||||
|
SettingsRepository settingsRepository)
|
||||||
{
|
{
|
||||||
_repo = storeRepository;
|
_repo = storeRepository;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_rateFactory = rateFactory;
|
_rateFactory = rateFactory;
|
||||||
|
_settingsRepository = settingsRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@@ -62,7 +66,7 @@ namespace BTCPayServer.Controllers
|
|||||||
var vm = new CreateStoreViewModel
|
var vm = new CreateStoreViewModel
|
||||||
{
|
{
|
||||||
IsFirstStore = !(stores.Any() || skipWizard),
|
IsFirstStore = !(stores.Any() || skipWizard),
|
||||||
DefaultCurrency = StoreBlob.StandardDefaultCurrency,
|
DefaultCurrency = (await _settingsRepository.GetSettingAsync<PoliciesSettings>())?.DefaultCurrency ?? StoreBlob.StandardDefaultCurrency,
|
||||||
Exchanges = GetExchangesSelectList(null)
|
Exchanges = GetExchangesSelectList(null)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ namespace BTCPayServer.Services
|
|||||||
|
|
||||||
[Display(Name = "Show plugins in pre-release")]
|
[Display(Name = "Show plugins in pre-release")]
|
||||||
public bool PluginPreReleases { get; set; }
|
public bool PluginPreReleases { get; set; }
|
||||||
|
[Display(Name = "Select the Default Currency during Store Creation")]
|
||||||
|
public string DefaultCurrency { get; set; }
|
||||||
|
|
||||||
public bool DisableSSHService { get; set; }
|
public bool DisableSSHService { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -185,6 +185,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4 class="mt-5">Customization</h4>
|
<h4 class="mt-5">Customization</h4>
|
||||||
|
<div class="form-group mb-3">
|
||||||
|
<label asp-for="DefaultCurrency" class="form-label"></label>
|
||||||
|
<input asp-for="DefaultCurrency" placeholder="Default Store Currency" class="form-control" currency-selection />
|
||||||
|
</div>
|
||||||
<div class="form-group mb-5">
|
<div class="form-group mb-5">
|
||||||
<label asp-for="RootAppId" class="form-label"></label>
|
<label asp-for="RootAppId" class="form-label"></label>
|
||||||
<select asp-for="RootAppId" asp-items="@(new SelectList(ViewBag.AppsList, nameof(SelectListItem.Value), nameof(SelectListItem.Text), Model.RootAppId))" class="form-select"></select>
|
<select asp-for="RootAppId" asp-items="@(new SelectList(ViewBag.AppsList, nameof(SelectListItem.Value), nameof(SelectListItem.Text), Model.RootAppId))" class="form-select"></select>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@using BTCPayServer.Configuration
|
@using BTCPayServer.Configuration
|
||||||
@inject BTCPayServerOptions _btcPayServerOptions
|
@inject BTCPayServerOptions _btcPayServerOptions
|
||||||
|
|
||||||
<div class="sticky-header mb-l">
|
<div class="sticky-header mb-l">
|
||||||
|
|||||||
Reference in New Issue
Block a user