public void Test_Mandate_GetForBankAccount()
        {
            try
            {
                UserNaturalDTO user          = this.GetJohn(true);
                string         bankAccountId = this.GetJohnsAccount(true).Id;
                string         returnUrl     = "http://test.test";
                MandatePostDTO mandatePost   = new MandatePostDTO(bankAccountId, CultureCode.EN, returnUrl);

                MandateDTO mandateCreated = this.Api.Mandates.Create(mandatePost);

                ListPaginated <MandateDTO> mandates = this.Api.Mandates.GetForBankAccount(user.Id, bankAccountId, new Pagination(1, 1), null);

                Assert.IsNotNull(mandateCreated);
                Assert.IsNotNull(mandates);
                Assert.IsTrue(mandates.Count > 0);

                Assert.IsNotNull(mandates[0]);
                Assert.IsFalse(String.IsNullOrEmpty(mandates[0].Id));
                Assert.AreEqual(mandateCreated.Id, mandates[0].Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_Idempotency_PayinsMandateDirectDebitCreate()
        {
            string         key           = DateTime.Now.Ticks.ToString();
            WalletDTO      wallet        = this.GetJohnsWallet();
            UserNaturalDTO user          = this.GetJohn();
            string         bankAccountId = this.GetJohnsAccount().Id;
            string         returnUrl     = "http://test.test";
            MandatePostDTO mandatePost   = new MandatePostDTO(bankAccountId, CultureCode.EN, returnUrl);
            MandateDTO     mandate       = this.Api.Mandates.Create(mandatePost);

            /*
             *	! IMPORTANT NOTE !
             *
             *	In order to make this test pass, at this place you have to set a breakpoint,
             *	navigate to URL the mandate.RedirectURL property points to and click "CONFIRM" button.
             *
             */
            PayInMandateDirectPostDTO payIn = new PayInMandateDirectPostDTO(user.Id,
                                                                            new Money {
                Amount = 10000, Currency = CurrencyIso.EUR
            },
                                                                            new Money {
                Amount = 0, Currency = CurrencyIso.EUR
            }, wallet.Id, "http://test.test", mandate.Id);

            Api.PayIns.CreateMandateDirectDebit(key, payIn);

            var result = Api.Idempotency.Get(key);

            Assert.IsInstanceOf <PayInMandateDirectDTO>(result.Resource);
        }
Пример #3
0
        /*
         * Uncomment the attribute below to test mandate cancellation.
         * This test needs your manual confirmation on the web page (see note in test's body)
         */
        //[Test]
        public async Task test_Mandate_Cancel()
        {
            var temp = await this.GetJohnsAccount();

            string bankAccountId = temp.Id;
            string returnUrl     = "http://test.test";

            MandatePostDTO mandatePost = new MandatePostDTO(bankAccountId, CultureCode.EN, returnUrl);

            MandateDTO mandate = await this.Api.Mandates.Create(mandatePost);

            //	! IMPORTANT NOTE !
            //
            //	In order to make this test pass, at this place you have to set a breakpoint,
            //	navigate to URL the mandate.RedirectURL property points to and click "CONFIRM" button.

            mandate = await this.Api.Mandates.Get(mandate.Id);

            Assert.IsTrue(mandate.Status == MandateStatus.SUBMITTED, "In order to make this test pass, after creating mandate and before cancelling it you have to navigate to URL the mandate.RedirectURL property points to and click CONFIRM button.");

            mandate = await this.Api.Mandates.Cancel(mandate.Id);

            Assert.IsNotNull(mandate);
            Assert.IsTrue(mandate.Status == MandateStatus.FAILED);
        }
Пример #4
0
        protected MandateDTO GetNewMandate()
        {
            string         bankAccountId = GetJohnsAccount().Id;
            string         returnUrl     = "http://test.test";
            MandatePostDTO mandatePost   = new MandatePostDTO(bankAccountId, CultureCode.EN, returnUrl);
            MandateDTO     mandate       = Api.Mandates.Create(mandatePost);

            return(mandate);
        }
Пример #5
0
        /*
         * Uncomment the attribute below to test payins with a mandate
         * This test needs your manual confirmation on the web page (see note in test's body)
         */
        //[Test]
        public async Task Test_PayIns_MandateDirect_Create_Get()
        {
            try
            {
                WalletDTO wallet = await this.GetJohnsWallet();

                UserNaturalDTO user = await this.GetJohn();

                var johnsAccount = await GetJohnsAccount();

                string         bankAccountId = johnsAccount.Id;
                string         returnUrl     = "http://test.test";
                MandatePostDTO mandatePost   = new MandatePostDTO(bankAccountId, CultureCode.EN, returnUrl);
                MandateDTO     mandate       = await this.Api.Mandates.CreateAsync(mandatePost);

                /*
                 *	! IMPORTANT NOTE !
                 *
                 *	In order to make this test pass, at this place you have to set a breakpoint,
                 *	navigate to URL the mandate.RedirectURL property points to and click "CONFIRM" button.
                 *
                 */

                PayInMandateDirectPostDTO payIn = new PayInMandateDirectPostDTO(user.Id, new Money {
                    Amount = 10000, Currency = CurrencyIso.EUR
                }, new Money {
                    Amount = 0, Currency = CurrencyIso.EUR
                }, wallet.Id, "http://test.test", mandate.Id);

                PayInDTO createPayIn = await this.Api.PayIns.CreateMandateDirectDebitAsync(payIn);

                Assert.IsNotNull(createPayIn);
                Assert.AreNotEqual(TransactionStatus.FAILED, createPayIn.Status, "In order to make this test pass, after creating mandate and before creating the payin you have to navigate to URL the mandate.RedirectURL property points to and click CONFIRM button.");

                Assert.IsTrue(createPayIn.Id.Length > 0);
                Assert.AreEqual(wallet.Id, createPayIn.CreditedWalletId);
                Assert.AreEqual(PayInPaymentType.DIRECT_DEBIT, createPayIn.PaymentType);
                Assert.AreEqual(PayInExecutionType.DIRECT, createPayIn.ExecutionType);
                Assert.AreEqual(user.Id, createPayIn.AuthorId);
                Assert.AreEqual(TransactionStatus.CREATED, createPayIn.Status);
                Assert.AreEqual(TransactionType.PAYIN, createPayIn.Type);
                Assert.IsNotNull(((PayInMandateDirectDTO)createPayIn).MandateId);
                Assert.AreEqual(((PayInMandateDirectDTO)createPayIn).MandateId, mandate.Id);

                PayInMandateDirectDTO getPayIn = await this.Api.PayIns.GetMandateDirectDebitAsync(createPayIn.Id);

                Assert.IsNotNull(getPayIn);
                Assert.IsTrue(getPayIn.Id == createPayIn.Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_Mandate_Create()
        {
            try
            {
                string         bankAccountId = this.GetJohnsAccount().Id;
                string         returnUrl     = "http://test.test";
                MandatePostDTO mandatePost   = new MandatePostDTO(bankAccountId, CultureCode.EN, returnUrl);

                MandateDTO mandate = this.Api.Mandates.Create(mandatePost);
                Assert.IsNotNull(mandate);
                Assert.IsFalse(String.IsNullOrEmpty(mandate.Id));
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Пример #7
0
        public async Task Test_Mandate_Get()
        {
            try
            {
                var temp = await this.GetJohnsAccount();

                string         bankAccountId = temp.Id;
                string         returnUrl     = "http://test.test";
                MandatePostDTO mandatePost   = new MandatePostDTO(bankAccountId, CultureCode.EN, returnUrl);

                MandateDTO mandateCreated = await this.Api.Mandates.Create(mandatePost);

                MandateDTO mandate = await this.Api.Mandates.Get(mandateCreated.Id);

                Assert.IsNotNull(mandate);
                Assert.IsFalse(String.IsNullOrEmpty(mandate.Id));
                Assert.AreEqual(mandateCreated.Id, mandate.Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }