public decimal TaxAssessment(TaxQuery taxQuery) { TaxAssessment taxAssessment = null; TaxType taxType = null; decimal result = 0; try { //execute the document channel event result = _taxController.ExecuteEvent(taxQuery.PostalCode, taxQuery.Amount); //get tax type id taxType = _taxDataAccess.GetTaxTypeByPostalCode(taxQuery.PostalCode); taxAssessment = new TaxAssessment { NettIncome = taxQuery.Amount, IncomeTax = result, TaxTypeId = taxType.TaxTypeId, DateCreated = DateTime.Now, UserCreated = "System" }; //save assessment calculation _taxDataAccess.AddTaxAssessment(taxAssessment); } catch (Exception) { throw; } return(result); }
/// <summary> /// This method posts income and code to calculate tax /// </summary> /// <param name="income"></param> /// <param name="code"></param> /// <returns></returns> public decimal CalculateTax(TaxQuery query) { try { var getType = Payspace.Models.Repository.CodeTaxTypes.GetTaxType(query.Code); decimal tax = 0; switch (getType) { case "Progressive": tax = CalculateProgressiveTax(query.Income); break; case "Flat Value": tax = CalculateFlatValue(query.Income); break; case "Flat rate": tax = CalculateFlatRate(query.Income); break; default: tax = 0; break; } if (tax > 0) { SaveChanges(query.Income, query.Code, tax); } return(tax); } catch { return(0); } }
public decimal AssessmentTaxes(TaxQuery taxQuery) { try { return(_taxLogic.TaxAssessment(taxQuery)); } catch (Exception exception) { throw; } }