public ActionResult Configure() { //load settings for a chosen store scope var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext); var payPalStandardPaymentSettings = _settingService.LoadSetting<PayPalStandardPaymentSettings>(storeScope); var model = new ConfigurationModel(); model.UseSandbox = payPalStandardPaymentSettings.UseSandbox; model.BusinessEmail = payPalStandardPaymentSettings.BusinessEmail; model.PdtToken = payPalStandardPaymentSettings.PdtToken; model.PdtValidateOrderTotal = payPalStandardPaymentSettings.PdtValidateOrderTotal; model.AdditionalFee = payPalStandardPaymentSettings.AdditionalFee; model.AdditionalFeePercentage = payPalStandardPaymentSettings.AdditionalFeePercentage; model.PassProductNamesAndTotals = payPalStandardPaymentSettings.PassProductNamesAndTotals; model.EnableIpn = payPalStandardPaymentSettings.EnableIpn; model.IpnUrl = payPalStandardPaymentSettings.IpnUrl; model.ActiveStoreScopeConfiguration = storeScope; if (storeScope > 0) { model.UseSandbox_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.UseSandbox, storeScope); model.BusinessEmail_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.BusinessEmail, storeScope); model.PdtToken_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.PdtToken, storeScope); model.PdtValidateOrderTotal_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.PdtValidateOrderTotal, storeScope); model.AdditionalFee_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.AdditionalFee, storeScope); model.AdditionalFeePercentage_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.AdditionalFeePercentage, storeScope); model.PassProductNamesAndTotals_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.PassProductNamesAndTotals, storeScope); model.EnableIpn_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.EnableIpn, storeScope); model.IpnUrl_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.IpnUrl, storeScope); } return View("Nop.Plugin.Payments.PayPalStandard.Views.PaymentPayPalStandard.Configure", model); }
public ActionResult Configure() { var model = new ConfigurationModel(); model.UseSandbox = _paypalStandardPaymentSettings.UseSandbox; model.BusinessEmail = _paypalStandardPaymentSettings.BusinessEmail; model.PdtToken = _paypalStandardPaymentSettings.PdtToken; model.PdtValidateOrderTotal = _paypalStandardPaymentSettings.PdtValidateOrderTotal; model.AdditionalFee = _paypalStandardPaymentSettings.AdditionalFee; model.PassProductNamesAndTotals = _paypalStandardPaymentSettings.PassProductNamesAndTotals; model.EnableIpn = _paypalStandardPaymentSettings.EnableIpn; model.IpnUrl = _paypalStandardPaymentSettings.IpnUrl; return View("Nop.Plugin.Payments.PayPalStandard.Views.PaymentPayPalStandard.Configure", model); }
public ActionResult Configure(ConfigurationModel model) { if (!ModelState.IsValid) return Configure(); //save settings _paypalStandardPaymentSettings.UseSandbox = model.UseSandbox; _paypalStandardPaymentSettings.BusinessEmail = model.BusinessEmail; _paypalStandardPaymentSettings.PdtToken = model.PdtToken; _paypalStandardPaymentSettings.PdtValidateOrderTotal = model.PdtValidateOrderTotal; _paypalStandardPaymentSettings.AdditionalFee = model.AdditionalFee; _paypalStandardPaymentSettings.PassProductNamesAndTotals = model.PassProductNamesAndTotals; _paypalStandardPaymentSettings.EnableIpn = model.EnableIpn; _paypalStandardPaymentSettings.IpnUrl = model.IpnUrl; _settingService.SaveSetting(_paypalStandardPaymentSettings); return View("Nop.Plugin.Payments.PayPalStandard.Views.PaymentPayPalStandard.Configure", model); }
public ActionResult Configure(ConfigurationModel model) { if (!ModelState.IsValid) return Configure(); //load settings for a chosen store scope var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext); var payPalStandardPaymentSettings = _settingService.LoadSetting<PayPalStandardPaymentSettings>(storeScope); //save settings payPalStandardPaymentSettings.UseSandbox = model.UseSandbox; payPalStandardPaymentSettings.BusinessEmail = model.BusinessEmail; payPalStandardPaymentSettings.PdtToken = model.PdtToken; payPalStandardPaymentSettings.PdtValidateOrderTotal = model.PdtValidateOrderTotal; payPalStandardPaymentSettings.AdditionalFee = model.AdditionalFee; payPalStandardPaymentSettings.AdditionalFeePercentage = model.AdditionalFeePercentage; payPalStandardPaymentSettings.PassProductNamesAndTotals = model.PassProductNamesAndTotals; payPalStandardPaymentSettings.EnableIpn = model.EnableIpn; payPalStandardPaymentSettings.IpnUrl = model.IpnUrl; payPalStandardPaymentSettings.AddressOverride = model.AddressOverride; payPalStandardPaymentSettings.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage = model.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage; /* 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 */ if (model.UseSandbox_OverrideForStore || storeScope == 0) _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.UseSandbox, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.UseSandbox, storeScope); if (model.BusinessEmail_OverrideForStore || storeScope == 0) _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.BusinessEmail, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.BusinessEmail, storeScope); if (model.PdtToken_OverrideForStore || storeScope == 0) _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.PdtToken, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.PdtToken, storeScope); if (model.PdtValidateOrderTotal_OverrideForStore || storeScope == 0) _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.PdtValidateOrderTotal, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.PdtValidateOrderTotal, storeScope); if (model.AdditionalFee_OverrideForStore || storeScope == 0) _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.AdditionalFee, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.AdditionalFee, storeScope); if (model.AdditionalFeePercentage_OverrideForStore || storeScope == 0) _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.AdditionalFeePercentage, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.AdditionalFeePercentage, storeScope); if (model.PassProductNamesAndTotals_OverrideForStore || storeScope == 0) _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.PassProductNamesAndTotals, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.PassProductNamesAndTotals, storeScope); if (model.EnableIpn_OverrideForStore || storeScope == 0) _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.EnableIpn, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.EnableIpn, storeScope); if (model.IpnUrl_OverrideForStore || storeScope == 0) _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.IpnUrl, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.IpnUrl, storeScope); if (model.AddressOverride_OverrideForStore || storeScope == 0) _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.AddressOverride, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.AddressOverride, storeScope); if (model.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage_OverrideForStore || storeScope == 0) _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage, storeScope); //now clear settings cache _settingService.ClearCache(); SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved")); return Configure(); }
public ActionResult Configure() { //load settings for a chosen store scope var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext); var payPalStandardPaymentSettings = _settingService.LoadSetting<PayPalStandardPaymentSettings>(storeScope); var model = new ConfigurationModel(); model.UseSandbox = payPalStandardPaymentSettings.UseSandbox; model.BusinessEmail = payPalStandardPaymentSettings.BusinessEmail; model.PdtToken = payPalStandardPaymentSettings.PdtToken; model.PdtValidateOrderTotal = payPalStandardPaymentSettings.PdtValidateOrderTotal; model.AdditionalFee = payPalStandardPaymentSettings.AdditionalFee; model.AdditionalFeePercentage = payPalStandardPaymentSettings.AdditionalFeePercentage; model.PassProductNamesAndTotals = payPalStandardPaymentSettings.PassProductNamesAndTotals; model.EnableIpn = payPalStandardPaymentSettings.EnableIpn; model.IpnUrl = payPalStandardPaymentSettings.IpnUrl; model.AddressOverride = payPalStandardPaymentSettings.AddressOverride; model.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage = payPalStandardPaymentSettings.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage; model.AddressOverride = payPalStandardPaymentSettings.AddressOverride; model.SelectShippingAddressMode = payPalStandardPaymentSettings.SelectShippingAddressMode; model.ActiveStoreScopeConfiguration = storeScope; if (storeScope > 0) { model.UseSandbox_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.UseSandbox, storeScope); model.BusinessEmail_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.BusinessEmail, storeScope); model.PdtToken_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.PdtToken, storeScope); model.PdtValidateOrderTotal_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.PdtValidateOrderTotal, storeScope); model.AdditionalFee_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.AdditionalFee, storeScope); model.AdditionalFeePercentage_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.AdditionalFeePercentage, storeScope); model.PassProductNamesAndTotals_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.PassProductNamesAndTotals, storeScope); model.EnableIpn_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.EnableIpn, storeScope); model.IpnUrl_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.IpnUrl, storeScope); model.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage, storeScope); model.AddressOverride_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.AddressOverride, storeScope); model.SelectShippingAddressMod_OverrideForStore = _settingService.SettingExists(payPalStandardPaymentSettings, x => x.SelectShippingAddressMode, storeScope); } model.AddressModes.Add(new SelectListItem() { Text = "Optional", Value = "0" }); model.AddressModes.Add(new SelectListItem() { Text = "Do not prompt", Value = "1" }); model.AddressModes.Add(new SelectListItem() { Text = "Required", Value = "3" }); return View("~/Plugins/Payments.PayPalStandard/Views/PaymentPayPalStandard/Configure.cshtml", model); }