public TaxResultsCA FindTaxRates(TaxSearchCA searchBy, ITaxRatesRepositoryCA repo) { _logger.Verbose($"{this.GetType().Name} IN FindTaxRates"); var check = searchBy.IsValid(); if (!check.validStatus) { _logger.Error(check.whyNot); throw new ArgumentException(check.whyNot); } var fetchedRecord = repo.FetchByZipcode(searchBy.ForwardStationArea, searchBy.LocalDeliveryUnit, searchBy.OnDate); if (fetchedRecord == null) { var notFoundMsg = string.Format( "TaxRates for {0} {1} were not found" , searchBy.ForwardStationArea , searchBy.LocalDeliveryUnit ); _logger.Error(notFoundMsg); throw new KeyNotFoundException(notFoundMsg); } var results = new TaxResultsCA() { TaxRateGST = fetchedRecord.TaxRateGST , TaxRatePST = fetchedRecord.TaxRatePST , TaxRateHST = fetchedRecord.TaxRateHST }; return(results); }
public FindTaxRatesCAImpl(ILogger logger, ITaxRatesRepositoryCA useTaxRatesRepositoryCA, ITaxRatesRepositoryCA salesTaxRatesRepositoryCA) { // logger _logger = logger; _logger.Verbose($"{this.GetType().Name} IN Constructor"); // repos _useTaxRatesRepositoryCA = useTaxRatesRepositoryCA; _salesTaxRatesRepositoryCA = salesTaxRatesRepositoryCA; }