public async Task Test_Wallets_Get() { UserNaturalDTO john = await this.GetJohn(); WalletDTO wallet = await this.GetJohnsWallet(); WalletDTO getWallet = await this.Api.Wallets.GetAsync(wallet.Id); Assert.AreEqual(wallet.Id, getWallet.Id); Assert.IsTrue(wallet.Owners.Contains(john.Id)); }
protected PayInCardWebDTO CreateJohnsPayInCardWeb(string walletId) { UserNaturalDTO user = this.GetJohn(); PayInCardWebPostDTO payIn = new PayInCardWebPostDTO(user.Id, new Money { Amount = 1000, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, walletId, "https://test.com", CountryIso.FR, CardType.CB_VISA_MASTERCARD); return(this.Api.PayIns.CreateCardWeb(payIn)); }
protected BankAccountIbanDTO GetJohnsAccount() { if (BaseTest._johnsAccount == null) { UserNaturalDTO john = this.GetJohn(); BankAccountIbanPostDTO account = new BankAccountIbanPostDTO(john.FirstName + " " + john.LastName, john.Address, "FR76 1790 6000 3200 0833 5232 973"); account.UserId = john.Id; account.BIC = "BINAADADXXX"; BaseTest._johnsAccount = this.Api.Users.CreateBankAccountIban(john.Id, account); } return(BaseTest._johnsAccount); }
public void Test_PayIns_DirectDebit_Create_Get() { WalletDTO wallet = this.GetJohnsWallet(); UserNaturalDTO user = this.GetJohn(); // create pay-in DIRECT DEBIT PayInDirectDebitPostDTO payIn = new PayInDirectDebitPostDTO(user.Id, new Money { Amount = 10000, Currency = CurrencyIso.EUR }, new Money { Amount = 100, Currency = CurrencyIso.EUR }, wallet.Id, "http://www.mysite.com/returnURL/", CountryIso.FR, DirectDebitType.GIROPAY); payIn.TemplateURLOptions = new TemplateURLOptions { PAYLINE = "https://www.maysite.com/payline_template/" }; payIn.Tag = "DirectDebit test tag"; PayInDirectDebitDTO createPayIn = this.Api.PayIns.CreateDirectDebit(payIn); Assert.IsNotNull(createPayIn); Assert.IsTrue(createPayIn.Id.Length > 0); Assert.AreEqual(wallet.Id, createPayIn.CreditedWalletId); Assert.IsTrue(createPayIn.PaymentType == PayInPaymentType.DIRECT_DEBIT); Assert.IsTrue(createPayIn.DirectDebitType == DirectDebitType.GIROPAY); Assert.IsTrue(createPayIn.Culture == CountryIso.FR); Assert.AreEqual(user.Id, createPayIn.AuthorId); Assert.IsTrue(createPayIn.Status == TransactionStatus.CREATED); Assert.IsTrue(createPayIn.Type == TransactionType.PAYIN); Assert.IsNotNull(createPayIn.DebitedFunds); Assert.IsTrue(createPayIn.DebitedFunds is Money); Assert.AreEqual(10000, createPayIn.DebitedFunds.Amount); Assert.IsTrue(createPayIn.DebitedFunds.Currency == CurrencyIso.EUR); Assert.IsNotNull(createPayIn.CreditedFunds); Assert.IsTrue(createPayIn.CreditedFunds is Money); Assert.AreEqual(9900, createPayIn.CreditedFunds.Amount); Assert.IsTrue(createPayIn.CreditedFunds.Currency == CurrencyIso.EUR); Assert.IsNotNull(createPayIn.Fees); Assert.IsTrue(createPayIn.Fees is Money); Assert.AreEqual(100, createPayIn.Fees.Amount); Assert.IsTrue(createPayIn.Fees.Currency == CurrencyIso.EUR); Assert.IsNotNull(createPayIn.ReturnURL); Assert.IsNotNull(createPayIn.RedirectURL); Assert.IsNotNull(createPayIn.TemplateURL); PayInDirectDebitDTO getPayIn = this.Api.PayIns.GetDirectDebit(createPayIn.Id); Assert.IsNotNull(getPayIn); Assert.IsTrue(getPayIn.Id == createPayIn.Id); Assert.IsTrue(getPayIn.Tag == createPayIn.Tag); }
protected BankAccountIbanDTO GetJohnsAccount(bool recreate = false) { if (BaseTest._johnsAccount == null || recreate) { UserNaturalDTO john = this.GetJohn(); BankAccountIbanPostDTO account = new BankAccountIbanPostDTO(john.FirstName + " " + john.LastName, john.Address, "FR7618829754160173622224154"); account.UserId = john.Id; account.BIC = "CMBRFR2BCME"; BaseTest._johnsAccount = this.Api.Users.CreateBankAccountIban(john.Id, account); } return(BaseTest._johnsAccount); }
public void Test_Transfers_Get() { UserNaturalDTO john = this.GetJohn(); TransferDTO transfer = this.GetNewTransfer(); TransferDTO getTransfer = this.Api.Transfers.Get(transfer.Id); Assert.AreEqual(transfer.Id, getTransfer.Id); Assert.AreEqual(getTransfer.AuthorId, john.Id); Assert.AreEqual(getTransfer.CreditedUserId, john.Id); AssertEqualInputProps(transfer, getTransfer); }
public void Test_Transfers_Create() { UserNaturalDTO john = this.GetJohn(); TransferDTO transfer = this.GetNewTransfer(); WalletDTO creditedWallet = this.Api.Wallets.Get(transfer.CreditedWalletId); Assert.IsTrue(transfer.Id.Length > 0); Assert.AreEqual(transfer.AuthorId, john.Id); Assert.AreEqual(transfer.CreditedUserId, john.Id); Assert.IsTrue(creditedWallet.Balance.Amount == 100); }
/* * 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(); string bankAccountId = this.GetJohnsAccount().Result.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. * */ 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.CreateMandateDirectDebit(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.GetMandateDirectDebit(createPayIn.Id); Assert.IsNotNull(getPayIn); Assert.IsTrue(getPayIn.Id == createPayIn.Id); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Test_Transfers_Create() { UserNaturalDTO john = TestHelper.GetJohn(); var wallet = TestHelper.GetNewJohnsWalletWithMoney(10000); TransferDTO transfer = TestHelper.GetNewTransfer(wallet); WalletDTO creditedWallet = TestHelper.WalletsApi.Get(transfer.CreditedWalletId).Result; Assert.True(transfer.Id.Length > 0); Assert.Equal(transfer.AuthorId, john.Id); Assert.Equal(transfer.CreditedUserId, john.Id); Assert.Equal(100, creditedWallet.Balance.Amount); }
public void Test_Refund_GetForPayIn() { PayInDTO payIn = this.GetNewPayInCardDirect(); RefundDTO refund = this.GetNewRefundForPayIn(payIn); UserNaturalDTO user = this.GetJohn(); RefundDTO getRefund = this.Api.Refunds.Get(refund.Id); Assert.AreEqual(getRefund.Id, refund.Id); Assert.AreEqual(getRefund.InitialTransactionId, payIn.Id); Assert.AreEqual(getRefund.AuthorId, user.Id); Assert.AreEqual(getRefund.Type, TransactionType.PAYOUT); }
public void Test_Refund_GetForTransfer() { TransferDTO transfer = this.GetNewTransfer(); RefundDTO refund = this.GetNewRefundForTransfer(transfer); UserNaturalDTO user = this.GetJohn(); RefundDTO getRefund = this.Api.Refunds.Get(refund.Id); Assert.AreEqual(getRefund.Id, refund.Id); Assert.AreEqual(getRefund.InitialTransactionId, transfer.Id); Assert.AreEqual(getRefund.AuthorId, user.Id); Assert.AreEqual(getRefund.Type, TransactionType.TRANSFER); }
public void Test_Users_CreateNatural() { try { UserNaturalDTO john = TestHelper.GetJohn(); Assert.True(john.Id.Length > 0); Assert.True(john.PersonType == PersonType.NATURAL); } catch (Exception ex) { Assert.True(false, ex.Message); } }
public void Test_Transfers_Get() { UserNaturalDTO john = TestHelper.GetJohn(); var wallet = TestHelper.GetNewJohnsWalletWithMoney(10000); TransferDTO transfer = TestHelper.GetNewTransfer(wallet); TransferDTO getTransfer = _objectToTest.Get(transfer.Id).Result; Assert.Equal(transfer.Id, getTransfer.Id); Assert.Equal(getTransfer.AuthorId, john.Id); Assert.Equal(getTransfer.CreditedUserId, john.Id); TestHelper.AssertEqualInputProps(transfer, getTransfer); }
protected UserNaturalDTO GetJohn() { if (BaseTest._john == null) { UserNaturalPostDTO user = new UserNaturalPostDTO("*****@*****.**", "John", "Doe", new DateTime(1975, 12, 21, 0, 0, 0), CountryIso.FR, CountryIso.FR); user.Occupation = "programmer"; user.IncomeRange = 3; user.Address = "Some Address"; BaseTest._john = this.Api.Users.Create(user); } return(BaseTest._john); }
public void Test_Users_CreateNatural() { try { UserNaturalDTO john = this.GetJohn(); Assert.IsTrue(john.Id.Length > 0); Assert.IsTrue(john.PersonType == PersonType.NATURAL); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Test_Idempotency_TransfersCreateRefunds() { string key = DateTime.Now.Ticks.ToString(); TransferDTO transfer = this.GetNewTransfer(); UserNaturalDTO user = this.GetJohn(); RefundTransferPostDTO refund = new RefundTransferPostDTO(user.Id); Api.Transfers.CreateRefund(key, transfer.Id, refund); var result = Api.Idempotency.Get(key); Assert.IsInstanceOf <RefundDTO>(result.Resource); }
/// <summary>Creates card registration object.</summary> /// <returns>CardRegistration instance returned from API.</returns> protected CardRegistrationDTO GetJohnsCardRegistration() { if (BaseTest._johnsCardRegistration == null) { UserNaturalDTO user = this.GetJohn(); CardRegistrationPostDTO cardRegistration = new CardRegistrationPostDTO(user.Id, CurrencyIso.EUR); BaseTest._johnsCardRegistration = this.Api.CardRegistrations.Create(cardRegistration); } return(BaseTest._johnsCardRegistration); }
/// <summary>Creates card registration object.</summary> /// <param name="cardType">Card type.</param> /// <returns>CardRegistration instance returned from API.</returns> protected CardRegistrationDTO GetJohnsCardRegistration(CardType cardType = CardType.CB_VISA_MASTERCARD) { if (BaseTest._johnsCardRegistration == null) { UserNaturalDTO user = this.GetJohn(); CardRegistrationPostDTO cardRegistration = new CardRegistrationPostDTO(user.Id, CurrencyIso.EUR, cardType); cardRegistration.Tag = "DefaultTag"; BaseTest._johnsCardRegistration = this.Api.CardRegistrations.Create(cardRegistration); } return(BaseTest._johnsCardRegistration); }
public void Test_Users_CreateKycPageFromFile() { try { UserNaturalDTO john = this.GetJohn(); KycDocumentDTO kycDocument = this.GetNewKycDocument(); String filePath = "TestKycPageFile.png"; this.Api.Users.CreateKycPage(john.Id, kycDocument.Id, filePath); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Test_Users_CreateBankAccount_IBAN() { try { UserNaturalDTO john = TestHelper.GetJohn(); BankAccountDTO account = TestHelper.GetJohnsAccount(); Assert.True(account.Id.Length > 0); Assert.Equal(account.UserId, john.Id); } catch (Exception ex) { Assert.True(false, ex.Message); } }
public void Test_Users_CreateBankAccount() { try { UserNaturalDTO john = this.GetJohn(); BankAccountIbanDTO account = this.GetJohnsAccount(); Assert.IsTrue(account.Id.Length > 0); Assert.IsTrue(account.UserId == (john.Id)); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public async Task Test_Transfers_Create() { UserNaturalDTO john = await this.GetJohn(); var wallet = await this.GetNewJohnsWalletWithMoney(10000); TransferDTO transfer = await this.GetNewTransfer(wallet); WalletDTO creditedWallet = await this.Api.Wallets.GetAsync(transfer.CreditedWalletId); Assert.IsTrue(transfer.Id.Length > 0); Assert.AreEqual(transfer.AuthorId, john.Id); Assert.AreEqual(transfer.CreditedUserId, john.Id); Assert.AreEqual(100, creditedWallet.Balance.Amount); }
protected UserNaturalDTO GetJohn() { if (BaseTest._john == null) { UserNaturalPostDTO user = new UserNaturalPostDTO("*****@*****.**", "John", "Doe", new DateTime(1975, 12, 21, 0, 0, 0), CountryIso.FR, CountryIso.FR); user.Occupation = "programmer"; user.IncomeRange = 3; user.Address = new Address { AddressLine1 = "Address line 1", AddressLine2 = "Address line 2", City = "City", Country = CountryIso.PL, PostalCode = "11222", Region = "Region" }; BaseTest._john = this.Api.Users.Create(user); } return(BaseTest._john); }
public async Task Test_Transfers_Get() { UserNaturalDTO john = await this.GetJohn(); var wallet = await this.GetNewJohnsWalletWithMoney(10000); TransferDTO transfer = await this.GetNewTransfer(wallet); TransferDTO getTransfer = await this.Api.Transfers.GetAsync(transfer.Id); Assert.AreEqual(transfer.Id, getTransfer.Id); Assert.AreEqual(getTransfer.AuthorId, john.Id); Assert.AreEqual(getTransfer.CreditedUserId, john.Id); AssertEqualInputProps(transfer, getTransfer); }
protected WalletDTO GetJohnsWallet() { if (BaseTest._johnsWallet == null) { UserNaturalDTO john = this.GetJohn(); WalletPostDTO wallet = new WalletPostDTO(new List <string> { john.Id }, "WALLET IN EUR", CurrencyIso.EUR); BaseTest._johnsWallet = this.Api.Wallets.Create(wallet); } return(BaseTest._johnsWallet); }
protected PayInCardWebDTO GetNewPayInCardWeb() { WalletDTO wallet = this.GetJohnsWallet(); UserNaturalDTO user = this.GetJohn(); PayInCardWebPostDTO payIn = new PayInCardWebPostDTO(user.Id, new Money { Amount = 1000, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, wallet.Id, "https://test.com", CountryIso.FR, CardType.CB_VISA_MASTERCARD); BaseTest._johnsPayInCardWeb = this.Api.PayIns.CreateCardWeb(payIn); return(BaseTest._johnsPayInCardWeb); }
public void Test_Idempotency_UsersCreateBankAccountsIban() { string key = DateTime.Now.Ticks.ToString(); UserNaturalDTO john = this.GetJohn(); var account = new BankAccountIbanPostDTO(john.FirstName + " " + john.LastName, john.Address, "FR7618829754160173622224154"); account.UserId = john.Id; account.BIC = "CMBRFR2BCME"; Api.Users.CreateBankAccountIban(key, john.Id, account); var result = Api.Idempotency.Get(key); Assert.IsInstanceOf <BankAccountIbanDTO>(result.Resource); }
public async Task Test_Users_CreateBankAccount_IBAN() { try { UserNaturalDTO john = await this.GetJohn(); BankAccountDTO account = await this.GetJohnsAccount(); Assert.IsTrue(account.Id.Length > 0); Assert.AreEqual(account.UserId, john.Id); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Test_Refund_GetForTransfer() { WalletDTO wallet = this.GetNewJohnsWalletWithMoney(10000); TransferDTO transfer = this.GetNewTransfer(wallet); RefundDTO refund = this.GetNewRefundForTransfer(transfer); UserNaturalDTO user = this.GetJohn(); RefundDTO getRefund = this.Api.Refunds.Get(refund.Id); Assert.AreEqual(getRefund.Id, refund.Id); Assert.AreEqual(getRefund.InitialTransactionId, transfer.Id); Assert.AreEqual(getRefund.AuthorId, user.Id); Assert.AreEqual(getRefund.Type, TransactionType.TRANSFER); Assert.IsNotNull(getRefund.RefundReason); Assert.AreEqual(getRefund.RefundReason.RefundReasonType, RefundReasonType.OTHER); }
public void Test_Users_BankAccount() { try { UserNaturalDTO john = this.GetJohn(); BankAccountIbanDTO account = this.GetJohnsAccount(); BankAccountIbanDTO accountFetched = this.Api.Users.GetBankAccountIban(john.Id, account.Id); AssertEqualInputProps(account, accountFetched); } catch (Exception ex) { Assert.Fail(ex.Message); } }