Ejemplo n.º 1
0
 // Available to the service layer.
 public Order(Messages.CreateOrder request, IOrderNumberGenerator numberGenerator, ITaxCalculator taxCalculator)
 {
     Raised = DateTime.UtcNow;
     Id     = numberGenerator.Generate();
     Items  = new List <OrderItem>();
     foreach (var item in request.InitialItems)
     {
         AddOrderItem(item);
     }
     UpdateTotals(taxCalculator);
 }
Ejemplo n.º 2
0
        public PaymentInitializeResult Initialize(PaymentMethod currentPayment, string orderNumber, string returnUrl, string orderRef)
        {
            Log.InfoFormat("Generating order number for payment with ID:{0} belonging to order with ID: {1}", currentPayment.Payment.Id, currentPayment.OrderGroupId);
            if (string.IsNullOrWhiteSpace(orderNumber))
            {
                orderNumber = _orderNumberGenerator.Generate(currentPayment.Cart);
            }

            Log.InfoFormat("Generated order number:{0} for payment with ID:{1} belonging to order with ID: {2}", orderNumber, currentPayment.Payment.Id, currentPayment.OrderGroupId);
            currentPayment.Payment.OrderNumber = orderNumber;

            if (!string.IsNullOrWhiteSpace(currentPayment.Payment.Description))
            {
                if (currentPayment.Payment.Description.Contains("{0}"))
                {
                    Log.InfoFormat("Including the ordernumber in the payment description for payment with ID:{0} belonging to order with ID: {1}", currentPayment.Payment.Id, currentPayment.OrderGroupId);
                    currentPayment.Payment.Description = string.Format(currentPayment.Payment.Description, orderNumber);
                    Log.InfoFormat("Payment description is set to:{0} for payment with ID:{1} belonging to order with ID: {2}", currentPayment.Payment.Description, currentPayment.Payment.Id, currentPayment.OrderGroupId);
                }
            }

            Log.InfoFormat("Finished generating order number for payment with ID:{0} belonging to order with ID: {1}", currentPayment.Payment.Id, currentPayment.OrderGroupId);
            return(_initializer.Initialize(currentPayment, orderNumber, returnUrl, orderRef));
        }
Ejemplo n.º 3
0
    }       // eo ORder

    public Order(IOrderNumberGenerator generator, Order order)
    {
        orderNumber_ = generator.Generate();
        /* copy other fields from the existing Order*/
    }