示例#1
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);
        }
        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);
        }
        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);
            }
        }
示例#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);
            }
        }
示例#6
0
        protected async Task <MandateDTO> GetNewMandate()
        {
            var john = await GetJohnsAccount();

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

            return(mandate);
        }
示例#7
0
        public async Task Test_Idempotency_MandateCreate()
        {
            string         key           = DateTime.Now.Ticks.ToString();
            string         bankAccountId = this.GetJohnsAccount().Result.Id;
            string         returnUrl     = "http://test.test";
            MandatePostDTO mandatePost   = new MandatePostDTO(bankAccountId, CultureCode.EN, returnUrl);
            await Api.Mandates.Create(key, mandatePost);

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

            Assert.IsInstanceOf <MandateDTO>(result.Resource);
        }
        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);
            }
        }
示例#9
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);
            }
        }
 /// <summary>Creates new mandate.</summary>
 /// <param name="idempotencyKey">Idempotency key for this request.</param>
 /// <param name="mandate">Mandate instance to be created.</param>
 /// <returns>Mandate instance returned from API.</returns>
 public async Task <MandateDTO> Create(string idempotencyKey, MandatePostDTO mandate)
 {
     return(await this.CreateObject <MandateDTO, MandatePostDTO>(idempotencyKey, MethodKey.MandateCreate, mandate));
 }
 /// <summary>Creates new mandate.</summary>
 /// <param name="mandate">Mandate instance to be created.</param>
 /// <returns>Mandate instance returned from API.</returns>
 public async Task <MandateDTO> Create(MandatePostDTO mandate)
 {
     return(await Create(null, mandate));
 }
        public async Task <MandateDTO> Create(string idempotencyKey, MandatePostDTO mandate)
        {
            var targetUrl = $"{_baseUrl}/mandates/";

            return(await CreateEntity <MandateDTO, MandatePostDTO>(targetUrl, mandate, idempotencyKey));
        }
        public async Task <MandateDTO> Create(MandatePostDTO mandate)
        {
            var targetUrl = $"{_baseUrl}/mandates/";

            return(await CreateEntity <MandateDTO, MandatePostDTO>(targetUrl, mandate));
        }
示例#14
0
 /// <summary>Creates new mandate.</summary>
 /// <param name="idempotencyKey">Idempotency key for this request.</param>
 /// <param name="mandate">Mandate instance to be created.</param>
 /// <returns>Mandate instance returned from API.</returns>
 public MandateDTO Create(string idempotencyKey, MandatePostDTO mandate)
 {
     return(this.CreateObject <MandateDTO, MandatePostDTO>(idempotencyKey, MethodKey.MandateCreate, mandate));
 }
示例#15
0
 /// <summary>Creates new mandate.</summary>
 /// <param name="mandate">Mandate instance to be created.</param>
 /// <returns>Mandate instance returned from API.</returns>
 public MandateDTO Create(MandatePostDTO mandate)
 {
     return(Create(null, mandate));
 }