Пример #1
0
        // GET: Customer/PaymentCallback
        public ActionResult PaymentCallback()
        {
            var paymentParam = new PaypalPaymentService.ExecutePaymentParam()
            {
                Session = Session,
                PayerId = Request.Params["PayerID"],
                Guid    = Request.Params["guid"],
            };
            float result = PaymentService.ExecutePayment(paymentParam);

            if (result == -1)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            int customerId = ((Customer)Session["Customer"]).Id;
            var customer   = RegisterMembership(customerId, result);

            Session["Customer"] = customer;
            // notify.....

            return(RedirectToAction("Membership"));
        }
Пример #2
0
        public ActionResult PaymentCallback()
        {
            var paymentParam = new PaypalPaymentService.ExecutePaymentParam()
            {
                Session = Session,
                PayerId = Request.Params["PayerID"],
                Guid    = Request.Params["guid"],
            };
            float result = PaymentService.ExecutePayment(paymentParam);

            if (result == -1)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Customer customer = SaveCustomer((CheckoutViewModel)Session["CheckoutViewModel"], ((Customer)Session["Customer"])?.Id);

            SaveOrder((CartViewModel)Session["Cart"], customer);
            SaveCart(new CartViewModel());
            // decrease quantity
            // notify.....

            return(RedirectToAction("Index"));
        }