Пример #1
0
        public override void Install()
        {
            var paypalExpressSettings = new PayPalExpressPaymentSettings()
            {
                UseSandbox   = true,
                TransactMode = TransactMode.Authorize
            };

            _settingService.SaveSetting <PayPalExpressPaymentSettings>(paypalExpressSettings);

            var paypalDirectSettings = new PayPalDirectPaymentSettings()
            {
                TransactMode = TransactMode.Authorize,
                UseSandbox   = true,
            };

            _settingService.SaveSetting <PayPalDirectPaymentSettings>(paypalDirectSettings);

            var paypalStandardSettings = new PayPalStandardPaymentSettings()
            {
                UseSandbox            = true,
                PdtValidateOrderTotal = true,
                EnableIpn             = true,
            };

            _settingService.SaveSetting <PayPalStandardPaymentSettings>(paypalStandardSettings);

            _localizationService.ImportPluginResourcesFromXml(this.PluginDescriptor);

            base.Install();
        }
Пример #2
0
        public PayPalExpressController(ISettingService settingService,
                                       IPaymentService paymentService, IOrderService orderService,
                                       IOrderProcessingService orderProcessingService,
                                       ILogger logger, PayPalExpressPaymentSettings PayPalExpressPaymentSettings,
                                       PaymentSettings paymentSettings, ILocalizationService localizationService,
                                       IWorkContext workContext, OrderSettings orderSettings,
                                       ICurrencyService currencyService, CurrencySettings currencySettings,
                                       IOrderTotalCalculationService orderTotalCalculationService, ICustomerService customerService,
                                       IGenericAttributeService genericAttributeService, IStoreContext storeContext,
                                       IComponentContext ctx)
        {
            this._settingService         = settingService;
            this._paymentService         = paymentService;
            this._orderService           = orderService;
            this._orderProcessingService = orderProcessingService;
            this._logger = logger;
            this._payPalExpressPaymentSettings = PayPalExpressPaymentSettings;
            this._paymentSettings              = paymentSettings;
            this._localizationService          = localizationService;
            this._workContext                  = workContext;
            this._orderSettings                = orderSettings;
            this._currencyService              = currencyService;
            this._currencySettings             = currencySettings;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._customerService              = customerService;
            this._genericAttributeService      = genericAttributeService;
            this._storeContext                 = storeContext;

            _helper = new PluginHelper(ctx, "SmartStore.PayPal", "Plugins.Payments.PayPalExpress");

            T = NullLocalizer.Instance;
        }
Пример #3
0
 public void Copy(PayPalExpressPaymentSettings settings, bool fromSettings)
 {
     if (fromSettings)
     {
         UseSandbox              = settings.UseSandbox;
         TransactMode            = Convert.ToInt32(settings.TransactMode);
         ApiAccountName          = settings.ApiAccountName;
         ApiAccountPassword      = settings.ApiAccountPassword;
         Signature               = settings.Signature;
         AdditionalFee           = settings.AdditionalFee;
         AdditionalFeePercentage = settings.AdditionalFeePercentage;
         DisplayCheckoutButton   = settings.DisplayCheckoutButton;
         ConfirmedShipment       = settings.ConfirmedShipment;
         NoShipmentAddress       = settings.NoShipmentAddress;
         CallbackTimeout         = settings.CallbackTimeout;
         DefaultShippingPrice    = settings.DefaultShippingPrice;
     }
     else
     {
         settings.UseSandbox              = UseSandbox;
         settings.TransactMode            = (TransactMode)TransactMode;
         settings.ApiAccountName          = ApiAccountName;
         settings.ApiAccountPassword      = ApiAccountPassword;
         settings.Signature               = Signature;
         settings.AdditionalFee           = AdditionalFee;
         settings.AdditionalFeePercentage = AdditionalFeePercentage;
         settings.DisplayCheckoutButton   = DisplayCheckoutButton;
         settings.ConfirmedShipment       = ConfirmedShipment;
         settings.NoShipmentAddress       = NoShipmentAddress;
         settings.CallbackTimeout         = CallbackTimeout;
         settings.DefaultShippingPrice    = DefaultShippingPrice;
     }
 }
Пример #4
0
 public static PaymentActionCodeType GetPaymentAction(PayPalExpressPaymentSettings payPalExpressPaymentSettings)
 {
     if (payPalExpressPaymentSettings.TransactMode == TransactMode.Authorize)
     {
         return(PaymentActionCodeType.Authorization);
     }
     else
     {
         return(PaymentActionCodeType.Sale);
     }
 }
 public void Copy(PayPalExpressPaymentSettings settings, bool fromSettings)
 {
     if (fromSettings)
     {
         MiniMapper.Map(settings, this);
     }
     else
     {
         MiniMapper.Map(this, settings);
         settings.ApiAccountName     = ApiAccountName.TrimSafe();
         settings.ApiAccountPassword = ApiAccountPassword.TrimSafe();
         settings.Signature          = Signature.TrimSafe();
     }
 }
Пример #6
0
 public void Copy(PayPalExpressPaymentSettings settings, bool fromSettings)
 {
     if (fromSettings)
     {
         SecurityProtocol        = settings.SecurityProtocol;
         UseSandbox              = settings.UseSandbox;
         IpnChangesPaymentStatus = settings.IpnChangesPaymentStatus;
         TransactMode            = Convert.ToInt32(settings.TransactMode);
         ApiAccountName          = settings.ApiAccountName;
         ApiAccountPassword      = settings.ApiAccountPassword;
         Signature                    = settings.Signature;
         AdditionalFee                = settings.AdditionalFee;
         AdditionalFeePercentage      = settings.AdditionalFeePercentage;
         ShowButtonInMiniShoppingCart = settings.ShowButtonInMiniShoppingCart;
         ConfirmedShipment            = settings.ConfirmedShipment;
         NoShipmentAddress            = settings.NoShipmentAddress;
         CallbackTimeout              = settings.CallbackTimeout;
         DefaultShippingPrice         = settings.DefaultShippingPrice;
     }
     else
     {
         settings.SecurityProtocol        = SecurityProtocol;
         settings.UseSandbox              = UseSandbox;
         settings.IpnChangesPaymentStatus = IpnChangesPaymentStatus;
         settings.TransactMode            = (TransactMode)TransactMode;
         settings.ApiAccountName          = ApiAccountName;
         settings.ApiAccountPassword      = ApiAccountPassword;
         settings.Signature                    = Signature;
         settings.AdditionalFee                = AdditionalFee;
         settings.AdditionalFeePercentage      = AdditionalFeePercentage;
         settings.ShowButtonInMiniShoppingCart = ShowButtonInMiniShoppingCart;
         settings.ConfirmedShipment            = ConfirmedShipment;
         settings.NoShipmentAddress            = NoShipmentAddress;
         settings.CallbackTimeout              = CallbackTimeout;
         settings.DefaultShippingPrice         = DefaultShippingPrice;
     }
 }