public async Task Consume(ConsumeContext <CreateOrderRequest> context) { var request = context.Message; var customer = await customerBuilder.Build(request); var order = orderBuilder.Build(customer, request.BillingAddress, request.Products); order = await repo.SaveAsync(order); var orderDTO = mapper.Map <OrderDTO>(order); var response = new CreateOrderResponse(orderDTO); await context.RespondAsync(response); }
public void Pay(IPaymentStrategy strategy) { _orderBuilder.SetSalad(_saladDecorator.GetSalad()); var order = _orderBuilder.Build(); order.Pay(strategy); if (Math.Abs(order.AmountPaid) > 0.000001) { _counter.AssignOrder(order); } else { Console.WriteLine("Payment has failed... try again !"); } }