public async Task <OrderPricingDto> HandleAsync(GetOrderPricing query) { var customer = await _client.GetAsync(query.CustomerId); if (customer is null) { throw new CustomerNotFoundException(query.CustomerId); } var customerDiscount = _service.CalculateDiscount(customer.AsEntity()); var orderDiscountPrice = query.OrderPrice - customerDiscount * query.OrderPrice; _logger.LogInformation($"Calculated the pricing for the customer with id: {query.CustomerId}, " + $"base order price: {query.OrderPrice} $, discount: {customerDiscount} $, " + $"final price: {orderDiscountPrice} $."); return(new OrderPricingDto { CustomerDiscount = customerDiscount, OrderPrice = query.OrderPrice, OrderDiscountPrice = orderDiscountPrice > 0 ? orderDiscountPrice : query.OrderPrice }); }