public async Task RequestShipping(Core.ShippingRequest sr) { if (sr == null) { return; } var shipping = Shipping.Create(sr); await _repo.Insert(shipping); // yes, shipping svc is slow... =) await Task.Delay(5000); // set shipping delivered so order can be marked as complete // Note: other workflows not implemented shipping.Status = ShippingStatus.Delivered; await _bus.Publish(new Core.ShippingResponse { Number = shipping.Number, AccountId = shipping.AccountId, OrderId = shipping.OrderId, Status = shipping.Status.Parse <Core.ShippingStatus>() }); }
public void ProcessOrder(string email, PaymentMethod paymentMethod, Payment payment, Address address, string code) { var shoppingCart = _shoppingCartService.GetByCustomer(email); var order = OrderFactory.CreateOrder(shoppingCart); var shipping = Shipping.Create(address); var coupon = _discountCouponRepositoryQuery.GetByCode(code); order.ChangePayment(payment); order.ChangePaymentMethod(paymentMethod); order.ChangeShipping(shipping); order.ApplyDiscountCoupon(coupon); _orderRepository.Add(order); }