Esempio n. 1
0
        public virtual async Task <Entities.Checkout> UpdateAsync(string token, Entities.Checkout updatedCheckout, CancellationToken cancellationToken = default)
        {
            var req = PrepareRequest($"checkouts/{token}.json");

            var response = await ExecuteRequestAsync <Entities.Checkout>(req, HttpMethod.Put, cancellationToken, new JsonContent(updatedCheckout), "checkout");

            return(response.Result);
        }
Esempio n. 2
0
        public virtual async Task <Entities.Checkout> CreateAsync(Entities.Checkout checkout, CancellationToken cancellationToken = default)
        {
            var req  = PrepareRequest("checkout.json");
            var body = checkout.ToDictionary();

            var response = await ExecuteRequestAsync <Entities.Checkout>(req, HttpMethod.Post, cancellationToken, new JsonContent(checkout), "checkout");

            return(response.Result);
        }
Esempio n. 3
0
        public ActionResult Index(FAAS.Models.HeaderModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            int ItemsCount = 0;
            double TotalBill = 0;
            Entities.UserOrder Order = new Entities.UserOrder();
            Entities.Checkout chekout = new Entities.Checkout();
            CheckoutModel chekoutmodel = new CheckoutModel();
            List<ProductItem> proList = new List<ProductItem>();
            try
            {
                foreach (var prodct in model.productItems)
                {
                    if (prodct.IsSelected || prodct.Qty > 0)
                    {
                        ProductItem confirmedProduct = new ProductItem();
                        ItemsCount++;
                        TotalBill += prodct.Price * prodct.Qty;
                        confirmedProduct.ProductId = prodct.ProductId;
                        confirmedProduct.Qty = prodct.Qty;
                        confirmedProduct.Price = prodct.Price;
                        confirmedProduct.Name = prodct.Name;
                        confirmedProduct.Calories = prodct.Calories;
                        confirmedProduct.ImageUrl = prodct.ImageUrl;
                        proList.Add(confirmedProduct);
                    }
                }

                chekoutmodel.TotalPrice = TotalBill;
                chekoutmodel.TotalItemQty = ItemsCount;
                chekoutmodel.ProdcutItems = proList;

                // Get Customer Address Detail Based on CustID

                CustomerController custReg = new CustomerController();
                List<Customer> customerList = custReg.Get(model.CustmorID).ToList(); chekoutmodel.CustmorID = model.CustmorID;
                if (customerList.Count > 0)
                {
                    chekoutmodel.CustomerName = customerList[0].CustomerName; //address.CustomerName;
                    chekoutmodel.DeliveryLocationCode = customerList[0].Postcode; //address.Postcode;
                    chekoutmodel.DeliveryAddress = customerList[0].Address;//address.Address;
                    chekoutmodel.MobileNo = customerList[0].MobileNo.ToString(); //address.MobileNo;

                }
                else
                {
                    Customer address = new Customer();
                    chekoutmodel.CustomerName = "Uday"; //address.CustomerName;
                    chekoutmodel.DeliveryLocationCode = "AL74FG"; //address.Postcode;
                    chekoutmodel.DeliveryAddress = "House No 10 ,Heartford";//address.Address;
                    chekoutmodel.MobileNo = "9739027030"; //address.MobileNo;
                }
                chekoutmodel.DeliveryCharge = 5;
                chekoutmodel.DeliveryStartDate = DateTime.Today.AddHours(12);
                chekoutmodel.DeliveryEndDate = DateTime.Today.AddHours(13);
            }

            catch (Exception ex)
            {
            }
            chekout.ItemQty = ItemsCount;
            chekout.TotalPrice = TotalBill;

            return View("Payment", chekoutmodel);
        }
Esempio n. 4
0
        public ActionResult Payment(FAAS.Models.CheckoutModel model)
        {
            int ItemsCount = 0;
            double TotalBill = 0;

            Entities.Checkout chekout = new Entities.Checkout();

            chekout.CustmorID = 1;
            try
            {

                //Make Confirm Call

                OrderController placeOrder = new OrderController();
                TescoFAAS.Entities.Order order = new TescoFAAS.Entities.Order();

                order.CustomerId = model.CustmorID;
                order.CustomerName = model.CustomerName;
                order.DeliveryAddress = model.DeliveryAddress;
                order.DeliveryCharge = model.DeliveryCharge;
                order.DeliveryLocationCode = model.DeliveryLocationCode;
                order.DeliveryStartDate = model.DeliveryStartDate;
                order.DeliveryEndDate = model.DeliveryEndDate;
                //order.Id = RandomNumber(50000,60000);
                order.Items = model.ProdcutItems;
                order.MobileNo = model.MobileNo;
                order.TotalItemCount = model.TotalItemQty;
                order.TotalPrice = model.TotalPrice;
                order.Status = TescoFAAS.Entities.OrderStatus.Confirm;
                order.WebcutoffDateTime = DateTime.Today.AddHours(8);

                int orderID = placeOrder.Post(order);
                model.OrderId = orderID;
                chekout.OrderId = orderID;
                //foreach (var prodct in model.productItems)
                //{
                //    if (prodct.IsSelected)
                //    {
                //        ItemsCount++;
                //        TotalBill += prodct.Price * prodct.Qty;
                //    }
                //}
            }
            catch (Exception ex)
            {

            }

            chekout.ItemQty = ItemsCount;
            chekout.TotalPrice = TotalBill;

            return View("ConfirmOrder", model);
        }