public ActionResult SubmitButton()
        {
            var cart = _payPalExpressCheckoutService.GetCart();

            if (!cart.Any())
            {
                return(RedirectToRoute("ShoppingCart"));
            }

            var downloadableProductsRequireRegistration =
                _customerSettings.RequireRegistrationForDownloadableProducts && cart.Any(sci => sci.Product.IsDownload);

            if (_workContext.CurrentCustomer.IsGuest() && (!_orderSettings.AnonymousCheckoutAllowed || downloadableProductsRequireRegistration))
            {
                return(Challenge());
            }

            return(Redirect(_payPalRedirectionService.ProcessSubmitButton(cart, TempData)));
        }
        public ActionResult PaymentInfo()
        {
            var cart = _payPalExpressCheckoutService.GetCart();

            if (cart.Count == 0)
            {
                return(Content(""));
            }


            bool minOrderSubtotalAmountOk = _orderProcessingService.ValidateMinOrderSubtotalAmount(cart);

            if (!minOrderSubtotalAmountOk)
            {
                return(Content(""));
            }

            var model = new PaymentInfoModel()
            {
                MerchantId = _payPalExpressCheckoutPaymentSettings.MerchantId,
                IsLive     = _payPalExpressCheckoutPaymentSettings.IsLive
            };

            return(View("~/Plugins/Payments.PayPalExpressCheckout/Views/PaymentPayPalExpressCheckout/PaymentInfo.cshtml", model));
        }
Exemple #3
0
        public IViewComponentResult Invoke()
        {
            var cart = _payPalExpressCheckoutService.GetCart();

            if (cart.Count == 0)
            {
                return(Content(""));
            }

            var minOrderSubtotalAmountOk = _orderProcessingService.ValidateMinOrderSubtotalAmount(cart);

            if (!minOrderSubtotalAmountOk)
            {
                return(Content(""));
            }

            var model = new PaymentInfoModel
            {
                ButtonImageLocation = "https://www.paypalobjects.com/en_GB/i/btn/btn_xpressCheckout.gif",
            };

            return(View("~/Plugins/Payments.PayPalExpressCheckout/Views/PaymentInfo.cshtml", model));
        }
        public IViewComponentResult Invoke()
        {
            var cart = _payPalExpressCheckoutService.GetCart();

            if (cart.Count == 0)
            {
                return(Content(string.Empty));
            }

            var minOrderSubtotalAmountOk = _orderProcessingService.ValidateMinOrderSubtotalAmount(cart);

            if (!minOrderSubtotalAmountOk)
            {
                return(Content(string.Empty));
            }

            var filterByCountryId = 0;

            if (_addressSettings.CountryEnabled && _workContext.CurrentCustomer.BillingAddress?.Country != null)
            {
                filterByCountryId = _workContext.CurrentCustomer.BillingAddress.Country.Id;
            }

            var plugin = _paymentPluginManager.LoadPluginBySystemName("Payments.PayPalExpressCheckout");

            if (plugin == null || _paymentPluginManager.GetRestrictedCountryIds(plugin).Contains(filterByCountryId))
            {
                return(Content(string.Empty));
            }

            var model = new PaymentInfoModel
            {
                ButtonImageLocation = "https://paypalobjects.com/en_GB/i/btn/btn_xpressCheckout.gif"
            };

            return(View("~/Plugins/Payments.PayPalExpressCheckout/Views/PaymentInfo.cshtml", model));
        }
        public RedirectResult SubmitButton()
        {
            var cart = _payPalExpressCheckoutService.GetCart();

            return(Redirect(_payPalRedirectionService.ProcessSubmitButton(cart, TempData)));
        }