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); } }
public async Task Test_CardPreAuthorization_Create_WithBilling() { try { var john = await GetJohn(); CardPreAuthorizationPostDTO cardPreAuthorization = await GetPreAuthorization(john.Id); Billing billing = new Billing(); Address address = new Address { City = "Test city", AddressLine1 = "Test address line 1", AddressLine2 = "Test address line 2", Country = CountryIso.RO, PostalCode = "65400" }; billing.Address = address; cardPreAuthorization.Billing = billing; CardPreAuthorizationDTO cardPreAuthorizationWithBilling = await this.Api.CardPreAuthorizations.CreateAsync(cardPreAuthorization); Assert.IsNotNull(cardPreAuthorizationWithBilling); Assert.IsNotNull(cardPreAuthorizationWithBilling.Billing); Assert.IsNotNull(cardPreAuthorizationWithBilling.SecurityInfo); Assert.IsNotNull(cardPreAuthorizationWithBilling.SecurityInfo.AVSResult); Assert.AreEqual(cardPreAuthorizationWithBilling.SecurityInfo.AVSResult, AVSResult.NO_CHECK); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Test_CardPreAuthorization_Create_WithBilling() { try { CardPreAuthorizationPostDTO cardPreAuthorization = getPreAuthorization(GetJohn().Id); Billing billing = new Billing(); Address address = new Address(); address.City = "Test city"; address.AddressLine1 = "Test address line 1"; address.AddressLine2 = "Test address line 2"; address.Country = CountryIso.RO; address.PostalCode = "65400"; billing.Address = address; cardPreAuthorization.Billing = billing; CardPreAuthorizationDTO cardPreAuthorizationWithBilling = this.Api.CardPreAuthorizations.Create(cardPreAuthorization); Assert.IsNotNull(cardPreAuthorizationWithBilling); Assert.IsNotNull(cardPreAuthorizationWithBilling.Billing); Assert.IsNotNull(cardPreAuthorizationWithBilling.SecurityInfo); Assert.IsNotNull(cardPreAuthorizationWithBilling.SecurityInfo.AVSResult); Assert.AreEqual(cardPreAuthorizationWithBilling.SecurityInfo.AVSResult, AVSResult.NO_CHECK); } catch (Exception ex) { Assert.Fail(ex.Message); } }
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); }
public void Test_CardPreAuthorization_Get() { try { CardPreAuthorizationDTO cardPreAuthorization = this.GetJohnsCardPreAuthorization(); CardPreAuthorizationDTO getCardPreAuthorization = this.Api.CardPreAuthorizations.Get(cardPreAuthorization.Id); Assert.AreEqual(cardPreAuthorization.Id, getCardPreAuthorization.Id); Assert.AreEqual(getCardPreAuthorization.ResultCode, "000000"); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public async Task Test_CardPreAuthorization_Get() { try { CardPreAuthorizationDTO cardPreAuthorization = await this.GetJohnsCardPreAuthorization(); CardPreAuthorizationDTO getCardPreAuthorization = await this.Api.CardPreAuthorizations.GetAsync(cardPreAuthorization.Id); Assert.AreEqual(cardPreAuthorization.Id, getCardPreAuthorization.Id); Assert.AreEqual(getCardPreAuthorization.ResultCode, "000000"); Assert.IsNotNull(getCardPreAuthorization.MultiCapture); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Test_CardPreAuthorization_Create() { try { CardPreAuthorizationDTO cardPreAuthorization = this.GetJohnsCardPreAuthorization(); Assert.IsTrue(cardPreAuthorization.Id.Length > 0); Assert.AreEqual(cardPreAuthorization.Status, PreAuthorizationStatus.SUCCEEDED); Assert.AreEqual(cardPreAuthorization.PaymentStatus, PaymentStatus.WAITING); Assert.AreEqual(cardPreAuthorization.ExecutionType, PreAuthorizationExecutionType.DIRECT); Assert.IsNull(cardPreAuthorization.PayInId); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Test_CardPreAuthorization_Update() { try { CardPreAuthorizationDTO cardPreAuthorization = this.GetJohnsCardPreAuthorization(); CardPreAuthorizationPutDTO cardPreAuthorizationPut = new CardPreAuthorizationPutDTO(); cardPreAuthorizationPut.Tag = cardPreAuthorization.Tag; cardPreAuthorizationPut.PaymentStatus = PaymentStatus.CANCELED; CardPreAuthorizationDTO resultCardPreAuthorization = this.Api.CardPreAuthorizations.Update(cardPreAuthorizationPut, cardPreAuthorization.Id); Assert.AreEqual(resultCardPreAuthorization.Status, PreAuthorizationStatus.SUCCEEDED); Assert.AreEqual(resultCardPreAuthorization.PaymentStatus, PaymentStatus.CANCELED); } catch (Exception ex) { Assert.Fail(ex.Message); } }