private Payment Payment_PayPal(TransactionProcessParamsItems requestParams)
        {
            var result  = _TransactionsService.GetTransactionById(requestParams.TransactionProcess.ID.ToString());
            var payment = new Payment();

            if (result == null)
            {
                return(payment);
            }

            payment            = _PaypalServices.CreatePayment(requestParams);
            result.Status      = payment.state;
            result.ReferenceId = payment.id;
            _TransactionsService.UpdateTransactions(result);

            var PaymentLogs = new PaymentLogs()
            {
                Data         = Newtonsoft.Json.JsonConvert.SerializeObject(payment),
                Error        = "Success",
                PaymentType  = "PAYPAL",
                FunctionName = "ProcessPayment",
                TransID      = requestParams.TransactionProcess.ID.ToString()
            };

            _PaymentLogsService.InsertPaymentLogs(PaymentLogs);


            return(payment);
        }
Exemple #2
0
        public IActionResult CreatePayment()
        {
            var stringItem           = HttpContext.Session.GetString("GioHang");
            var ListItemTrongGioHang = new List <GioHangViewModel>();

            ListItemTrongGioHang = JsonConvert.DeserializeObject <List <GioHangViewModel> >(stringItem);
            string returnURL = Request.Scheme + "://" + Request.Host + "/Payment/ExecutePayment";
            string cancelURL = Request.Scheme + "://" + Request.Host + "/Payment/Cancel";
            var    payment   = _PaypalServices.CreatePayment(ListItemTrongGioHang, returnURL, cancelURL, "sale");

            return(new JsonResult(payment));
        }
        public IActionResult CreatePayment(int id)
        {
            var model = packagePlanService.GetPackagePlanById(id);

            if (model != null)
            {
                Payment payment = _PaypalServices.CreatePayment(id, model.Price, model.PackageName, URL_ExecutePayment, URL_Cancel, "sale");
                return(new JsonResult(payment));
            }
            else
            {
                return(RedirectToAction("Index", "BuySubscription"));
            }
        }
Exemple #4
0
        public IActionResult CreatePayment()
        {
            //var UserID = _userManager.GetUserId(User);
            //var Total = _cart.GetTotal(UserID);
            //CartIndexModel cart = TempData["mydata"] as CartIndexModel;
            //var story = JsonConvert.DeserializeObject<CartIndexModel>(TempData["model"].ToString());
            //decimal amount = 100;
            //var UserID = _userManager.GetUserId(User);
            //var cart=_context.Carts.FirstOrDefault(x => x.ShopUser.Equals(UserID));
            string  user    = _userManager.GetUserId(User);
            decimal cart    = _context.Carts.Where(x => x.ShopUser.Id.Equals(user)).Select(r => r.Total).FirstOrDefault();
            var     payment = _PaypalServices.CreatePayment(cart, "https://localhost:44300/Payment/ExecutePayment", "https://localhost:44300/Payment/Cancel", "sale");

            return(new JsonResult(payment));
        }
        public IActionResult CreatePayment(int id)
        {
            var model = subscriptionService.GetBusiness_SubscriptionById(id);

            if (model != null)
            {
                var package = packagePlanService.GetPackagePlanById(model.PackagePlanId);

                Payment payment = _PaypalServices.CreatePayment(id, package.Price, package.PackageName, URL_ExecutePayment, URL_Cancel, "sale");
                return(new JsonResult(payment));
            }
            else
            {
                return(RedirectToAction("", "Home"));
            }
        }
        public IActionResult CreatePayment(Guid id, Guid dataGuid)
        {
            var vChalet = _dbContext.Chalet.Where(x => x.unique_id == id).FirstOrDefault();

            if (vChalet == null)
            {
                return(RedirectToAction("Cancel"));
            }

            var vHelperData = _dbContext.ReservationDataHelper.Where(x => x.unique_id == dataGuid).LastOrDefault();

            if (vHelperData == null)
            {
                return(RedirectToAction("Cancel"));
            }


            var payment = _paypalServices.CreatePayment((decimal)vHelperData.amount, "https://localhost:44385/Payment/ExecutePayment", "https://localhost:44385/Payment/Cancel", "sale");



            return(new JsonResult(payment));
        }
Exemple #7
0
        public IActionResult CreatePayment()
        {
            var payment = _PaypalServices.CreatePayment(100, "http://localhost:28079/Payment/ExecutePayment", "http://localhost:28079/Payment/Cancel", "sale");

            return(new JsonResult(payment));
        }