public async Task GetFeeAsync_Should_Return_No_Fee_TF_No_Matching_Slab()
        {
            // arrange
            var fees = new List <FeeResponse>
            {
                new FeeResponse {
                    Fee = 10, Amount = 1000
                },
                new FeeResponse {
                    Fee = 5, Amount = 2000
                },
            };

            _mockProvider.GetTransactionFeeAsync("US", "IN", _cxlToken)
            .Returns(Task.FromResult(fees));

            // act
            var result = await _service.GetFeeAsync("US", "IN", 2001, _cxlToken);

            // assert
            Assert.Multiple(() =>
            {
                Assert.AreEqual(1, result.Count);
                Assert.AreEqual("TF", result.First().FeeCode);
                Assert.AreEqual(0, result.First().Amount);
            });
        }
        public async Task <List <FeeDto> > GetFeeAsync(string fromCountryCode, string toCountryCode, decimal transferAmount, CancellationToken cxlToken)
        {
            if (string.IsNullOrEmpty(fromCountryCode) || string.IsNullOrEmpty(toCountryCode))
            {
                throw new ArgumentNullException("countryCode");
            }

            if (transferAmount <= 0)
            {
                throw new ArgumentException("Amount must be greater than 0");
            }

            var providerSlab = await _provider.GetTransactionFeeAsync(fromCountryCode, toCountryCode, cxlToken);

            var providerFee = providerSlab?.OrderBy(t => t.Amount).FirstOrDefault(t => transferAmount < t.Amount)?.Fee ?? 0;

            var additionalFees = (await _feeRepository.GetApplicableFeesAsync(fromCountryCode, toCountryCode))
                                 ?? new List <Fee>();

            additionalFees.Add(new Fee {
                Amount = providerFee, FeeCode = "TF", FeeName = "Transfer Fee"
            });

            return(additionalFees.Select(t => new FeeDto
            {
                Amount = t.Amount,
                FeeName = t.FeeName,
                FeeCode = t.FeeCode
            }).ToList());
        }