private void PopulateValueAddedTaxTable() { _valueAddedTaxes = new List <ValueAddedTaxTable>(); ValueAddedTaxTable state1 = new ValueAddedTaxTable(); state1.CountryCode = "USA"; state1.TaxRate = Convert.ToDecimal(".04"); _valueAddedTaxes.Add(state1); ValueAddedTaxTable state2 = new ValueAddedTaxTable(); state2.CountryCode = "France"; state2.TaxRate = Convert.ToDecimal(".06"); _valueAddedTaxes.Add(state2); ValueAddedTaxTable state3 = new ValueAddedTaxTable(); state3.CountryCode = "Germany"; state3.TaxRate = Convert.ToDecimal(".0725"); _valueAddedTaxes.Add(state3); }
/// <summary> /// Calculate /// </summary> /// <param name="countryCode"></param> /// <param name="orderValue"></param> /// <returns></returns> public decimal Calculate(string countryCode, decimal orderValue) { ValueAddedTaxTable taxTable = _dataAccessService.GetValueAddedTax(countryCode); decimal taxAmount = orderValue * taxTable.TaxRate; decimal orderTotal = orderValue + taxAmount; return(orderTotal); }