コード例 #1
0
        public async Task Test_CardPreAuthorizationTransactions_Get()
        {
            try
            {
                var cardPreAuthorization = await this.GetJohnsCardPreAuthorization();

                var wallet = await this.GetJohnsWalletWithMoney();

                var user = await this.GetJohn();

                var payIn = new PayInPreauthorizedDirectPostDTO(user.Id,
                                                                new Money {
                    Amount = 10000, Currency = CurrencyIso.EUR
                },
                                                                new Money {
                    Amount = 0, Currency = CurrencyIso.EUR
                }, wallet.Id, cardPreAuthorization.Id)
                {
                    SecureModeReturnURL = "http://test.com"
                };

                await Api.PayIns.CreatePreauthorizedDirectAsync(payIn);

                var preAuthTransactions = await this.Api.CardPreAuthorizations.GetTransactionsAsync(cardPreAuthorization.Id, new Pagination(1, 10));

                Assert.NotNull(preAuthTransactions);
                Assert.NotNull(preAuthTransactions.ElementAt(0));
                Assert.AreEqual(preAuthTransactions.ElementAt(0).Status, TransactionStatus.SUCCEEDED);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
コード例 #2
0
        public void Test_PayIns_PreAuthorizedDirect()
        {
            try
            {
                CardPreAuthorizationDTO cardPreAuthorization = this.GetJohnsCardPreAuthorization();
                WalletDTO      wallet = this.GetJohnsWalletWithMoney();
                UserNaturalDTO user   = this.GetJohn();

                // create pay-in PRE-AUTHORIZED DIRECT
                PayInPreauthorizedDirectPostDTO payIn = new PayInPreauthorizedDirectPostDTO(user.Id, new Money {
                    Amount = 10000, Currency = CurrencyIso.EUR
                }, new Money {
                    Amount = 0, Currency = CurrencyIso.EUR
                }, wallet.Id, cardPreAuthorization.Id);

                payIn.SecureModeReturnURL = "http://test.com";

                PayInPreauthorizedDirectDTO createPayIn = this.Api.PayIns.CreatePreauthorizedDirect(payIn);

                Assert.IsTrue("" != createPayIn.Id);
                Assert.AreEqual(wallet.Id, createPayIn.CreditedWalletId);
                Assert.AreEqual(PayInPaymentType.PREAUTHORIZED, createPayIn.PaymentType);
                Assert.AreEqual(PayInExecutionType.DIRECT, createPayIn.ExecutionType);
                Assert.IsTrue(createPayIn.DebitedFunds is Money);
                Assert.IsTrue(createPayIn.CreditedFunds is Money);
                Assert.IsTrue(createPayIn.Fees is Money);
                Assert.AreEqual(user.Id, createPayIn.AuthorId);
                Assert.AreEqual(TransactionStatus.SUCCEEDED, createPayIn.Status);
                Assert.AreEqual(TransactionType.PAYIN, createPayIn.Type);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
コード例 #3
0
        public async Task Test_Idempotency_PayinsPreauthorizedDirectCreate()
        {
            string key    = DateTime.Now.Ticks.ToString();
            string okCode = "200";
            CardPreAuthorizationDTO cardPreAuthorization = await this.GetJohnsCardPreAuthorization();

            WalletDTO wallet = await this.GetJohnsWalletWithMoney();

            UserNaturalDTO user = await this.GetJohn();

            PayInPreauthorizedDirectPostDTO payIn = new PayInPreauthorizedDirectPostDTO(user.Id,
                                                                                        new Money {
                Amount = 10000, Currency = CurrencyIso.EUR
            },
                                                                                        new Money {
                Amount = 0, Currency = CurrencyIso.EUR
            }, wallet.Id, cardPreAuthorization.Id);

            payIn.SecureModeReturnURL = "http://test.com";
            await Api.PayIns.CreatePreauthorizedDirectAsync(key, payIn);

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

            Assert.AreEqual(result.StatusCode, okCode);
            Assert.IsInstanceOf <PayInPreauthorizedDirectDTO>(result.Resource);
        }
コード例 #4
0
        public async Task <PayInPreauthorizedDirectDTO> CreatePreauthorizedDirect(string idempotencyKey, PayInPreauthorizedDirectPostDTO payIn)
        {
            var targetUrl = $"{_baseUrl}/payins/preauthorized/direct";

            return(await CreateEntity <PayInPreauthorizedDirectDTO, PayInPreauthorizedDirectPostDTO>(targetUrl, payIn, idempotencyKey));
        }
コード例 #5
0
 /// <summary>Creates new payin preauthorized direct.</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 PayInPreauthorizedDirectDTO CreatePreauthorizedDirect(String idempotencyKey, PayInPreauthorizedDirectPostDTO payIn)
 {
     return(this.CreateObject <PayInPreauthorizedDirectDTO, PayInPreauthorizedDirectPostDTO>(idempotencyKey, MethodKey.PayinsPreauthorizedDirectCreate, payIn));
 }
コード例 #6
0
 /// <summary>Creates new payin preauthorized direct.</summary>
 /// <param name="payIn">Object instance to be created.</param>
 /// <returns>Object instance returned from API.</returns>
 public PayInPreauthorizedDirectDTO CreatePreauthorizedDirect(PayInPreauthorizedDirectPostDTO payIn)
 {
     return(CreatePreauthorizedDirect(null, payIn));
 }
コード例 #7
0
 /// <summary>Creates new payin preauthorized direct.</summary>
 /// <param name="payIn">Object instance to be created.</param>
 /// <returns>Object instance returned from API.</returns>
 public async Task <PayInPreauthorizedDirectDTO> CreatePreauthorizedDirect(PayInPreauthorizedDirectPostDTO payIn)
 {
     return(await CreatePreauthorizedDirect(null, payIn));
 }
コード例 #8
0
 /// <summary>Creates new payin preauthorized direct.</summary>
 /// <param name="payIn">Object instance to be created.</param>
 /// <returns>Object instance returned from API.</returns>
 public PayInPreauthorizedDirectDTO CreatePreauthorizedDirect(PayInPreauthorizedDirectPostDTO payIn)
 {
     return(this.CreateObject <PayInPreauthorizedDirectDTO, PayInPreauthorizedDirectPostDTO>(MethodKey.PayinsPreauthorizedDirectCreate, payIn));
 }
コード例 #9
0
 /// <summary>Creates new payin preauthorized direct.</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 <PayInPreauthorizedDirectDTO> CreatePreauthorizedDirectAsync(String idempotencyKey, PayInPreauthorizedDirectPostDTO payIn)
 {
     return(await this.CreateObjectAsync <PayInPreauthorizedDirectDTO, PayInPreauthorizedDirectPostDTO>(idempotencyKey, MethodKey.PayinsPreauthorizedDirectCreate, payIn));
 }