Example #1
0
        /// <summary>
        /// Adds the tax type that was used for the calculation to the TaxCalculationResponse object
        /// </summary>
        /// <param name="taxyType">The tax type that was used to calculate the tax amount</param>
        /// <returns>TaxCalculationModelBuilder</returns>
        internal ResultBuilder AddTaxType(TaxType taxType)
        {
            var taxTypeText = Regex.Replace(taxType.ToString(), "(\\B[A-Z])", " $1");

            _response.CalculationTypeUsed = taxTypeText;

            return(this);
        }
Example #2
0
        public static ITaxCalculatorService GetTaxCalculatorService(TaxType taxType)
        {
            ITaxCalculatorService taxCalculatorService = null;

            switch (taxType)
            {
            case TaxType.FlatTaxRate:
                taxCalculatorService = new FlatRateTaxCalculatorService();
                break;

            case TaxType.FlatValue:
                taxCalculatorService = new FlatValueTaxCalculatorService();
                break;

            case TaxType.Progressive:
                taxCalculatorService = new ProgressiveTaxCalculatorService();
                break;

            default:
                throw new ApplicationException(string.Format("The tax type '{0}' supplied is not supported.", taxType.ToString()));
            }

            return(taxCalculatorService);
        }