Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Admin panel - allow to manager payment settings by store (Active by Store / Payment Settings by store)
KrzysztofPajakb6c904ce617c
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Index.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Index.cshtmlindex 1e11702ce..9ff4015b8 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Index.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Index.cshtml@@ -12,6 +12,13 @@@Loc["Admin.Configuration.Payment.Methods"]</div></div>+ <div class="x_content">+ <div class="form-horizontal">+ <div class="form-body">+ @await Component.InvokeAsync("StoreScope")+ </div>+ </div>+ </div><div class="x_content form"><vc:admin-widget widget-zone="payment_method_list_top" additional-data="Model" /><div id="paymentmethods-grid"></div>diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Settings.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Settings.cshtmlindex b4ce446f5..aebb7e4ff 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Settings.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Settings.cshtml@@ -22,6 +22,13 @@</div><vc:admin-widget widget-zone="payment_settings_buttons" additional-data="null" /></div>+ <div class="x_content">+ <div class="form-horizontal">+ <div class="form-body">+ @await Component.InvokeAsync("StoreScope")+ </div>+ </div>+ </div><div class="x_content form"><vc:admin-widget widget-zone="payment_settings_top" additional-data="null" /><div class="form-horizontal">diff --git a/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs b/src/Web/Grand.Web.Admin/Controllers/PaymentController.csindex 1991fbd43..e16b3e6c8 100644--- a/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs@@ -30,7 +30,6 @@ namespace Grand.Web.Admin.Controllersprivate readonly IPaymentService _paymentService;private readonly ISettingService _settingService;private readonly ICountryService _countryService;- private readonly IGroupService _groupService;private readonly IShippingMethodService _shippingMethodService;private readonly ITranslationService _translationService;private readonly IServiceProvider _serviceProvider;@@ -43,7 +42,6 @@ namespace Grand.Web.Admin.Controllerspublic PaymentController(IPaymentService paymentService,ISettingService settingService,ICountryService countryService,- IGroupService groupService,IShippingMethodService shippingMethodService,ITranslationService translationService,IServiceProvider serviceProvider,@@ -52,7 +50,6 @@ namespace Grand.Web.Admin.Controllers_paymentService = paymentService;_settingService = settingService;_countryService = countryService;- _groupService = groupService;_shippingMethodService = shippingMethodService;_translationService = translationService;_serviceProvider = serviceProvider;@@ -68,7 +65,9 @@ namespace Grand.Web.Admin.Controllers[HttpPost]public async Task<IActionResult> Methods(){- var _paymentSettings = _settingService.LoadSetting<PaymentSettings>();+ var storeScope = await GetActiveStore();++ var _paymentSettings = _settingService.LoadSetting<PaymentSettings>(storeScope);var paymentMethodsModel = new List<PaymentMethodModel>();var paymentMethods = _paymentService.LoadAllPaymentMethods();@@ -100,7 +99,8 @@ namespace Grand.Web.Admin.Controllers[HttpPost]public async Task<IActionResult> MethodUpdate(PaymentMethodModel model){- var _paymentSettings = _settingService.LoadSetting<PaymentSettings>();+ var storeScope = await GetActiveStore();+ var _paymentSettings = _settingService.LoadSetting<PaymentSettings>(storeScope);var pm = _paymentService.LoadPaymentMethodBySystemName(model.SystemName);if (pm.IsPaymentMethodActive(_paymentSettings))@@ -109,7 +109,7 @@ namespace Grand.Web.Admin.Controllers{//mark as disabled_paymentSettings.ActivePaymentProviderSystemNames.Remove(pm.SystemName);- await _settingService.SaveSetting(_paymentSettings);+ await _settingService.SaveSetting(_paymentSettings, storeScope);}}else@@ -118,7 +118,7 @@ namespace Grand.Web.Admin.Controllers{//mark as active_paymentSettings.ActivePaymentProviderSystemNames.Add(pm.SystemName);- await _settingService.SaveSetting(_paymentSettings);+ await _settingService.SaveSetting(_paymentSettings, storeScope);}}@@ -135,7 +135,7 @@ namespace Grand.Web.Admin.Controllersvar model = await pm.ToModel();//TODO/*- model.LogoUrl = pm.PluginInfo.GetLogoUrl(_webHelper);+ model.LogoUrl = "";*/model.ConfigurationUrl = pm.ConfigurationUrl;return View(model);@@ -236,9 +236,11 @@ namespace Grand.Web.Admin.Controllers#region Shipping Settings- public IActionResult Settings()+ public async Task<IActionResult> Settings(){- var paymentSettings = _settingService.LoadSetting<PaymentSettings>();+ var storeScope = await GetActiveStore();++ var paymentSettings = _settingService.LoadSetting<PaymentSettings>(storeScope);var model = paymentSettings.ToModel();return View(model);@@ -247,10 +249,12 @@ namespace Grand.Web.Admin.Controllerspublic async Task<IActionResult> Settings(PaymentSettingsModel model,[FromServices] ICustomerActivityService customerActivityService){- var paymentSettings = _settingService.LoadSetting<PaymentSettings>();+ var storeScope = await GetActiveStore();++ var paymentSettings = _settingService.LoadSetting<PaymentSettings>(storeScope);paymentSettings = model.ToEntity(paymentSettings);- await _settingService.SaveSetting(paymentSettings);+ await _settingService.SaveSetting(paymentSettings, storeScope);//activity log_ = customerActivityService.InsertActivity("EditSettings", "",