Ejemplo n.º 1
0
        public ActionResult IPNHandler(FormCollection form)
        {
            var processor = _paymentService.LoadPaymentMethodBySystemName("Payments.CyberSource") as CyberSourcePaymentProcessor;

            if (processor == null ||
                !processor.IsPaymentMethodActive(_paymentSettings) || !processor.PluginDescriptor.Installed)
            {
                throw new NopException("CyberSource module cannot be loaded");
            }

            var reasonCode = form["reasonCode"];
            int orderId;

            if (HostedPaymentHelper.ValidateResponseSign(form, _cyberSourcePaymentSettings.PublicKey) &&
                !string.IsNullOrEmpty(reasonCode) && reasonCode.Equals("100") &&
                int.TryParse(form["orderNumber"], out orderId))
            {
                var order = _orderService.GetOrderById(orderId);
                if (order != null && _orderProcessingService.CanMarkOrderAsAuthorized(order))
                {
                    _orderProcessingService.MarkAsAuthorized(order);
                }
            }

            return(Content(""));
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((NopContext.Current.User == null) || NopContext.Current.User.IsGuest)
            {
                Response.Redirect(SEOHelper.GetLoginPageUrl(true));
            }

            CommonHelper.SetResponseNoCache(Response);

            if (!Page.IsPostBack)
            {
                Order order = this.OrderService.GetOrderById(CommonHelper.QueryStringInt("OrderId"));
                if (order == null)
                {
                    Response.Redirect(CommonHelper.GetStoreLocation());
                }
                if (NopContext.Current.User.CustomerId != order.CustomerId)
                {
                    Response.Redirect(CommonHelper.GetStoreLocation());
                }

                string md5 = CommonHelper.QueryString("MD5");

                if (String.IsNullOrEmpty(md5) || !md5.Equals(HostedPaymentHelper.CalcMd5Hash(String.Format("{0}SveaHostedPaymentReturn.aspx{1}{2}", CommonHelper.GetStoreHost(false), Regex.Replace(Request.Url.Query, "&MD5=.*", String.Empty), HostedPaymentSettings.Password))))
                {
                    Response.Redirect(CommonHelper.GetStoreLocation());
                }



                bool success = CommonHelper.QueryStringBool("Success");
                if (!success)
                {
                    string error     = "Return page. Success parameter is false. ";
                    string errorCode = CommonHelper.QueryString("ErrorCode");
                    if (!String.IsNullOrEmpty(errorCode))
                    {
                        error += string.Format("Svea error code: {0}.", errorCode);
                    }

                    this.OrderService.InsertOrderNote(order.OrderId, error, DateTime.UtcNow);

                    Response.Redirect(CommonHelper.GetStoreLocation());
                }

                if (this.OrderService.CanMarkOrderAsPaid(order))
                {
                    this.OrderService.MarkOrderAsPaid(order.OrderId);
                }

                Response.Redirect("~/checkoutcompleted.aspx");
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CommonHelper.SetResponseNoCache(Response);

            if (!Page.IsPostBack)
            {
                if (HostedPaymentHelper.ValidateResponseSign(Request.Form))
                {
                    int orderId = 0;
                    if (Int32.TryParse(Request.Form["cs1"], out orderId))
                    {
                        Order order = OrderManager.GetOrderById(orderId);
                        if (order != null && OrderManager.CanMarkOrderAsPaid(order))
                        {
                            OrderManager.MarkOrderAsPaid(order.OrderId);
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public ActionResult IPNHandler(FormCollection form)
        {
            var processor = _paymentService.LoadPaymentMethodBySystemName("Payments.ChronoPay") as ChronoPayPaymentProcessor;

            if (processor == null || !processor.IsPaymentMethodActive(_paymentSettings) || !processor.PluginDescriptor.Installed)
            {
                throw new NopException("ChronoPay module cannot be loaded");
            }
            int orderId;

            if (HostedPaymentHelper.ValidateResponseSign(form, _chronoPayPaymentSettings.SharedSecrect) && int.TryParse(form["cs1"], out orderId))
            {
                var order = _orderService.GetOrderById(orderId);
                if (order != null && _orderProcessingService.CanMarkOrderAsPaid(order))
                {
                    _orderProcessingService.MarkOrderAsPaid(order);
                }
            }
            return(RedirectToAction("Index", "Home", new { area = "" }));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            CommonHelper.SetResponseNoCache(Response);

            if (!Page.IsPostBack)
            {
                if (HostedPaymentHelper.ValidateResponseSign(Request.Form))
                {
                    string reasonCode = Request.Form["reasonCode"];
                    if (!String.IsNullOrEmpty(reasonCode) && reasonCode.Equals("100"))
                    {
                        int orderId = 0;
                        if (Int32.TryParse(Request.Form["orderNumber"], out orderId))
                        {
                            Order order = this.OrderService.GetOrderById(orderId);
                            if (order != null && this.OrderService.CanMarkOrderAsAuthorized(order))
                            {
                                this.OrderService.MarkAsAuthorized(order.OrderId);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((NopContext.Current.User == null) || NopContext.Current.User.IsGuest)
            {
                Response.Redirect(SEOHelper.GetLoginPageUrl(true));
            }

            CommonHelper.SetResponseNoCache(Response);

            if (!Page.IsPostBack)
            {
                Order order = OrderManager.GetOrderById(CommonHelper.QueryStringInt("OrderId"));
                if (order == null)
                {
                    Response.Redirect(CommonHelper.GetStoreLocation());
                }
                if (NopContext.Current.User.CustomerId != order.CustomerId)
                {
                    Response.Redirect(CommonHelper.GetStoreLocation());
                }

                string md5 = CommonHelper.QueryString("MD5");

                if (String.IsNullOrEmpty(md5) || !md5.Equals(HostedPaymentHelper.CalcMd5Hash(String.Format("{0}SveaHostedPaymentReturn.aspx{1}{2}", CommonHelper.GetStoreHost(false), Regex.Replace(Request.Url.Query, "&MD5=.*", String.Empty), HostedPaymentSettings.Password))))
                {
                    Response.Redirect(CommonHelper.GetStoreLocation());
                }

                if (OrderManager.CanMarkOrderAsPaid(order))
                {
                    OrderManager.MarkOrderAsPaid(order.OrderId);
                }

                Response.Redirect("~/checkoutcompleted.aspx");
            }
        }