Exemple #1
0
        public ActionResult Configure(ConfigurationModel 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 <AmazonPaySettings>(storeScope);

            model.Copy(settings, false);

            using (_services.Settings.BeginScope())
            {
                storeDependingSettingHelper.UpdateSettings(settings, form, storeScope, _services.Settings);

                _services.Settings.SaveSetting(settings, x => x.DataFetching, 0, false);
                _services.Settings.SaveSetting(settings, x => x.PollingMaxOrderCreationDays, 0, false);
            }

            _apiService.DataPollingTaskUpdate(settings.DataFetching == AmazonPayDataFetchingType.Polling, model.PollingTaskMinutes * 60);

            NotifySuccess(_services.Localization.GetResource("Plugins.Payments.AmazonPay.ConfigSaveNote"));

            return(Configure());
        }
        public ActionResult Configure(ConfigurationModel model, FormCollection form)
        {
            if (!ModelState.IsValid)
            {
                return(Configure());
            }



            if (!ModelState.IsValid)
            {
                return(Configure());
            }

            ModelState.Clear();

            var siteDependingSettingHelper = new SiteDependingSettingHelper(ViewData);
            int siteScope = this.GetActiveSiteScopeConfiguration(_siteService, _services.WorkContext);
            var settings  = _services.Settings.LoadSetting <AliPayPaymentSettings>(siteScope);

            model.Copy(settings, false);

            siteDependingSettingHelper.UpdateSettings(settings, form, siteScope, _services.Settings);


            _services.Settings.SaveSetting(settings, 0);

            _services.Settings.ClearCache();

            NotifySuccess(_services.Localization.GetResource("Plugins.Payments.AliPay.ConfigSaveNote"));
            return(Configure());
        }
Exemple #3
0
        public ActionResult Configure()
        {
            var settings = Services.Settings.LoadSetting <ShopConnectorSettings>();

            var model = new ConfigurationModel();

            model.SelectedTab = TempData["SelectedTab"] as string;
            model.Copy(settings, true);

            _connectorService.SetupConfiguration(model);

            return(View(model));
        }
        public ActionResult Configure()
        {
            var model = new ConfigurationModel();

            int siteScope = this.GetActiveSiteScopeConfiguration(_siteService, _services.WorkContext);
            var settings  = _services.Settings.LoadSetting <AliPayPaymentSettings>(siteScope);

            model.Copy(settings, true);

            var siteDependingSettingHelper = new SiteDependingSettingHelper(ViewData);

            siteDependingSettingHelper.GetOverrideKeys(settings, model, siteScope, _services.Settings);

            return(View(model));
        }
Exemple #5
0
        public ActionResult Configure()
        {
            var model      = new ConfigurationModel();
            int storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _services.WorkContext);
            var settings   = _services.Settings.LoadSetting <AmazonPaySettings>(storeScope);

            model.Copy(settings, true);

            _apiService.SetupConfiguration(model);

            var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);

            storeDependingSettingHelper.GetOverrideKeys(settings, model, storeScope, _services.Settings);

            return(View(model));
        }
Exemple #6
0
        public ActionResult Configure(ConfigurationModel model, FormCollection form)
        {
            if (!ModelState.IsValid)
            {
                return(Configure());
            }

            var settings = Services.Settings.LoadSetting <ShopConnectorSettings>();

            model.Copy(settings, false);

            Services.Settings.SaveSetting(settings);
            ConnectionCache.Remove();

            NotifySuccess(T("Admin.Common.DataSuccessfullySaved"));
            return(Configure());
        }
Exemple #7
0
        public void Copy_DifferentInstanceWithSameValues()
        {
            // Arrange
            var model = new ConfigurationModel
            {
                ArtifactsPath                           = "TestPath1",
                PublishProfilePath                      = "TestPath2",
                SharedDacpacRepositoryPath              = "C:\\Temp\\Repository\\",
                ReplaceUnnamedDefaultConstraintDrops    = true,
                VersionPattern                          = "TestPattern",
                CommentOutUnnamedDefaultConstraintDrops = true,
                CreateDocumentationWithScriptCreation   = true,
                CustomHeader = "TestHeader",
                CustomFooter = "TestFooter",
                BuildBeforeScriptCreation = true,
                TrackDacpacVersion        = true,
                RemoveSqlCmdStatements    = true,
                DeleteRefactorlogAfterVersionedScriptGeneration = true,
                DeleteLatestAfterVersionedScriptGeneration      = true
            };

            // Act
            var copy = model.Copy();

            // Assert
            Assert.IsNotNull(copy);
            Assert.AreNotSame(model, copy);
            Assert.AreEqual(model.ArtifactsPath, copy.ArtifactsPath);
            Assert.AreEqual(model.PublishProfilePath, copy.PublishProfilePath);
            Assert.AreEqual(model.SharedDacpacRepositoryPath, copy.SharedDacpacRepositoryPath);
            Assert.AreEqual(model.ReplaceUnnamedDefaultConstraintDrops, copy.ReplaceUnnamedDefaultConstraintDrops);
            Assert.AreEqual(model.VersionPattern, copy.VersionPattern);
            Assert.AreEqual(model.CommentOutUnnamedDefaultConstraintDrops, copy.CommentOutUnnamedDefaultConstraintDrops);
            Assert.AreEqual(model.CreateDocumentationWithScriptCreation, copy.CreateDocumentationWithScriptCreation);
            Assert.AreEqual(model.CustomHeader, copy.CustomHeader);
            Assert.AreEqual(model.CustomFooter, copy.CustomFooter);
            Assert.AreEqual(model.BuildBeforeScriptCreation, copy.BuildBeforeScriptCreation);
            Assert.AreEqual(model.TrackDacpacVersion, copy.TrackDacpacVersion);
            Assert.AreEqual(model.RemoveSqlCmdStatements, copy.RemoveSqlCmdStatements);
        }
Exemple #8
0
        public ActionResult Configure(ConfigurationModel model, FormCollection form)
        {
            if (!ModelState.IsValid)
            {
                return(Configure());
            }

            ModelState.Clear();

            var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);
            var storeScope = this.GetActiveStoreScopeConfiguration(Services.StoreService, Services.WorkContext);
            var settings   = Services.Settings.LoadSetting <AmazonPaySettings>(storeScope);

            model.Copy(settings, false);

            using (Services.Settings.BeginScope())
            {
                storeDependingSettingHelper.UpdateSettings(settings, form, storeScope, Services.Settings);

                Services.Settings.SaveSetting(settings, x => x.DataFetching, 0, false);
                Services.Settings.SaveSetting(settings, x => x.PollingMaxOrderCreationDays, 0, false);
            }

            var task = _scheduleTaskService.Value.GetTaskByType <DataPollingTask>();

            if (task != null)
            {
                task.Enabled = settings.DataFetching == AmazonPayDataFetchingType.Polling;

                _scheduleTaskService.Value.UpdateTask(task);
            }

            NotifySuccess(Services.Localization.GetResource("Plugins.Payments.AmazonPay.ConfigSaveNote"));

            return(Configure());
        }