Example #1
0
        public TaxAndShippingTotalCalculatorResponse Calculate(TaxAndShippingCalculationRequest request)
        {
            var shippingAndTaxCalculation = new List <BasShippingCalculator>
            {
                new ShippingCalculator(new Shipping {
                    Height = request.Height, Width = request.Width, Length = request.Length
                }),
                new TaxCalculator(new Shipping {
                    Height = request.Height, Width = request.Width, Length = request.Length
                })
            };

            var total = new TaxAndShippingTotalCalculator(shippingAndTaxCalculation).CalculateTotalShippingCost();

            return(new TaxAndShippingTotalCalculatorResponse
            {
                Total = total
            });
        }
        public IActionResult Calculate([FromBody] TaxAndShippingCalculationRequest request)
        {
            var result = _taxAndShippingCalculationService.Calculate(request);

            return(Ok(result));
        }