public ActionResult PaymentInfo()
        {
            SamplePaymentServicePaymentSettings settings = this._settingService.LoadSetting <SamplePaymentServicePaymentSettings>(this._storeContext.CurrentStore.Id);
            PaymentInfoModel model = new PaymentInfoModel
            {
                DescriptionText = settings.DescriptionText
            };

            return(base.View("Nop.Plugin.Payments.SamplePaymentService.Views.PaymentSamplePaymentService.PaymentInfo", model));
        }
        public ActionResult Configure()
        {
            int storeId = this.GetActiveStoreScopeConfiguration(this._storeService, this._workContext);
            SamplePaymentServicePaymentSettings settings = this._settingService.LoadSetting <SamplePaymentServicePaymentSettings>(storeId);
            ConfigurationModel model = new ConfigurationModel
            {
                DescriptionText               = settings.DescriptionText,
                AdditionalFee                 = settings.AdditionalFee,
                AdditionalFeePercentage       = settings.AdditionalFeePercentage,
                ActiveStoreScopeConfiguration = storeId
            };

            if (storeId > 0)
            {
                model.DescriptionText_OverrideForStore         = this._settingService.SettingExists <SamplePaymentServicePaymentSettings, string>(settings, x => x.DescriptionText, storeId);
                model.AdditionalFee_OverrideForStore           = this._settingService.SettingExists <SamplePaymentServicePaymentSettings, decimal>(settings, x => x.AdditionalFee, storeId);
                model.AdditionalFeePercentage_OverrideForStore = this._settingService.SettingExists <SamplePaymentServicePaymentSettings, bool>(settings, x => x.AdditionalFeePercentage, storeId);
            }
            return(base.View("Nop.Plugin.Payments.SamplePaymentService.Views.PaymentSamplePaymentService.Configure", model));
        }
 public ActionResult Configure(ConfigurationModel model)
 {
     if (base.ModelState.IsValid)
     {
         int storeId = this.GetActiveStoreScopeConfiguration(this._storeService, this._workContext);
         SamplePaymentServicePaymentSettings settings = this._settingService.LoadSetting <SamplePaymentServicePaymentSettings>(storeId);
         settings.DescriptionText         = model.DescriptionText;
         settings.AdditionalFee           = model.AdditionalFee;
         settings.AdditionalFeePercentage = model.AdditionalFeePercentage;
         if (model.DescriptionText_OverrideForStore || (storeId == 0))
         {
             this._settingService.SaveSetting <SamplePaymentServicePaymentSettings, string>(settings, x => x.DescriptionText, storeId, false);
         }
         else if (storeId > 0)
         {
             this._settingService.DeleteSetting <SamplePaymentServicePaymentSettings, string>(settings, x => x.DescriptionText, storeId);
         }
         if (model.AdditionalFee_OverrideForStore || (storeId == 0))
         {
             this._settingService.SaveSetting <SamplePaymentServicePaymentSettings, decimal>(settings, x => x.AdditionalFee, storeId, false);
         }
         else if (storeId > 0)
         {
             this._settingService.DeleteSetting <SamplePaymentServicePaymentSettings, decimal>(settings, x => x.AdditionalFee, storeId);
         }
         if (model.AdditionalFeePercentage_OverrideForStore || (storeId == 0))
         {
             this._settingService.SaveSetting <SamplePaymentServicePaymentSettings, bool>(settings, x => x.AdditionalFeePercentage, storeId, false);
         }
         else if (storeId > 0)
         {
             this._settingService.DeleteSetting <SamplePaymentServicePaymentSettings, bool>(settings, x => x.AdditionalFeePercentage, storeId);
         }
         this._settingService.ClearCache();
     }
     return(this.Configure());
 }