Paypal ExpressCheckout Plugin Session lost when confirm order

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Hi,

I'm using Paypal Express checkout plugin (Payments.PayPalExpressCheckout). I'm facing an issue. When I submit by confirm button at final step session value of "OrderPaymentInfo" goes blank in ConfirmOrder action method. Session values persist during all action methods except this ConfirmOrder. Below are two action method one have session values and other don't.


public ActionResult Confirm()
        {
            var processPaymentRequest = _httpContext.Session["OrderPaymentInfo"] as ProcessPaymentRequest;
            var json = new JavaScriptSerializer().Serialize(processPaymentRequest);
//Session vaues persist here
            _logger.Information("processPaymentRequest at Confirm in session: " + json);
            //validation
            var cart = _payPalExpressCheckoutService.GetCart();
            if (cart.Count == 0)
                return RedirectToRoute("ShoppingCart");

            if (!_payPalExpressCheckoutService.IsAllowedToCheckout())
                return new HttpUnauthorizedResult();

            //model
            var model = _payPalExpressCheckoutConfirmOrderService.PrepareConfirmOrderModel(cart);
            var processPaymentRequest2 = _httpContext.Session["OrderPaymentInfo"] as ProcessPaymentRequest;
            var json2 = new JavaScriptSerializer().Serialize(processPaymentRequest2);
            _logger.Information("processPaymentRequest at Confirm in session before return: " + json2);
//Session vaues persist here
            return View("~/Plugins/Payments.PayPalExpressCheckout/Views/Confirm.cshtml", model);
        }

        [HttpPost, ActionName("Confirm")]
        [ValidateInput(false)]
        public ActionResult ConfirmOrder()
        {
            var processPaymentRequest = _httpContext.Session["OrderPaymentInfo"] as ProcessPaymentRequest;
            var json = new JavaScriptSerializer().Serialize(processPaymentRequest);
//Session vaues gets blank here
            _logger.Information("processPaymentRequest at Confirm post in session: " + json);
            //validation
            var cart = _payPalExpressCheckoutService.GetCart();
            if (cart.Count == 0)
                return RedirectToRoute("ShoppingCart");

            if (!_payPalExpressCheckoutService.IsAllowedToCheckout())
                return new HttpUnauthorizedResult();

            //model
            var checkoutPlaceOrderModel = _payPalExpressCheckoutPlaceOrderService.PlaceOrder();
            if (checkoutPlaceOrderModel.RedirectToCart)
                return RedirectToRoute("ShoppingCart");

            if (checkoutPlaceOrderModel.IsRedirected)
                return Content("Redirected");

            if (checkoutPlaceOrderModel.CompletedId.HasValue)
                return RedirectToRoute("CheckoutCompleted", new { orderId = checkoutPlaceOrderModel.CompletedId });

            //If we got this far, something failed, redisplay form
            return View("~/Plugins/Payments.PayPalExpressCheckout/Views/Confirm.cshtml", checkoutPlaceOrderModel);
        }
4 years ago
Which nopCommerce version you using?

Are you changing in plugin or customizing in plugin?
4 years ago
rajupaladiya wrote:
Which nopCommerce version you using?

Are you changing in plugin or customizing in plugin?


I'm using NOP version 3.90. No i'm not changing anything. It's working fine on local. Issue is arrising at test server and live server.
3 years ago
check your plugins. some payment plugin is canceling the session
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.