public CheckoutOutput(CustomerOutput customer, BasketOutput basket, DateTime orderDate, double totalPrice) { Customer = customer; Basket = basket; OrderDate = orderDate; TotalPrice = totalPrice; }
public async Task Process(GetBasketDetailsInput input) { var basket = await basketReadOnlyRepository.Get(input.BasketId); if (basket == null) { outputBoundary.Populate(null); return; } BasketOutput output = outputConverter.Map <BasketOutput>(basket); outputBoundary.Populate(output); }
public async Task Process(AddBasketInput input) { Customer customer = await customerReadOnlyRepository.Get(input.CustomerId); if (customer == null) { throw new CustomerNotFoundException($"The customer {input.CustomerId} does not exist or it was not processed yet."); } Basket basket = new Basket(customer.Id); await basketWriteOnlyRepository.Add(basket); CustomerOutput customerOutput = outputConverter.Map <CustomerOutput>(customer); BasketOutput basketOutput = outputConverter.Map <BasketOutput>(basket); AddBasketOutput output = new AddBasketOutput(customerOutput, basketOutput); outputBoundary.Populate(output); }
public async Task Process(CheckoutInput input) { Customer customer = await customerReadOnlyRepository.Get(input.CustomerId); if (customer == null) { throw new CustomerNotFoundException($"The customer {input.CustomerId} does not exist or it was not processed yet."); } Basket basket = await basketReadOnlyRepository.Get(input.BasketId); if (basket == null) { throw new BasketNotFoundException($"The basket {input.BasketId} does not exist or it was already deleted."); } CustomerOutput customerOutput = outputConverter.Map <CustomerOutput>(customer); BasketOutput basketOutput = outputConverter.Map <BasketOutput>(basket); CheckoutOutput output = new CheckoutOutput(customerOutput, basketOutput, input.OrderDate, basket.GetTotalPrice().Value); outputBoundary.Populate(output); }
public AddBasketOutput(CustomerOutput customer, BasketOutput basket) { Customer = customer; Basket = basket; }