public ActionResult Configure(PayPalDirectConfigurationModel model, FormCollection form) { var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData); var storeScope = this.GetActiveStoreScopeConfiguration(Services.StoreService, Services.WorkContext); var settings = Services.Settings.LoadSetting <PayPalDirectPaymentSettings>(storeScope); if (!ModelState.IsValid) { return(Configure(settings, storeScope)); } ModelState.Clear(); model.Copy(settings, false); using (Services.Settings.BeginScope()) { storeDependingSettingHelper.UpdateSettings(settings, form, storeScope, Services.Settings); } using (Services.Settings.BeginScope()) { // Multistore context not possible, see IPN handling. Services.Settings.SaveSetting(settings, x => x.UseSandbox, 0, false); } NotifySuccess(T("Admin.Common.DataSuccessfullySaved")); return(RedirectToConfiguration(PayPalDirectProvider.SystemName, false)); }
public ActionResult Configure(PayPalDirectConfigurationModel model, FormCollection form) { if (!ModelState.IsValid) { return(Configure()); } ModelState.Clear(); var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData); int storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _services.WorkContext); var settings = _services.Settings.LoadSetting <PayPalDirectPaymentSettings>(storeScope); model.Copy(settings, false); storeDependingSettingHelper.UpdateSettings(settings, form, storeScope, _services.Settings); // multistore context not possible, see IPN handling _services.Settings.SaveSetting(settings, x => x.UseSandbox, 0, false); _services.Settings.ClearCache(); NotifySuccess(_services.Localization.GetResource("Plugins.Payments.PayPal.ConfigSaveNote")); return(Configure()); }
public ActionResult Configure(PayPalDirectPaymentSettings settings, int storeScope) { var model = new PayPalDirectConfigurationModel(); model.Copy(settings, true); PrepareConfigurationModel(model, storeScope); return(View(model)); }
public ActionResult Configure() { var model = new PayPalDirectConfigurationModel(); int storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _services.WorkContext); var settings = _services.Settings.LoadSetting <PayPalDirectPaymentSettings>(storeScope); model.Copy(settings, true); model.TransactModeValues = TransactModeValues(settings.TransactMode); var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData); storeDependingSettingHelper.GetOverrideKeys(settings, model, storeScope, _services.Settings); return(View(model)); }
public ActionResult Configure() { var model = new PayPalDirectConfigurationModel(); int storeScope = this.GetActiveStoreScopeConfiguration(Services.StoreService, Services.WorkContext); var settings = Services.Settings.LoadSetting<PayPalDirectPaymentSettings>(storeScope); model.Copy(settings, true); model.TransactModeValues = TransactModeValues(settings.TransactMode); model.AvailableSecurityProtocols = GetSecurityProtocols() .Select(x => new SelectListItem { Value = ((int)x.Key).ToString(), Text = x.Value }) .ToList(); var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData); storeDependingSettingHelper.GetOverrideKeys(settings, model, storeScope, Services.Settings); return View(model); }
public ActionResult Configure(PayPalDirectConfigurationModel model, FormCollection form) { if (!ModelState.IsValid) return Configure(); ModelState.Clear(); var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData); int storeScope = this.GetActiveStoreScopeConfiguration(Services.StoreService, Services.WorkContext); var settings = Services.Settings.LoadSetting<PayPalDirectPaymentSettings>(storeScope); model.Copy(settings, false); storeDependingSettingHelper.UpdateSettings(settings, form, storeScope, Services.Settings); // multistore context not possible, see IPN handling Services.Settings.SaveSetting(settings, x => x.UseSandbox, 0, false); Services.Settings.ClearCache(); NotifySuccess(T("Admin.Common.DataSuccessfullySaved")); return Configure(); }