Exemplo n.º 1
0
        public void CanRestrieveTaxInformationTest()
        {
            TaxManager        manager  = TaxManagerFactory.Create();
            TaxLookUpResponse response = new TaxLookUpResponse();

            response = manager.TaxLookUp("OH");

            Assert.IsTrue(response.Success);
            Assert.AreEqual("OH", response.TaxInformation.StateAbbreviation);
        }
Exemplo n.º 2
0
        public static bool StateValidation(string input)
        {
            bool result = false;

            TaxLookUpResponse taxResponse = TaxManagerFactory.Create().TaxLookUp(input);

            if (taxResponse.Success)
            {
                result = true;
            }


            return(result);
        }
Exemplo n.º 3
0
        public static void Field(Order order)

        {
            TaxLookUpResponse          taxResponse     = TaxManagerFactory.Create().TaxLookUp(order.State);
            ProductInformationResponse productResponse = ProductManagerFactory.Create().ProductInformation(order.ProductType);


            order.TaxRate            = Math.Round(taxResponse.TaxInformation.TaxRate, 2);
            order.CostPerSquareFoot  = Math.Round(productResponse.Product.CostPerSquareFoot, 2);
            order.LaborCostPerSquare = Math.Round(productResponse.Product.LaborCostPerSquareFoot, 2);


            order.MaterialCost = Math.Round(order.Area * order.CostPerSquareFoot, 2);
            order.LaborCost    = Math.Round(order.Area * order.LaborCostPerSquare, 2);

            order.Tax   = Math.Round(((order.MaterialCost + order.LaborCost) * (order.TaxRate / 100)), 2);
            order.Total = Math.Round((order.MaterialCost + order.LaborCost + order.Tax), 2);
        }
Exemplo n.º 4
0
        public TaxLookUpResponse TaxLookUp(string stateAbbreviation)
        {
            TaxLookUpResponse response = new TaxLookUpResponse();

            response.TaxInformation = _taxRepository.RetrieveTaxInfo(stateAbbreviation);

            if (response.TaxInformation == null)
            {
                response.Success = false;
                response.Message = $"There was no Tax Information found {stateAbbreviation}. Contact IT.";
            }
            else
            {
                response.Success = true;
            }

            return(response);
        }