Example #1
0
        public ActionResult ReturnPaymentInfo()
        {
            // var rjson = new StreamReader(HttpContext.Request.Body).ReadToEnd();
            var querycol = HttpContext.Request.Query;

            _logger.Information(string.Join("", querycol.ToList()));

            string cancelled = querycol["cancelled"].ToString();
            string txref     = querycol["txref"].ToString();

            var   orderGuid = Guid.Parse(txref);
            Order order     = _orderService.GetOrderByGuid(orderGuid);

            if (order != null && cancelled != "true")
            {
                order.PaymentStatus = PaymentStatus.Authorized;
                _orderService.UpdateOrder(order);
                return(RedirectToRoute("CheckoutCompleted", new { orderId = order.Id }));
            }
            else
            {
                var model = new ReturnPaymentInfoModel();
                model.DescriptionText = "Your transaction was Cancelled.";
                model.OrderId         = order.Id;
                model.StatusCode      = "";
                model.StatusMessage   = "Cancelled";
                return(View("~/Plugins/Payments.Rave/Views/ReturnPaymentInfo.cshtml", model));
            }
        }
        public ActionResult ReturnPaymentInfo(FormCollection form)
        {
            string tranx_id          = form["gtpay_tranx_id"];
            string tranx_status_code = form["gtpay_tranx_status_code"];
            string tranx_status_msg  = form["gtpay_tranx_status_msg"];

            var   orderGuid = Guid.Parse(tranx_id?.Split('/')[1]);
            Order order     = _orderService.GetOrderByGuid(orderGuid);

            if (!string.Equals(tranx_status_code, "00", StringComparison.InvariantCultureIgnoreCase))
            {
                var model = new ReturnPaymentInfoModel();
                model.DescriptionText = "Your transaction was unsuccessful.";
                model.OrderId         = order.Id;
                model.StatusCode      = tranx_status_code;
                model.StatusMessage   = tranx_status_msg;

                return(View("~/Plugins/Payments.GTPay/Views/PaymentGTPay/ReturnPaymentInfo.cshtml", model));
            }

            order.PaymentStatus = PaymentStatus.Paid;
            _orderService.UpdateOrder(order);

            return(RedirectToAction("Completed", "Checkout"));
        }
Example #3
0
        public ActionResult OrderUnSuccessful(string customorderid, string code, string message)
        {
            Order order = _orderService.GetOrderByCustomOrderNumber(customorderid);
            var   model = new ReturnPaymentInfoModel();

            model.DescriptionText = "Your transaction was unsuccessful.";
            model.OrderId         = order.Id;
            model.StatusCode      = code;
            model.StatusMessage   = message;
            return(View("~/Plugins/Payments.Rave/Views/ReturnPaymentInfo.cshtml", model));
        }
Example #4
0
        public ActionResult ReturnPaymentInfo(IFormCollection form)
        {
            var processor = _paymentService.LoadPaymentMethodBySystemName("Payments.GTPay") as GTPayPaymentProcessor;

            if (processor == null || !_paymentService.IsPaymentMethodActive(processor) || !processor.PluginDescriptor.Installed)
            {
                throw new NopException("GTPay module cannot be loaded");
            }
            string tranx_id          = form["gtpay_tranx_id"];
            string tranx_status_code = form["gtpay_tranx_status_code"];
            string tranx_status_msg  = form["gtpay_tranx_status_msg"];
            string gtpay_tranx_amt   = form["gtpay_tranx_amt"];
            string gtpay_tranx_curr  = form["gtpay_tranx_curr"];
            string gtpay_cust_id     = form["gtpay_cust_id"];
            string gtpay_gway_name   = form["gtpay_gway_name"];
            string gtpay_echo_data   = form["gtpay_echo_data"];


            _logger.Information("transid: " + tranx_id);
            _logger.Information("tranx_status_code: " + tranx_status_code);
            _logger.Information("tranx_status_msg: " + tranx_status_msg);
            _logger.Information("gtpay_echo_data: " + gtpay_echo_data);
            _logger.Information("gtpay_tranx_amt: " + gtpay_tranx_amt);
            _logger.Information("gtpay_tranx_curr: " + gtpay_tranx_curr);

            var   orderGuid = Guid.Parse(gtpay_echo_data);
            Order order     = _orderService.GetOrderByGuid(orderGuid);

            if (!string.Equals(tranx_status_code, "00", StringComparison.InvariantCultureIgnoreCase))
            {
                var model = new ReturnPaymentInfoModel();
                model.DescriptionText = "Your transaction was unsuccessful.";
                model.OrderId         = order.Id;
                model.StatusCode      = tranx_status_code;
                model.StatusMessage   = tranx_status_msg;

                return(View("~/Plugins/Payments.GTPay/Views/ReturnPaymentInfo.cshtml", model));
            }

            order.PaymentStatus = PaymentStatus.Paid;
            _orderService.UpdateOrder(order);
            return(RedirectToRoute("CheckoutCompleted", new { orderId = order.Id }));
            //return RedirectToAction("Completed", "Checkout");
        }