Esempio n. 1
0
        private async Task NotifyCustomerOfDelay(Customer customer, Order order)
        {
            var message =
                string.Format("Dear {0} {1}, Your order {2} cannot be delivered - please contact customer support",
                    customer.FirstName, customer.Surname, order.ID);

            await EmailClient.Send(customer.EmailAddress, "Failed delivering order", message);
        }
Esempio n. 2
0
        public async Task SendOrder(Customer customer, Order order)
        {
            try
            {
                var orderEta = CalculateOrderEta(order, customer.Address);

                await SendAsync(order, customer.Address);

                await NotifyCustomerOfSuccess(customer, order.ID, orderEta);

            }
            catch (IllegalOrderException exc)
            {
                await NotifyCustomerOfDelay(customer, order);

                throw new OrderProcessingException("Failed to deliver order " + order.ID, exc);
            }
        }
Esempio n. 3
0
        private DateTime CalculateOrderEta(Order order, Address destination)
        {
            return _shippingCalculators[order.ShippingMethod].CalculateEta(_originCountry, destination);

        }
Esempio n. 4
0
 private async Task SendAsync(Order order, Address address)
 {
     await Task.FromResult(false);
 }