/// <summary>
        /// Initializes the controller.
        /// </summary>
        private void Initialize()
        {
            var provider = GatewayContext.Payment.GetProviderByKey(Constants.PayPal.GatewayProviderSettingsKey) as PayPalPaymentGatewayProvider;

            if (provider == null)
            {
                var nullRef =
                    new NullReferenceException(
                        "PayPalPaymentGatewayProvider is not activated or has not been resolved.");
                MultiLogHelper.Error <PayPalExpressController>(
                    "Failed to find active PayPalPaymentGatewayProvider.",
                    nullRef,
                    GetExtendedLoggerData());

                throw nullRef;
            }

            // instantiate the service
            _paypalApiService = new PayPalApiService(provider.ExtendedData.GetPayPalProviderSettings());

            var settings = provider.ExtendedData.GetPayPalProviderSettings();

            _successUrl            = settings.SuccessUrl;
            _cancelUrl             = settings.CancelUrl;
            _deleteInvoiceOnCancel = settings.DeleteInvoiceOnCancel;

            _paymentMethod = provider.GetPaymentGatewayMethodByPaymentCode(Constants.PayPal.PaymentCodes.ExpressCheckout) as PayPalExpressCheckoutPaymentGatewayMethod;

            if (_paymentMethod == null)
            {
                var nullRef = new NullReferenceException("PayPalExpressCheckoutPaymentGatewayMethod could not be instantiated");
                MultiLogHelper.Error <PayPalExpressController>("PayPalExpressCheckoutPaymentGatewayMethod was null", nullRef, GetExtendedLoggerData());

                throw nullRef;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PayPalExpressCheckoutPaymentGatewayMethod"/> class.
 /// </summary>
 /// <param name="gatewayProviderService">
 /// The gateway provider service.
 /// </param>
 /// <param name="paymentMethod">
 /// The payment method.
 /// </param>
 /// <param name="paypalApiService">
 /// The <see cref="IPayPalApiService"/>.
 /// </param>
 public PayPalExpressCheckoutPaymentGatewayMethod(IGatewayProviderService gatewayProviderService, IPaymentMethod paymentMethod, IPayPalApiService paypalApiService)
     : base(gatewayProviderService, paymentMethod)
 {
     Ensure.ParameterNotNull(paypalApiService, "payPalApiService");
     this._paypalApiService = paypalApiService;
 }
Ejemplo n.º 3
0
        public virtual void TestFixtureSetup()
        {
            var settings = TestHelper.GetPayPalProviderSettings();

            this.PayPalApiService = new PayPalApiService(settings);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PayPalExpressCheckoutPaymentProcessor"/> class.
 /// </summary>
 /// <param name="service">
 /// The <see cref="IPayPalApiPaymentService"/>.
 /// </param>
 public PayPalExpressCheckoutPaymentProcessor(IPayPalApiService service)
 {
     Mandate.ParameterNotNull(service, "service");
     this._service = (PayPalExpressCheckoutService)service.ExpressCheckout;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PayPalExpressCheckoutPaymentGatewayMethod"/> class.
 /// </summary>
 /// <param name="gatewayProviderService">
 /// The gateway provider service.
 /// </param>
 /// <param name="paymentMethod">
 /// The payment method.
 /// </param>
 /// <param name="paypalApiService">
 /// The <see cref="IPayPalApiService"/>.
 /// </param>
 public PayPalExpressCheckoutPaymentGatewayMethod(IGatewayProviderService gatewayProviderService, IPaymentMethod paymentMethod, IPayPalApiService paypalApiService)
     : base(gatewayProviderService, paymentMethod)
 {
     Ensure.ParameterNotNull(paypalApiService, "payPalApiService");
     this._paypalApiService = paypalApiService;
 }
Ejemplo n.º 6
0
        public virtual void TestFixtureSetup()
        {
            var settings = TestHelper.GetPayPalProviderSettings();

            this.PayPalApiService = new PayPalApiService(settings);
        }
        /// <summary>
        /// Initializes the controller.
        /// </summary>
        private void Initialize()
        {
            var provider = GatewayContext.Payment.GetProviderByKey(Constants.PayPal.GatewayProviderSettingsKey) as PayPalPaymentGatewayProvider;
            if (provider == null)
            {
                var nullRef =
                    new NullReferenceException(
                        "PayPalPaymentGatewayProvider is not activated or has not been resolved.");
                MultiLogHelper.Error<PayPalExpressController>(
                    "Failed to find active PayPalPaymentGatewayProvider.",
                    nullRef,
                    GetExtendedLoggerData());

                throw nullRef;
            }

            // instantiate the service
            _paypalApiService = new PayPalApiService(provider.ExtendedData.GetPayPalProviderSettings());

            var settings = provider.ExtendedData.GetPayPalProviderSettings();
            _successUrl = settings.SuccessUrl;
            _cancelUrl = settings.CancelUrl;
            _deleteInvoiceOnCancel = settings.DeleteInvoiceOnCancel;

            _paymentMethod = provider.GetPaymentGatewayMethodByPaymentCode(Constants.PayPal.PaymentCodes.ExpressCheckout) as PayPalExpressCheckoutPaymentGatewayMethod;

            if (_paymentMethod == null)
            {
                var nullRef = new NullReferenceException("PayPalExpressCheckoutPaymentGatewayMethod could not be instantiated");
                MultiLogHelper.Error<PayPalExpressController>("PayPalExpressCheckoutPaymentGatewayMethod was null", nullRef, GetExtendedLoggerData());

                throw nullRef;
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PayPalExpressCheckoutPaymentProcessor"/> class.
 /// </summary>
 /// <param name="service">
 /// The <see cref="IPayPalApiPaymentService"/>.
 /// </param>
 public PayPalExpressCheckoutPaymentProcessor(IPayPalApiService service)
 {
     Mandate.ParameterNotNull(service, "service");
     this._service = (PayPalExpressCheckoutService)service.ExpressCheckout;
 }