Ejemplo n.º 1
0
        public void Test_Client_GetKycDocuments()
        {
            ListPaginated<KycDocumentDTO> result = null;
            ListPaginated<KycDocumentDTO> result2 = null;

            try
            {
                result = this.Api.Clients.GetKycDocuments(null, null);
                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);

                Pagination pagination = new Pagination(1, 2);
                Sort sort = new Sort();
                sort.AddField("CreationDate", SortDirection.asc);
                result = this.Api.Clients.GetKycDocuments(pagination, null, sort);
                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);

                sort = new Sort();
                sort.AddField("CreationDate", SortDirection.desc);
                result2 = this.Api.Clients.GetKycDocuments(pagination, null, sort);
                Assert.IsNotNull(result2);
                Assert.IsTrue(result2.Count > 0);

                Assert.IsTrue(result[0].Id != result2[0].Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Ejemplo n.º 2
0
        public void Test_Events_GetAll_SortByCreationDate()
        {
            try
            {
                PayInCardWebDTO payIn1 = GetJohnsNewPayInCardWeb();
                PayInCardWebDTO payIn2 = GetJohnsNewPayInCardWeb();

                FilterEvents eventsFilter = new FilterEvents();
                eventsFilter.BeforeDate = payIn2.CreationDate;
                eventsFilter.AfterDate = payIn1.CreationDate;
                eventsFilter.Type = EventType.PAYIN_NORMAL_CREATED;

                Sort sort = new Sort();
                sort.AddField("Date", SortDirection.desc);

                Pagination pagination = new Pagination();

                ListPaginated<EventDTO> result = this.Api.Events.GetAll(pagination, eventsFilter, sort);

                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 1);
                Assert.IsTrue(result[0].Date > result[1].Date);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Ejemplo n.º 3
0
        public void Initialize()
        {
            Sort sort = new Sort();
            sort.AddField("CreationDate", SortDirection.desc);

            _clientDisputes = Api.Disputes.GetAll(new Pagination(1, 100), null, sort);

            if (_clientDisputes == null || _clientDisputes.Count == 0)
                Assert.Fail("INITIALIZATION FAILURE - cannot test disputes");
        }
Ejemplo n.º 4
0
        public void Test_Wallets_Transactions_With_Sorting()
        {
            WalletDTO wallet = this.GetJohnsWallet();

            // create 2 payins
            this.GetJohnsPayInCardWeb();
            this.GetNewPayInCardWeb();
            Sort sort = new Sort();
            sort.AddField("CreationDate", SortDirection.desc);
            Pagination pagination = new Pagination(1, 20);
            FilterTransactions filter = new FilterTransactions();
            filter.Type = TransactionType.PAYIN;

            ListPaginated<TransactionDTO> transactions = this.Api.Wallets.GetTransactions(wallet.Id, pagination, filter, sort);

            Assert.IsTrue(transactions[0].CreationDate > transactions[1].CreationDate);
        }
Ejemplo n.º 5
0
        public void Test_Events_Get()
        {
            try
            {
                FilterEvents eventsFilter = new FilterEvents();
                eventsFilter.Type = EventType.PAYIN_NORMAL_CREATED;

                ListPaginated<EventDTO> getEvents = this.Api.Events.GetAll(null, eventsFilter);

                eventsFilter.Type = EventType.All;
                ListPaginated<EventDTO> getAllEvents = this.Api.Events.GetAll(null, eventsFilter);

                Assert.IsNotNull(getEvents);
                Assert.IsNotNull(getAllEvents);

                // test sorting
                ListPaginated<EventDTO> result = null;
                ListPaginated<EventDTO> result2 = null;

                Pagination pagination = new Pagination(1, 2);
                Sort sort = new Sort();
                sort.AddField("CreationDate", SortDirection.asc);
                result = this.Api.Events.GetAll(pagination, eventsFilter, sort);
                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);

                sort = new Sort();
                sort.AddField("CreationDate", SortDirection.desc);
                result2 = this.Api.Events.GetAll(pagination, eventsFilter, sort);
                Assert.IsNotNull(result2);
                Assert.IsTrue(result2.Count > 0);

                Assert.IsTrue(result[0].ResourceId != result2[0].ResourceId);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Ejemplo n.º 6
0
        public void Test_Users_AllCards()
        {
            try
            {
                UserNaturalDTO john = this.GetJohn();
                PayInCardDirectDTO payIn = this.GetNewPayInCardDirect();
                Pagination pagination = new Pagination(1, 1);
                CardDTO card = this.Api.Cards.Get(payIn.CardId);
                ListPaginated<CardDTO> cards = this.Api.Users.GetCards(john.Id, pagination);

                Assert.IsTrue(cards.Count == 1);
                Assert.IsTrue(cards[0].CardType != CardType.NotSpecified);
                AssertEqualInputProps(cards[0], card);

                // test sorting
                ListPaginated<CardDTO> result = null;
                ListPaginated<CardDTO> result2 = null;

                pagination = new Pagination(1, 2);
                Sort sort = new Sort();
                sort.AddField("CreationDate", SortDirection.asc);
                result = this.Api.Users.GetCards(john.Id, pagination, sort);
                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);

                sort = new Sort();
                sort.AddField("CreationDate", SortDirection.desc);
                result2 = this.Api.Users.GetCards(john.Id, pagination, sort);
                Assert.IsNotNull(result2);
                Assert.IsTrue(result2.Count > 0);

                Assert.IsTrue(result[0].Id != result2[0].Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Ejemplo n.º 7
0
        public void Test_Users_BankAccounts()
        {
            try
            {
                UserNaturalDTO john = this.GetJohn();
                BankAccountIbanDTO account = this.GetJohnsAccount();
                Pagination pagination = new Pagination(1, 12);

                ListPaginated<BankAccountDTO> list = this.Api.Users.GetBankAccounts(john.Id, pagination);

                int listIndex;
                for (listIndex = 0; listIndex < list.Count; listIndex++)
                {
                    if (list[listIndex].Id == account.Id) break;
                }

                Assert.IsTrue(list[listIndex] is BankAccountDTO);

                BankAccountIbanDTO castedBankAccount = this.Api.Users.GetBankAccountIban(john.Id, list[listIndex].Id);

                Assert.IsTrue(account.Id == castedBankAccount.Id);
                AssertEqualInputProps(account, castedBankAccount);
                Assert.IsTrue(pagination.Page == 1);
                Assert.IsTrue(pagination.ItemsPerPage == 12);

                // test sorting
                ListPaginated<BankAccountDTO> result = null;
                ListPaginated<BankAccountDTO> result2 = null;

                BankAccountOtherPostDTO account2 = new BankAccountOtherPostDTO(john.FirstName + " " + john.LastName, john.Address, "234234234234", "BINAADADXXX");
                account2.Type = BankAccountType.OTHER;
                account2.Country = CountryIso.FR;

                this.Api.Users.CreateBankAccountOther(john.Id, account2);

                pagination = new Pagination(1, 2);
                Sort sort = new Sort();
                sort.AddField("CreationDate", SortDirection.asc);
                result = this.Api.Users.GetBankAccounts(john.Id, pagination, sort);
                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);

                sort = new Sort();
                sort.AddField("CreationDate", SortDirection.desc);
                result2 = this.Api.Users.GetBankAccounts(john.Id, pagination, sort);
                Assert.IsNotNull(result2);
                Assert.IsTrue(result2.Count > 0);

                Assert.IsTrue(result[0].Id != result2[0].Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Ejemplo n.º 8
0
        public void Test_Users_Transactions()
        {
            try
            {
                UserNaturalDTO john = this.GetJohn();
                TransferDTO transfer = this.GetNewTransfer();
                Pagination pagination = new Pagination(1, 1);

                ListPaginated<TransactionDTO> transactions = this.Api.Users.GetTransactions(john.Id, pagination, new FilterTransactions());

                Assert.IsTrue(transactions.Count > 0);

                // test sorting
                ListPaginated<TransactionDTO> result = null;
                ListPaginated<TransactionDTO> result2 = null;

                pagination = new Pagination(1, 2);
                Sort sort = new Sort();
                sort.AddField("CreationDate", SortDirection.asc);
                result = this.Api.Users.GetTransactions(john.Id, pagination, new FilterTransactions(), sort);
                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);

                sort = new Sort();
                sort.AddField("CreationDate", SortDirection.desc);
                result2 = this.Api.Users.GetTransactions(john.Id, pagination, new FilterTransactions(), sort);
                Assert.IsNotNull(result2);
                Assert.IsTrue(result2.Count > 0);

                Assert.IsTrue(result[0].Id != result2[0].Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Ejemplo n.º 9
0
        public void Test_Users_GetKycDocuments()
        {
            ListPaginated<KycDocumentDTO> result = null;

            UserNaturalDTO john = this.GetJohn();
            KycDocumentDTO kycDocument = this.GetJohnsKycDocument();

            try
            {
                result = this.Api.Users.GetKycDocuments(john.Id, null, null);

                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);

                // test sorting
                GetNewKycDocument();
                result = null;
                ListPaginated<KycDocumentDTO> result2 = null;

                Pagination pagination = new Pagination(1, 2);
                Sort sort = new Sort();
                sort.AddField("CreationDate", SortDirection.asc);
                result = this.Api.Users.GetKycDocuments(john.Id, pagination, null, sort);
                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);

                sort = new Sort();
                sort.AddField("CreationDate", SortDirection.desc);
                result2 = this.Api.Users.GetKycDocuments(john.Id, pagination, null, sort);
                Assert.IsNotNull(result2);
                Assert.IsTrue(result2.Count > 0);

                Assert.IsTrue(result[0].Id != result2[0].Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Ejemplo n.º 10
0
        public void Test_Users_GetAll()
        {
            try
            {
                ListPaginated<UserDTO> users = this.Api.Users.GetAll();

                Assert.IsNotNull(users);
                Assert.IsTrue(users.Count > 0);

                // test sorting
                ListPaginated<UserDTO> result = null;
                ListPaginated<UserDTO> result2 = null;

                Pagination pagination = new Pagination(1, 2);
                Sort sort = new Sort();
                sort.AddField("CreationDate", SortDirection.asc);
                result = this.Api.Users.GetAll(pagination, sort);
                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);

                sort = new Sort();
                sort.AddField("CreationDate", SortDirection.desc);
                result2 = this.Api.Users.GetAll(pagination, sort);
                Assert.IsNotNull(result2);
                Assert.IsTrue(result2.Count > 0);

                Assert.IsTrue(result[0].Id != result2[0].Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }