Ejemplo n.º 1
0
 public PayPalDirectPaymentProcessor(PayPalDirectPaymentSettings paypalDirectPaymentSettings,
                                     ISettingService settingService,
                                     ICurrencyService currencyService, ICustomerService customerService,
                                     CurrencySettings currencySettings, IWebHelper webHelper,
                                     IOrderTotalCalculationService orderTotalCalculationService)
 {
     this._paypalDirectPaymentSettings = paypalDirectPaymentSettings;
     this._settingService               = settingService;
     this._currencyService              = currencyService;
     this._customerService              = customerService;
     this._currencySettings             = currencySettings;
     this._webHelper                    = webHelper;
     this._orderTotalCalculationService = orderTotalCalculationService;
 }
 public PayPalDirectPaymentProcessor(PayPalDirectPaymentSettings paypalDirectPaymentSettings,
     ISettingService settingService,
     ICurrencyService currencyService, ICustomerService customerService,
     CurrencySettings currencySettings, IWebHelper webHelper,
     IOrderTotalCalculationService orderTotalCalculationService)
 {
     this._paypalDirectPaymentSettings = paypalDirectPaymentSettings;
     this._settingService = settingService;
     this._currencyService = currencyService;
     this._customerService = customerService;
     this._currencySettings = currencySettings;
     this._webHelper = webHelper;
     this._orderTotalCalculationService = orderTotalCalculationService;
 }
Ejemplo n.º 3
0
 public PayPalDirectPaymentProcessor(CurrencySettings currencySettings,
                                     ICurrencyService currencyService,
                                     ICustomerService customerService,
                                     IOrderTotalCalculationService orderTotalCalculationService,
                                     ISettingService settingService,
                                     IStoreContext storeContext,
                                     PayPalDirectPaymentSettings paypalDirectPaymentSettings)
 {
     this._currencySettings             = currencySettings;
     this._currencyService              = currencyService;
     this._customerService              = customerService;
     this._orderTotalCalculationService = orderTotalCalculationService;
     this._settingService = settingService;
     this._storeContext   = storeContext;
     this._paypalDirectPaymentSettings = paypalDirectPaymentSettings;
 }
Ejemplo n.º 4
0
 public PayPalDirectPaymentProcessor(PayPalDirectPaymentSettings paypalDirectPaymentSettings,
                                     ISettingService settingService,
                                     ITaxService taxService, IPriceCalculationService priceCalculationService,
                                     ICurrencyService currencyService,
                                     CurrencySettings currencySettings, IWebHelper webHelper,
                                     StoreInformationSettings storeInformationSettings)
 {
     this._paypalDirectPaymentSettings = paypalDirectPaymentSettings;
     this._settingService          = settingService;
     this._taxService              = taxService;
     this._priceCalculationService = priceCalculationService;
     this._currencyService         = currencyService;
     this._currencySettings        = currencySettings;
     this._webHelper = webHelper;
     this._storeInformationSettings = storeInformationSettings;
 }
 public PayPalDirectPaymentProcessor(PayPalDirectPaymentSettings paypalDirectPaymentSettings,
     ISettingService settingService,
     ITaxService taxService, IPriceCalculationService priceCalculationService,
     ICurrencyService currencyService,
     CurrencySettings currencySettings, IWebHelper webHelper,
     StoreInformationSettings storeInformationSettings)
 {
     this._paypalDirectPaymentSettings = paypalDirectPaymentSettings;
     this._settingService = settingService;
     this._taxService = taxService;
     this._priceCalculationService = priceCalculationService;
     this._currencyService = currencyService;
     this._currencySettings = currencySettings;
     this._webHelper = webHelper;
     this._storeInformationSettings = storeInformationSettings;
 }
        /// <summary>
        /// Get PayPal Api context
        /// </summary>
        /// <param name="paypalDirectPaymentSettings">PayPalDirectPayment settings</param>
        /// <returns>ApiContext</returns>
        public static APIContext GetApiContext(PayPalDirectPaymentSettings payPalDirectPaymentSettings)
        {
            var mode = payPalDirectPaymentSettings.UseSandbox ? "sandbox" : "live";

            var config = new Dictionary <string, string>
            {
                { "clientId", payPalDirectPaymentSettings.ClientId },
                { "clientSecret", payPalDirectPaymentSettings.ClientSecret },
                { "mode", mode }
            };

            var accessToken = new OAuthTokenCredential(config).GetAccessToken();
            var apiContext  = new APIContext(accessToken)
            {
                Config = config
            };

            return(apiContext);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Get PayPal Api context
        /// </summary>
        /// <param name="paypalDirectPaymentSettings">PayPalDirectPayment settings</param>
        /// <returns>ApiContext</returns>
        public static APIContext GetApiContext(PayPalDirectPaymentSettings payPalDirectPaymentSettings)
        {
            var mode = !payPalDirectPaymentSettings.UseSandbox ? "live"
                : ServicePointManager.SecurityProtocol.HasFlag(SecurityProtocolType.Tls12) ? "security-test-sandbox" : "sandbox";

            var config = new Dictionary <string, string>
            {
                { "clientId", payPalDirectPaymentSettings.ClientId },
                { "clientSecret", payPalDirectPaymentSettings.ClientSecret },
                { "mode", mode }
            };

            var accessToken = new OAuthTokenCredential(config).GetAccessToken();
            var apiContext  = new APIContext(accessToken)
            {
                Config = config
            };

            return(apiContext);
        }
        public override void Install()
        {
            //settings
            var settings = new PayPalDirectPaymentSettings
            {
                TransactMode = TransactMode.Authorize,
                UseSandbox = true,
            };
            _settingService.SaveSetting(settings);

            //locales
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.UseSandbox", "Use Sandbox");
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.UseSandbox.Hint", "Check to enable Sandbox (testing environment).");
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.TransactMode", "Transaction mode");
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.TransactMode.Hint", "Specify transaction mode.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.ApiAccountName", "API Account Name");
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.ApiAccountName.Hint", "Specify API account name.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.ApiAccountPassword", "API Account Password");
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.ApiAccountPassword.Hint", "Specify API account password.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.Signature", "Signature");
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.Signature.Hint", "Specify signature.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.AdditionalFee", "Additional fee");
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.AdditionalFee.Hint", "Enter additional fee to charge your customers.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.AdditionalFeePercentage", "Additional fee. Use percentage");
            this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalDirect.Fields.AdditionalFeePercentage.Hint", "Determines whether to apply a percentage additional fee to the order total. If not enabled, a fixed value is used.");

            base.Install();
        }
        public override void Install()
        {
            var settings = new PayPalDirectPaymentSettings()
            {
                TransactMode = TransactMode.Authorize,
                UseSandbox = true,
            };
            _settingService.SaveSetting(settings);

            base.Install();
        }