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_GetTransactionsForMandate()
        {
            try
            {
                var mandate = GetNewMandate();

                WalletDTO                 wallet = GetJohnsWallet();
                UserNaturalDTO            user   = GetJohn();
                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 = this.Api.PayIns.CreateMandateDirectDebit(payIn);

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

                var transactions = Api.Mandates.GetTransactionsForMandate(mandate.Id, pagination, filter, sort);

                Assert.IsTrue(transactions.Count > 0);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Beispiel #3
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);
            }
        }
Beispiel #4
0
        public async Task <PayInMandateDirectDTO> CreateMandateDirectDebit(string idempotencyKey, PayInMandateDirectPostDTO payIn)
        {
            var targetUrl = $"{_baseUrl}/payins/directdebit/direct";

            return(await CreateEntity <PayInMandateDirectDTO, PayInMandateDirectPostDTO>(targetUrl, payIn, idempotencyKey));
        }
 /// <summary>Creates new payin mandate direct debit.</summary>
 /// <param name="idempotencyKey">Idempotency key for this request.</param>
 /// <param name="payIn">Object instance to be created.</param>
 /// <returns>Object instance returned from API.</returns>
 public PayInMandateDirectDTO CreateMandateDirectDebit(String idempotencyKey, PayInMandateDirectPostDTO payIn)
 {
     return(this.CreateObject <PayInMandateDirectDTO, PayInMandateDirectPostDTO>(idempotencyKey, MethodKey.PayinsMandateDirectDebitCreate, payIn));
 }
 /// <summary>Creates new payin mandate direct debit.</summary>
 /// <param name="payIn">Object instance to be created.</param>
 /// <returns>Object instance returned from API.</returns>
 public PayInMandateDirectDTO CreateMandateDirectDebit(PayInMandateDirectPostDTO payIn)
 {
     return(CreateMandateDirectDebit(null, payIn));
 }
 /// <summary>Creates new payin mandate direct debit.</summary>
 /// <param name="payIn">Object instance to be created.</param>
 /// <returns>Object instance returned from API.</returns>
 public async Task <PayInMandateDirectDTO> CreateMandateDirectDebit(PayInMandateDirectPostDTO payIn)
 {
     return(await CreateMandateDirectDebit(null, payIn));
 }
Beispiel #8
0
 /// <summary>Creates new payin mandate direct debit.</summary>
 /// <param name="idempotencyKey">Idempotency key for this request.</param>
 /// <param name="payIn">Object instance to be created.</param>
 /// <returns>Object instance returned from API.</returns>
 public async Task <PayInMandateDirectDTO> CreateMandateDirectDebitAsync(String idempotencyKey, PayInMandateDirectPostDTO payIn)
 {
     return(await this.CreateObjectAsync <PayInMandateDirectDTO, PayInMandateDirectPostDTO>(idempotencyKey, MethodKey.PayinsMandateDirectDebitCreate, payIn));
 }