Exemple #1
0
        public void Test_Payins_CardDirect_Create_WithBilling()
        {
            try
            {
                WalletDTO      johnWallet = this.GetJohnsWalletWithMoney();
                WalletDTO      wallet     = this.Api.Wallets.Get(johnWallet.Id);
                UserNaturalDTO user       = this.GetJohn();

                PayInCardDirectDTO payIn = this.GetNewPayInCardDirectWithBilling();

                Assert.IsTrue(payIn.Id.Length > 0);
                Assert.AreEqual(wallet.Id, payIn.CreditedWalletId);
                Assert.AreEqual(PayInPaymentType.CARD, payIn.PaymentType);
                Assert.AreEqual(PayInExecutionType.DIRECT, payIn.ExecutionType);
                Assert.IsTrue(payIn.DebitedFunds is Money);
                Assert.IsTrue(payIn.CreditedFunds is Money);
                Assert.IsTrue(payIn.Fees is Money);
                Assert.AreEqual(user.Id, payIn.AuthorId);
                Assert.AreEqual(TransactionStatus.SUCCEEDED, payIn.Status);
                Assert.AreEqual(TransactionType.PAYIN, payIn.Type);
                Assert.IsNotNull(payIn.Billing);
                Assert.IsNotNull(payIn.SecurityInfo);
                Assert.IsNotNull(payIn.SecurityInfo.AVSResult);
                Assert.AreEqual(payIn.SecurityInfo.AVSResult, AVSResult.ADDRESS_MATCH_ONLY);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Exemple #2
0
        public async Task Test_Users_AllCards()
        {
            try
            {
                UserNaturalDTO john = await this.GetJohn();

                PayInCardDirectDTO payIn = await this.GetNewPayInCardDirect();

                Pagination pagination = new Pagination(1, 1);
                CardDTO    card       = await this.Api.Cards.Get(payIn.CardId);

                ListPaginated <CardDTO> cards = await 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 = await 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 = await 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);
            }
        }
        public void Test_PayIns_Get_CardDirect()
        {
            try
            {
                PayInCardDirectDTO payIn = this.GetNewPayInCardDirect();

                PayInCardDirectDTO getPayIn = this.Api.PayIns.GetCardDirect(payIn.Id);

                Assert.IsTrue(payIn.Id == getPayIn.Id);
                Assert.IsTrue(payIn.PaymentType == PayInPaymentType.CARD);
                Assert.IsTrue(payIn.ExecutionType == PayInExecutionType.DIRECT);
                AssertEqualInputProps(payIn, getPayIn);
                Assert.IsNotNull(getPayIn.CardId);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_PayIns_Get_CardDirect()
        {
            try
            {
                PayInCardDirectDTO payIn = TestHelper.GetNewPayInCardDirect();

                PayInCardDirectDTO getPayIn = _objectToTest.GetCardDirect(payIn.Id).Result;

                Assert.True(payIn.Id == getPayIn.Id);
                Assert.True(payIn.PaymentType == PayInPaymentType.CARD);
                Assert.True(payIn.ExecutionType == PayInExecutionType.DIRECT);
                TestHelper.AssertEqualInputProps(payIn, getPayIn);
                Assert.NotNull(getPayIn.CardId);
            }
            catch (Exception ex)
            {
                Assert.True(false, ex.Message);
            }
        }
Exemple #5
0
        public async Task Test_Card_GetByFingerprint()
        {
            PayInCardDirectDTO payIn = await GetNewPayInCardDirect();

            Assert.IsNotNull(payIn, "PayIn object is null!");
            CardDTO card = await Api.Cards.GetAsync(payIn.CardId);

            Assert.IsNotNull(card, "Card is null!");
            Assert.IsNotNull(card.Fingerprint, "Card fingerprint is null!");
            Assert.IsNotEmpty(card.Fingerprint, "Card fingerprint is empty!");

            ListPaginated <CardDTO> cards = await Api.Cards.GetCardsByFingerprintAsync(card.Fingerprint);

            Assert.True(cards.Count > 0, "Card lsit is empty");

            foreach (CardDTO cardDTO in cards)
            {
                Assert.AreEqual(card.Fingerprint, cardDTO.Fingerprint);
            }
        }
Exemple #6
0
        public async Task Test_Card_GetTransactionsForCard()
        {
            try
            {
                PayInCardDirectDTO payIn = await GetNewPayInCardDirect();

                var pagination = new Pagination(1, 1);
                var filter     = new FilterTransactions();
                var sort       = new Sort();
                sort.AddField("CreationDate", SortDirection.desc);

                var transactions = await Api.Cards.GetTransactionsForCardAsync(payIn.CardId, pagination, filter, sort);

                Assert.IsTrue(transactions.Count > 0);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Exemple #7
0
        /// <summary>Creates PayOut Bank Wire object.</summary>
        /// <returns>PayOut Bank Wire instance returned from API.</returns>
        protected PayOutBankWireDTO GetJohnsPayOutForCardDirect()
        {
            if (BaseTest._johnsPayOutForCardDirect == null)
            {
                PayInCardDirectDTO payIn   = this.GetNewPayInCardDirect();
                BankAccountDTO     account = this.GetJohnsAccount();

                PayOutBankWirePostDTO payOut = new PayOutBankWirePostDTO(payIn.AuthorId, payIn.CreditedWalletId, new Money {
                    Amount = 10, Currency = CurrencyIso.EUR
                },
                                                                         new Money {
                    Amount = 5, Currency = CurrencyIso.EUR
                }, account.Id, "Johns bank wire ref");
                payOut.Tag            = "DefaultTag";
                payOut.CreditedUserId = payIn.AuthorId;

                BaseTest._johnsPayOutForCardDirect = this.Api.PayOuts.CreateBankWire(payOut);
            }

            return(BaseTest._johnsPayOutForCardDirect);
        }
Exemple #8
0
        public async Task Test_Card_GetByFingerprint_Paginated()
        {
            PayInCardDirectDTO payIn = await GetNewPayInCardDirect();

            Assert.IsNotNull(payIn, "PayIn object is null!");
            CardDTO card = await Api.Cards.GetAsync(payIn.CardId);

            Assert.IsNotNull(card, "Card is null!");
            Assert.IsNotNull(card.Fingerprint, "Card fingerprint is null!");
            Assert.IsNotEmpty(card.Fingerprint, "Card fingerprint is empty!");

            Pagination pagination         = new Pagination(1, 1);
            ListPaginated <CardDTO> cards = await Api.Cards.GetCardsByFingerprintAsync(card.Fingerprint, pagination, null);

            Assert.True(cards.Count == 1, String.Format("Requested 1 entity, got {0}", cards.Count));

            foreach (CardDTO cardDTO in cards)
            {
                Assert.AreEqual(card.Fingerprint, cardDTO.Fingerprint);
            }
        }
        public void Test_Users_AllCards()
        {
            try
            {
                UserNaturalDTO          john       = TestHelper.GetJohn();
                PayInCardDirectDTO      payIn      = TestHelper.GetNewPayInCardDirect();
                Pagination              pagination = new Pagination(1, 1);
                CardDTO                 card       = TestHelper.CardsApi.Get(payIn.CardId).Result;
                ListPaginated <CardDTO> cards      = _objectToTest.GetCards(john.Id, pagination).Result;

                Assert.True(cards.Count == 1);
                Assert.True(cards[0].CardType != CardType.NotSpecified);
                TestHelper.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 = _objectToTest.GetCards(john.Id, pagination, sort).Result;
                Assert.NotNull(result);
                Assert.True(result.Count > 0);

                sort = new Sort();
                sort.AddField("CreationDate", SortDirection.desc);
                result2 = _objectToTest.GetCards(john.Id, pagination, sort).Result;
                Assert.NotNull(result2);
                Assert.True(result2.Count > 0);

                Assert.True(result[0].Id != result2[0].Id);
            }
            catch (Exception ex)
            {
                Assert.True(false, ex.Message);
            }
        }