Beispiel #1
0
        public async Task <IActionResult> GetOrderTax([FromBody] OrderTaxRequestDto orderTaxRequestDto)
        {
            Order order    = _mapper.Map <Order>(orderTaxRequestDto);
            var   orderTax = await _taxCalculatorService.GetSalesTaxForOrder(order);

            if (orderTax == null)
            {
                _logger.LogDebug(string.Format("Could not calculate taxes for this order from {0}", order.FromCountry));
                throw new OrderTaxNotFoundException(order.CustomerId);
            }
            return(Ok(_mapper.Map <OrderTaxResponseDto>(orderTax)));
        }