public ActionResult Configure()
        {
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var secureSubmitPaymentSettings = _settingService.LoadSetting<SecureSubmitPaymentSettings>(storeScope);

            var model = new ConfigurationModel();

            model.TransactModeId = Convert.ToInt32(secureSubmitPaymentSettings.TransactMode);
            model.PublicApiKey = secureSubmitPaymentSettings.PublicApiKey;
            model.SecretApiKey = secureSubmitPaymentSettings.SecretApiKey;
            model.AdditionalFee = secureSubmitPaymentSettings.AdditionalFee;
            model.AdditionalFeePercentage = secureSubmitPaymentSettings.AdditionalFeePercentage;
            model.TransactModeValues = secureSubmitPaymentSettings.TransactMode.ToSelectList();

            model.ActiveStoreScopeConfiguration = storeScope;
            if (storeScope > 0)
            {
                model.TransactModeId_OverrideForStore = _settingService.SettingExists(secureSubmitPaymentSettings, x => x.TransactMode, storeScope);
                model.PublicApiKey_OverrideForStore = _settingService.SettingExists(secureSubmitPaymentSettings, x => x.PublicApiKey, storeScope);
                model.SecretApiKey_OverrideForStore = _settingService.SettingExists(secureSubmitPaymentSettings, x => x.SecretApiKey, storeScope);
                model.AdditionalFee_OverrideForStore = _settingService.SettingExists(secureSubmitPaymentSettings, x => x.AdditionalFee, storeScope);
                model.AdditionalFeePercentage_OverrideForStore = _settingService.SettingExists(secureSubmitPaymentSettings, x => x.AdditionalFeePercentage, storeScope);
            }

            return View("~/Plugins/Payments.SecureSubmit/Views/PaymentSecureSubmit/Configure.cshtml", model);
        }
        public ActionResult Configure(ConfigurationModel model)
        {
            if (!ModelState.IsValid)
                return Configure();

            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var secureSubmitPaymentSettings = _settingService.LoadSetting<SecureSubmitPaymentSettings>(storeScope);

            //save settings
            secureSubmitPaymentSettings.TransactMode = (TransactMode)model.TransactModeId;
            secureSubmitPaymentSettings.PublicApiKey = model.PublicApiKey;
            secureSubmitPaymentSettings.SecretApiKey = model.SecretApiKey;
            secureSubmitPaymentSettings.AdditionalFee = model.AdditionalFee;
            secureSubmitPaymentSettings.AdditionalFeePercentage = model.AdditionalFeePercentage;

            if (model.TransactModeId_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(secureSubmitPaymentSettings, x => x.TransactMode, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(secureSubmitPaymentSettings, x => x.TransactMode, storeScope);

            if (model.PublicApiKey_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(secureSubmitPaymentSettings, x => x.PublicApiKey, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(secureSubmitPaymentSettings, x => x.PublicApiKey, storeScope);

            if (model.SecretApiKey_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(secureSubmitPaymentSettings, x => x.SecretApiKey, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(secureSubmitPaymentSettings, x => x.SecretApiKey, storeScope);

            if (model.AdditionalFee_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(secureSubmitPaymentSettings, x => x.AdditionalFee, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(secureSubmitPaymentSettings, x => x.AdditionalFee, storeScope);

            if (model.AdditionalFeePercentage_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(secureSubmitPaymentSettings, x => x.AdditionalFeePercentage, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(secureSubmitPaymentSettings, x => x.AdditionalFeePercentage, storeScope);

            _settingService.ClearCache();

            return Configure();
        }