private void PopulateStateTaxTable() { _stateTaxes = new List <StateTaxTable>(); StateTaxTable state1 = new StateTaxTable(); state1.StateCode = "NY"; state1.TaxRate = Convert.ToDecimal(".04"); _stateTaxes.Add(state1); StateTaxTable state2 = new StateTaxTable(); state2.StateCode = "FL"; state2.TaxRate = Convert.ToDecimal(".06"); _stateTaxes.Add(state2); StateTaxTable state3 = new StateTaxTable(); state3.StateCode = "CA"; state3.TaxRate = Convert.ToDecimal(".0725"); _stateTaxes.Add(state3); StateTaxTable state4 = new StateTaxTable(); state4.StateCode = "WA"; state4.TaxRate = Convert.ToDecimal(".0650"); _stateTaxes.Add(state4); }
/// <summary> /// Calculate /// </summary> /// <param name="stateCode"></param> /// <param name="amount"></param> /// <returns></returns> public decimal Calculate(string stateCode, decimal orderValue) { StateTaxTable taxTable = _dataAccessService.GetStateTax(stateCode); decimal taxAmount = orderValue * taxTable.TaxRate; decimal orderTotal = orderValue + taxAmount; return(orderTotal); }