Exemplo n.º 1
0
        /// <summary>
        /// Add an order to collection and return the unique order id or negative if an error.
        /// </summary>
        /// <param name="order">New order object to add to processing list</param>
        /// <returns>New unique, increasing orderid</returns>
        public virtual int AddOrder(Order order)
        {
            try
            {
                //Ensure its flagged as a new order for the transaction handler.
                order.Id     = _orderId++;
                order.Status = OrderStatus.New;

                // send the order to be processed
                _orderProcessor.Process(order);
            }
            catch (Exception err)
            {
                Log.Error("Algorithm.Transaction.AddOrder(): " + err.Message);
            }
            return(order.Id);
        }
Exemplo n.º 2
0
 private void ProcessOrderBatches(IEnumerable <OrderBatch> orderBatches)
 {
     foreach (var orderBatch in orderBatches)
     {
         _orderProcessor.Process(orderBatch);
         _shippingReservationService.Reserve(orderBatch.Id, orderBatch.TotalWeight);
     }
 }
Exemplo n.º 3
0
        public virtual OrderStatus Process(OrderDto order)
        {
            if (_next != null)
            {
                return(_next.Process(order));
            }

            return(OrderStatus.Pending);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Processes the order request
        /// </summary>
        /// <param name="request">The request to be processed</param>
        /// <returns>The order ticket for the request</returns>
        public OrderTicket ProcessRequest(OrderRequest request)
        {
            var submit = request as SubmitOrderRequest;

            if (submit != null)
            {
                submit.SetOrderId(GetIncrementOrderId());
            }
            return(_orderProcessor.Process(request));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Processes the order request
        /// </summary>
        /// <param name="request">The request to be processed</param>
        /// <returns>The order ticket for the request</returns>
        public OrderTicket ProcessRequest(OrderRequest request)
        {
            if (_algorithm != null && _algorithm.IsWarmingUp)
            {
                throw new Exception(OrderResponse.WarmingUp(request).ToString());
            }

            var submit = request as SubmitOrderRequest;

            if (submit != null)
            {
                submit.SetOrderId(GetIncrementOrderId());
            }
            return(_orderProcessor.Process(request));
        }
Exemplo n.º 6
0
        public ActionResult Checkout(Cart cart, ShippingDetails detalles)
        {
            if (!cart.Lines.Any())
            {
                ModelState.AddModelError("", "Tu carrito esta vacío.");
            }

            if (ModelState.IsValid)
            {
                //Process
                _orderProcessor.Process(cart, detalles);
                cart.Clear();
                return(View("Completed"));
            }
            return(View(detalles));
        }