/// <summary>
        /// Method to Find Tax Rate
        /// </summary>
        /// <returns></returns>
        public async Task <TaxRateResponse> GetTaxRate(TaxRateRequest taxRateRequest)
        {
            //validate request
            _taxServiceValidator.ValidateTaxRateRequest(taxRateRequest);

            //Get Consumer Details
            var consumerDetail = _consumerHelper.GetConsumer();

            //Create api request
            var TaxRateResponseRequest = new TaxRateApiRequest()
            {
                Zip             = taxRateRequest.Zip,
                City            = taxRateRequest.City,
                Country         = taxRateRequest.Country,
                State           = taxRateRequest.State,
                Street          = taxRateRequest.Street,
                TaxApiAuthToken = consumerDetail.TaxApiAuthToken,
                TaxApiUrl       = consumerDetail.TaxApiUrl
            };

            //Call repository with valid request
            var response = await _taxRepository.GetTaxRate(TaxRateResponseRequest);

            return(response);
        }
Пример #2
0
        public decimal Calculate(decimal salary)
        {
            // To Do : 2013 = 10%, 2014 = 20%
            int taxRate = _taxRepo.GetTaxRate(_taxYear);

            return(salary * (100 - taxRate) / 100);
        }
        public async Task GivenACountryCode_ReturnsTaxRate()
        {
            _taxRepository = new TaxRepository(_connectionStringConfig.Object);

            var taxRates = await _taxRepository.GetTaxRate(CountryCode);

            taxRates.Single().TaxRate.ShouldBe(15);
        }
        public async Task <decimal> CalculateGiftAid(decimal donationAmount, string country, string eventType)
        {
            var taxList = await _taxRepository.GetTaxRate(country);

            if (!taxList.Any())
            {
                return(0);
            }

            var giftAidCalculator = _giftAidCalculatorFinder.Find(eventType);

            return(giftAidCalculator.Calculate(donationAmount, country, taxList.Single()));
        }
Пример #5
0
        public decimal Calculate(decimal salary)
        {
            int taxRate = _taxRepo.GetTaxRate(_taxYear);

            return(salary * (100 - taxRate) / 100);
        }