Exemple #1
0
        public void TestGetTransactionDetails_Success()
        {
            var credentials = new Dictionary <String, String> {
                { "ID", "311913289" }, { "Last 6 digits", "742989" }, { "Password", "w2e3r4t5" }
            };
            var amexApi      = new Providers.Cards.Amex.AmexApi(credentials);
            var transactions = amexApi.GetTransactions(0, DateTime.Now.AddMonths(-1).Year, DateTime.Now.AddMonths(-1).Month);

            foreach (var trs in transactions)
            {
                var isInbound = !string.IsNullOrEmpty(trs.DealsInbound) && !trs.DealsInbound.Equals("no", StringComparison.CurrentCultureIgnoreCase);
                var voucher   = string.IsNullOrEmpty(trs.DealsInbound)
                    ? trs.VoucherNumberRatzOutbound
                    : trs.VoucherNumberRatz;

                if (Convert.ToInt64(voucher) == 0)
                {
                    continue;
                }

                var deatils = amexApi.GetTransactionDetails(0, "012019", isInbound, voucher);

                Assert.NotEmpty(deatils.Sector);
                if (isInbound)
                {
                    Assert.NotEmpty(deatils.Address);
                }
            }

            amexApi.Dispose();
        }
Exemple #2
0
        public void TestGetCards_Success()
        {
            var credentials = new Dictionary <String, String> {
                { "ID", "311913289" }, { "Last 6 digits", "742989" }, { "Password", "w2e3r4t5" }
            };
            var amexApi = new Providers.Cards.Amex.AmexApi(credentials);
            var cards   = amexApi.GetCards();

            amexApi.Dispose();

            Assert.True(cards.Any());
        }
Exemple #3
0
        public void TestGetTransactions_Failed()
        {
            var credentials = new Dictionary <String, String> {
                { "ID", "311913289" }, { "Last 6 digits", "742989" }, { "Password", "w2e3r4t5" }
            };
            var amexApi   = new Providers.Cards.Amex.AmexApi(credentials);
            var exception = Assert.Throws <Exception>(() => amexApi.GetTransactions(10, DateTime.Now.AddMonths(-1).Year, DateTime.Now.AddMonths(-1).Month));

            amexApi.Dispose();

            Assert.NotNull(exception);
        }
Exemple #4
0
        public void TestGetTransactions_Success()
        {
            var credentials = new Dictionary <String, String> {
                { "ID", "311913289" }, { "Last 6 digits", "742989" }, { "Password", "w2e3r4t5" }
            };
            var amexApi      = new Providers.Cards.Amex.AmexApi(credentials);
            var transactions = amexApi.GetTransactions(0, DateTime.Now.AddMonths(-1).Year, DateTime.Now.AddMonths(-1).Month);

            amexApi.Dispose();

            Assert.True(transactions.Any());
        }
Exemple #5
0
        public void TestGetBankDebit_Success()
        {
            var credentials = new Dictionary <String, String> {
                { "ID", "311913289" }, { "Last 6 digits", "742989" }, { "Password", "w2e3r4t5" }
            };
            var amexApi = new Providers.Cards.Amex.AmexApi(credentials);

            var debits = amexApi.GetBankDebit("129249", "2989", DateTime.Now.AddMonths(-1).Year, DateTime.Now.AddMonths(-1).Month);

            amexApi.Dispose();

            Assert.True(debits.All(c => c.CardNumber == "2989"));
        }
Exemple #6
0
        public void TestDisposeApi_Success()
        {
            var credentials = new Dictionary <String, String> {
                { "ID", "311913289" }, { "Last 6 digits", "742989" }, { "Password", "w2e3r4t5" }
            };
            var amexApi = new Providers.Cards.Amex.AmexApi(credentials);

            try
            {
                amexApi.Dispose();
            }
            catch (Exception ex)
            {
                Assert.Null(ex);
            }
        }