/// <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); }
private void ProcessOrderBatches(IEnumerable <OrderBatch> orderBatches) { foreach (var orderBatch in orderBatches) { _orderProcessor.Process(orderBatch); _shippingReservationService.Reserve(orderBatch.Id, orderBatch.TotalWeight); } }
public virtual OrderStatus Process(OrderDto order) { if (_next != null) { return(_next.Process(order)); } return(OrderStatus.Pending); }
/// <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)); }
/// <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)); }
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)); }