Beispiel #1
0
        public void TestGetCards_Success()
        {
            InitializeMapper();
            var credentials = new Dictionary <String, String> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var api      = new Providers.Cards.Cal.CalApi(credentials);
            var provider = new CalProvider(api);
            var cards    = provider.GetCards();

            Assert.NotEmpty(cards);
            foreach (var card in cards)
            {
                Assert.NotNull(card.Debits);
                Assert.NotEmpty(card.Id);
                Assert.NotEmpty(card.HolderId);
                Assert.NotEmpty(card.TypeDescription);
                Assert.NotEmpty(card.CardName);
                Assert.NotEmpty(card.LastDigits);
                Assert.NotEmpty(card.OwnerFirstName);
                Assert.NotEmpty(card.OwnerLastName);

                Assert.NotNull(card.CardAccount);
                Assert.NotEmpty(card.CardAccount.AccountNumber);
                Assert.NotEmpty(card.CardAccount.Id);
                Assert.NotEmpty(card.CardAccount.BankName);
                Assert.True(card.CardAccount.BankBranchNumber > 0);
                Assert.True(card.CardAccount.BankCode > 0);
            }
        }
Beispiel #2
0
        public void TestGetCardsWithTransactionsWithDetails_Success()
        {
            InitializeMapper();
            var credentials = new Dictionary <String, String> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var api         = new Providers.Cards.Cal.CalApi(credentials);
            var provider    = new CalProvider(api);
            var descriptors = new List <CreditCardDescriptor>
            {
                new CreditCardDescriptor
                {
                    CardId = "01981802"
                }
            };

            var cards = provider.GetCardsWithTransactions(descriptors, DateTime.Now.AddMonths(-1), DateTime.Now, true);

            foreach (var card in cards)
            {
                Assert.NotEmpty(card.Id);
                Assert.NotEmpty(card.HolderId);
                Assert.NotEmpty(card.TypeDescription);
                Assert.NotEmpty(card.CardName);
                Assert.NotEmpty(card.LastDigits);
                Assert.NotEmpty(card.OwnerFirstName);
                Assert.NotEmpty(card.OwnerLastName);

                Assert.NotNull(card.CardAccount);
                Assert.NotEmpty(card.CardAccount.AccountNumber);
                Assert.NotEmpty(card.CardAccount.Id);
                Assert.NotEmpty(card.CardAccount.BankName);
                Assert.True(card.CardAccount.BankBranchNumber > 0);
                Assert.True(card.CardAccount.BankCode > 0);

                Assert.NotNull(card.Debits);
                Assert.NotEmpty(card.Debits);
                Assert.True(card.Debits.First().Date > DateTime.MinValue);
                Assert.NotEmpty(card.Debits.First().CardId);
                Assert.NotEmpty(card.Debits.First().CardLastDigits);
                Assert.True(card.Debits.First().Amount >= 0);

                foreach (var debit in card.Debits)
                {
                    Assert.NotEmpty(debit.CardId);
                    Assert.True(debit.Date > DateTime.MinValue);
                    Assert.NotEmpty(debit.CardLastDigits);

                    Decimal payment = 0;
                    foreach (var transaction in debit.Transactions)
                    {
                        payment = payment + transaction.PaymentAmount;
                    }
                    Assert.True(debit.Amount == payment);
                }
            }
        }
Beispiel #3
0
        public void TestGetValidCards_Success()
        {
            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi = new Providers.Cards.Cal.CalApi(credentials);
            var cards  = calApi.GetCards();

            calApi.Dispose();

            Assert.True(cards.BankAccounts.First().Cards.Count() == 2);
        }
Beispiel #4
0
        public void TestGetBankDebits_Fail()
        {
            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi    = new Providers.Cards.Cal.CalApi(credentials);
            var exception = Assert.Throws <Exception>(() =>
                                                      calApi.GetBankDebits("0052748202617", "01981802", DateTime.Now.AddMonths(-1), DateTime.Now));

            calApi.Dispose();

            Assert.NotNull(exception);
            Assert.StartsWith("Did not succeed to fetch debits for card 01981802", exception.Message, StringComparison.CurrentCultureIgnoreCase);
        }
Beispiel #5
0
        public void TestGetBankDebits_Success()
        {
            InitializeMapper();

            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi = new Providers.Cards.Cal.CalApi(credentials);
            var debits = calApi.GetBankDebits("00527482012617", "01981802", DateTime.Now.AddMonths(-1), DateTime.Now);

            calApi.Dispose();

            Assert.True(debits.Any());
        }
Beispiel #6
0
        public void TestDisposeApi_Success()
        {
            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi = new Providers.Cards.Cal.CalApi(credentials);

            try
            {
                calApi.Dispose();
            }
            catch (Exception ex)
            {
                Assert.Null(ex);
            }
        }
Beispiel #7
0
        public void TestGetTransactionDetails_Failed()
        {
            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi       = new Providers.Cards.Cal.CalApi(credentials);
            var transactions = calApi.GetTransactions("01981802", DateTime.Now.AddMonths(-1), DateTime.Now).ToList();

            var transactionId = transactions.First().Id.Substring(1);
            var numerator     = transactions.First().Numerator;

            var exception = Assert.Throws <Exception>(() => calApi.GetTransactionDetails(transactionId, numerator));

            calApi.Dispose();

            Assert.NotNull(exception);
        }
Beispiel #8
0
        public void TestGetTransactions_Success()
        {
            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi       = new Providers.Cards.Cal.CalApi(credentials);
            var transactions = calApi.GetTransactions("01981802", DateTime.Now.AddMonths(-1), DateTime.Now).ToList();

            calApi.Dispose();

            Assert.True(transactions.Any());
            foreach (var transaction in transactions)
            {
                Assert.NotEmpty(transaction.Id);
                Assert.NotEmpty(transaction.Currency);
                Assert.NotEmpty(transaction.CurrentPayment);
                Assert.NotEmpty(transaction.Date);
                Assert.NotEmpty(transaction.DebitDate);
                //Assert.NotEmpty(transaction.Notes);
                //Assert.NotEmpty(transaction.Comments);
            }
        }
Beispiel #9
0
        public void TestGetTransactionDetails_Success()
        {
            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi       = new Providers.Cards.Cal.CalApi(credentials);
            var transactions = calApi.GetTransactions("01981802", DateTime.Now.AddMonths(-1), DateTime.Now).ToList();

            foreach (var transaction in transactions)
            {
                var transactionId = transaction.Id;
                var numerator     = transaction.Numerator;
                var details       = calApi.GetTransactionDetails(transactionId, numerator);

                Assert.NotNull(details);
                Assert.NotNull(details.Data);
                Assert.NotNull(details.Data.MerchantDetails);
                //Assert.NotNull(details.Data.MerchantDetails.Address);
                //Assert.NotNull(details.Data.MerchantDetails.SectorName);
            }

            calApi.Dispose();
        }