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());
        }
        public async Task GetFeeAsync_Should_Return_Additional_Fee_If_Present()
        {
            // arrange
            var fees = new List <FeeResponse>
            {
                new FeeResponse {
                    Fee = 20, Amount = 1000
                },
                new FeeResponse {
                    Fee = 10, Amount = 2000
                },
                new FeeResponse {
                    Fee = 5, Amount = 3000
                }
            };

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

            var additionalFees = new List <Fee>
            {
                new Fee {
                    Amount = 100, FeeCode = "CF", FeeName = "Convenience Fee"
                }
            };

            _mockFeeRepository.GetApplicableFeesAsync("US", "IN")
            .Returns(Task.FromResult(additionalFees));

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

            // assert
            Assert.Multiple(() =>
            {
                Assert.AreEqual(2, result.Count);
                Assert.That(result.Exists(t => t.FeeCode == "TF"));
                Assert.That(result.Exists(t => t.FeeCode == "CF"));
                Assert.AreEqual(120, result.Sum(t => t.Amount));
            });
        }