コード例 #1
0
        public ActionResult Configure()
        {
            //load settings for a chosen store scope
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var manualPaymentSettings = _settingService.LoadSetting<ManualPaymentSettings>(storeScope);

            var model = new ConfigurationModel();
            model.TransactModeId = Convert.ToInt32(manualPaymentSettings.TransactMode);
            model.PaymentHostUrl = manualPaymentSettings.PaymentHostUrl.ToString();
            model.MerchantID = String.IsNullOrEmpty(manualPaymentSettings.MerchantID) ? "" : manualPaymentSettings.MerchantID.ToString();
            model.MerchantTerminalID = String.IsNullOrEmpty(manualPaymentSettings.MerchantTerminalID) ? "" : manualPaymentSettings.MerchantTerminalID.ToString();

            model.AdditionalFee = manualPaymentSettings.AdditionalFee;
            model.AdditionalFeePercentage = manualPaymentSettings.AdditionalFeePercentage;
            model.TransactModeValues = manualPaymentSettings.TransactMode.ToSelectList();

            model.ActiveStoreScopeConfiguration = storeScope;
            if (storeScope > 0)
            {
                model.TransactModeId_OverrideForStore = _settingService.SettingExists(manualPaymentSettings, x => x.TransactMode, storeScope);
                model.AdditionalFee_OverrideForStore = _settingService.SettingExists(manualPaymentSettings, x => x.AdditionalFee, storeScope);
                model.AdditionalFeePercentage_OverrideForStore = _settingService.SettingExists(manualPaymentSettings, x => x.AdditionalFeePercentage, storeScope);
            }

            return View("~/Plugins/Payments.Manual/Views/PaymentManual/Configure.cshtml", model);
        }
コード例 #2
0
        public ActionResult Configure(ConfigurationModel model)
        {
            if (!ModelState.IsValid)
                return Configure();

            //load settings for a chosen store scope
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var manualPaymentSettings = _settingService.LoadSetting<ManualPaymentSettings>(storeScope);

            //save settings
            manualPaymentSettings.TransactMode = (TransactMode)model.TransactModeId;
            manualPaymentSettings.AdditionalFee = model.AdditionalFee;
            manualPaymentSettings.AdditionalFeePercentage = model.AdditionalFeePercentage;

            /* We do not clear cache after each setting update.
             * This behavior can increase performance because cached settings will not be cleared 
             * and loaded from database after each update */

            _settingService.SaveSettingOverridablePerStore(manualPaymentSettings, x => x.TransactMode, model.TransactModeId_OverrideForStore, storeScope, false);
            _settingService.SaveSettingOverridablePerStore(manualPaymentSettings, x => x.AdditionalFee, model.AdditionalFee_OverrideForStore, storeScope, false);
            _settingService.SaveSettingOverridablePerStore(manualPaymentSettings, x => x.AdditionalFeePercentage, model.AdditionalFeePercentage_OverrideForStore, storeScope, false);
            
            //now clear settings cache
            _settingService.ClearCache();

            SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved"));

            return Configure();
        }
コード例 #3
0
        public ActionResult Configure()
        {
            var model = new ConfigurationModel();
            model.TransactModeId = Convert.ToInt32(_manualPaymentSettings.TransactMode);
            model.AdditionalFee = _manualPaymentSettings.AdditionalFee;
            model.TransactModeValues = _manualPaymentSettings.TransactMode.ToSelectList();

            return View("Nop.Plugin.Payments.Manual.Views.PaymentManual.Configure", model);
        }
コード例 #4
0
        public ActionResult Configure(ConfigurationModel model)
        {
            if (!ModelState.IsValid)
                return Configure();

            //save settings
            _manualPaymentSettings.TransactMode = (TransactMode)model.TransactModeId;
            _manualPaymentSettings.AdditionalFee = model.AdditionalFee;
            _settingService.SaveSetting(_manualPaymentSettings);

            model.TransactModeValues = _manualPaymentSettings.TransactMode.ToSelectList();

            return View("Nop.Plugin.Payments.Manual.Views.PaymentManual.Configure", model);
        }
コード例 #5
0
        public ActionResult Configure()
        {
            //load settings for a chosen store scope
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var manualPaymentSettings = _settingService.LoadSetting<ManualPaymentSettings>(storeScope);

            var model = new ConfigurationModel();
            model.TransactModeId = Convert.ToInt32(manualPaymentSettings.TransactMode);
            model.AdditionalFee = manualPaymentSettings.AdditionalFee;
            model.AdditionalFeePercentage = manualPaymentSettings.AdditionalFeePercentage;
            model.TransactModeValues = manualPaymentSettings.TransactMode.ToSelectList();

            model.ActiveStoreScopeConfiguration = storeScope;
            if (storeScope > 0)
            {
                model.TransactModeId_OverrideForStore = _settingService.SettingExists(manualPaymentSettings, x => x.TransactMode, storeScope);
                model.AdditionalFee_OverrideForStore = _settingService.SettingExists(manualPaymentSettings, x => x.AdditionalFee, storeScope);
                model.AdditionalFeePercentage_OverrideForStore = _settingService.SettingExists(manualPaymentSettings, x => x.AdditionalFeePercentage, storeScope);
            }

            return View("Nop.Plugin.Payments.Manual.Views.PaymentManual.Configure", model);
        }