public async Task Test_BankingAlias_Update() { try { UserNaturalDTO john = await this.GetJohn(); WalletPostDTO walletPost = new WalletPostDTO(new List <string> { john.Id }, "WALLET IN EUR", CurrencyIso.EUR); WalletDTO wallet = await this.Api.Wallets.CreateAsync(walletPost); BankingAliasIbanPostDTO bankingAliasIban = new BankingAliasIbanPostDTO( john.FirstName + " " + john.LastName, CountryIso.LU) { Tag = "Tag test" }; BankingAliasDTO bankingAliasCreated = await this.Api.BankingAlias.CreateIbanAsync(wallet.Id, bankingAliasIban); BankingAliasPutDTO bankingAliasPut = new BankingAliasPutDTO { Active = false }; BankingAliasDTO bankingAlias = await this.Api.BankingAlias.UpdateAsync(bankingAliasPut, bankingAliasCreated.Id); BankingAliasDTO bankingAliasGet = await this.Api.BankingAlias.GetAsync(bankingAliasCreated.Id); Assert.IsFalse(bankingAliasGet.Active); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Test_BankingAlias_GetAll() { try { UserNaturalDTO john = this.GetJohn(); WalletPostDTO walletPost = new WalletPostDTO(new List <string> { john.Id }, "WALLET IN EUR", CurrencyIso.EUR); WalletDTO wallet = this.Api.Wallets.Create(walletPost); BankingAliasIbanPostDTO bankingAliasIban = new BankingAliasIbanPostDTO( john.FirstName + " " + john.LastName, CountryIso.LU) { Tag = "Tag test" }; BankingAliasDTO bankingAliasCreated = Api.BankingAlias.CreateIban(wallet.Id, bankingAliasIban); Pagination pagination = new Pagination(1, 2); Sort sort = new Sort(); sort.AddField("CreationDate", SortDirection.asc); var result = this.Api.BankingAlias.GetAll(wallet.Id, pagination, sort); Assert.IsNotNull(result); Assert.AreEqual(1, result.Count); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Test_BankingAlias_GetIban() { try { UserNaturalDTO john = this.GetJohn(); WalletPostDTO walletPost = new WalletPostDTO(new List <string> { john.Id }, "WALLET IN EUR", CurrencyIso.EUR); WalletDTO wallet = this.Api.Wallets.Create(walletPost); BankingAliasIbanPostDTO bankingAliasIban = new BankingAliasIbanPostDTO( john.FirstName + " " + john.LastName, CountryIso.LU) { Tag = "Tag test" }; BankingAliasDTO bankingAliasCreated = Api.BankingAlias.CreateIban(wallet.Id, bankingAliasIban); BankingAliasDTO bankingAlias = this.Api.BankingAlias.GetIban(bankingAliasCreated.Id); Assert.AreEqual(bankingAliasCreated.Id, bankingAlias.Id); Assert.AreEqual(BankingAliasType.IBAN, bankingAlias.Type); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Test_Idempotency_PayinsCardDirectCreate() { string key = DateTime.Now.Ticks.ToString(); UserNaturalDTO john = this.GetJohn(); WalletPostDTO wallet = new WalletPostDTO(new List <string> { john.Id }, "WALLET IN EUR WITH MONEY", CurrencyIso.EUR); var johnsWallet = this.Api.Wallets.Create(wallet); CardRegistrationPostDTO cardRegistrationPost = new CardRegistrationPostDTO(johnsWallet.Owners[0], CurrencyIso.EUR); CardRegistrationDTO cardRegistration = this.Api.CardRegistrations.Create(cardRegistrationPost); CardRegistrationPutDTO cardRegistrationPut = new CardRegistrationPutDTO(); cardRegistrationPut.RegistrationData = this.GetPaylineCorrectRegistartionData(cardRegistration); cardRegistration = this.Api.CardRegistrations.Update(cardRegistrationPut, cardRegistration.Id); CardDTO card = this.Api.Cards.Get(cardRegistration.CardId); PayInCardDirectPostDTO payIn = new PayInCardDirectPostDTO(cardRegistration.UserId, cardRegistration.UserId, new Money { Amount = 1000, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, johnsWallet.Id, "http://test.com", card.Id); payIn.CardType = card.CardType; Api.PayIns.CreateCardDirect(key, payIn); var result = Api.Idempotency.Get(key); Assert.IsInstanceOf <PayInCardDirectDTO>(result.Resource); }
public void Test_Idempotency_TransfersCreate() { string key = DateTime.Now.Ticks.ToString(); WalletDTO walletWithMoney = this.GetJohnsWalletWithMoney(); UserNaturalDTO user = this.GetJohn(); WalletPostDTO walletPost = new WalletPostDTO(new List <string> { user.Id }, "WALLET IN EUR FOR TRANSFER", CurrencyIso.EUR); WalletDTO wallet = this.Api.Wallets.Create(walletPost); TransferPostDTO transfer = new TransferPostDTO(user.Id, user.Id, new Money { Amount = 100, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, walletWithMoney.Id, wallet.Id); transfer.Tag = "DefaultTag"; Api.Transfers.Create(key, transfer); var result = Api.Idempotency.Get(key); Assert.IsInstanceOf <TransferDTO>(result.Resource); }
protected TransferDTO GetNewTransfer(WalletDTO walletIn = null) { WalletDTO walletWithMoney = walletIn; if (walletWithMoney == null) { walletWithMoney = this.GetJohnsWalletWithMoney(); } UserNaturalDTO user = this.GetJohn(); WalletPostDTO walletPost = new WalletPostDTO(new List <string> { user.Id }, "WALLET IN EUR FOR TRANSFER", CurrencyIso.EUR); WalletDTO wallet = this.Api.Wallets.Create(walletPost); TransferPostDTO transfer = new TransferPostDTO(user.Id, user.Id, new Money { Amount = 100, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, walletWithMoney.Id, wallet.Id); transfer.Tag = "DefaultTag"; return(this.Api.Transfers.Create(transfer)); }
protected WalletDTO CreateJohnsWallet() { UserNaturalDTO john = this.GetJohn(); WalletPostDTO wallet = new WalletPostDTO(new List <string> { john.Id }, "WALLET IN EUR", CurrencyIso.EUR); return(Api.Wallets.Create(wallet)); }
protected async Task <WalletDTO> CreateJohnsWallet() { UserNaturalDTO john = await this.GetJohn(); WalletPostDTO wallet = new WalletPostDTO(new List <string> { john.Id }, "WALLET IN EUR", CurrencyIso.EUR); return(await Api.Wallets.CreateAsync(wallet)); }
public void Test_Idempotency_WalletsCreate() { string key = DateTime.Now.Ticks.ToString(); var john = this.GetJohn(); var wallet = new WalletPostDTO(new List <string> { john.Id }, "WALLET IN EUR", CurrencyIso.EUR); Api.Wallets.Create(key, wallet); var result = Api.Idempotency.Get(key); Assert.IsInstanceOf <WalletDTO>(result.Resource); }
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); }
/// <summary>Creates wallet for John, if not created yet, or returns an existing one.</summary> /// <param name="amount">Initial wallet's money amount.</param> /// <returns>Wallet entity instance returned from API.</returns> protected WalletDTO GetJohnsWalletWithMoney(int amount) { if (BaseTest._johnsWalletWithMoney == null) { UserNaturalDTO john = this.GetJohn(); // create wallet with money WalletPostDTO wallet = new WalletPostDTO(new List <string> { john.Id }, "WALLET IN EUR WITH MONEY", CurrencyIso.EUR); BaseTest._johnsWalletWithMoney = this.Api.Wallets.Create(wallet); CardRegistrationPostDTO cardRegistrationPost = new CardRegistrationPostDTO(BaseTest._johnsWalletWithMoney.Owners[0], CurrencyIso.EUR); CardRegistrationDTO cardRegistration = this.Api.CardRegistrations.Create(cardRegistrationPost); CardRegistrationPutDTO cardRegistrationPut = new CardRegistrationPutDTO(); cardRegistrationPut.RegistrationData = this.GetPaylineCorrectRegistartionData(cardRegistration); cardRegistration = this.Api.CardRegistrations.Update(cardRegistrationPut, cardRegistration.Id); CardDTO card = this.Api.Cards.Get(cardRegistration.CardId); // create pay-in CARD DIRECT PayInCardDirectPostDTO payIn = new PayInCardDirectPostDTO(cardRegistration.UserId, cardRegistration.UserId, new Money { Amount = amount, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, BaseTest._johnsWalletWithMoney.Id, "http://test.com", card.Id); if (card.CardType == CardType.CB || card.CardType == CardType.VISA || card.CardType == CardType.MASTERCARD || card.CardType == CardType.CB_VISA_MASTERCARD) { payIn.CardType = CardType.CB_VISA_MASTERCARD; } else if (card.CardType == CardType.AMEX) { payIn.CardType = CardType.AMEX; } // create Pay-In this.Api.PayIns.CreateCardDirect(payIn); } return(this.Api.Wallets.Get(BaseTest._johnsWalletWithMoney.Id)); }
public async Task <string> CreateWallet(string userId) { List <string> owners = new List <string>(); owners.Add(userId); WalletPostDTO wallet = new WalletPostDTO(owners, Constants.walletDescription, CurrencyIso.EUR); var CreatedWallet = await _mangoPayApi.Wallets.Create(wallet); if (CreatedWallet != null) { return(CreatedWallet.Id); } else { return(null); } }
/// <summary>Creates new wallet for John.</summary> /// <param name="amount">Initial wallet's money amount.</param> /// <returns>Wallet entity instance returned from API.</returns> protected async Task <WalletDTO> GetNewJohnsWalletWithMoney(int amount, UserNaturalDTO user = null) { UserNaturalDTO john = user; if (john == null) { john = await this.GetJohn(); } // create wallet with money WalletPostDTO wallet = new WalletPostDTO(new List <string> { john.Id }, "WALLET IN EUR WITH MONEY", CurrencyIso.EUR); var johnsWalletWithMoney = await this.Api.Wallets.CreateAsync(wallet); CardRegistrationPostDTO cardRegistrationPost = new CardRegistrationPostDTO(johnsWalletWithMoney.Owners[0], CurrencyIso.EUR); CardRegistrationDTO cardRegistration = await this.Api.CardRegistrations.CreateAsync(cardRegistrationPost); CardRegistrationPutDTO cardRegistrationPut = new CardRegistrationPutDTO { RegistrationData = await this.GetPaylineCorrectRegistartionData(cardRegistration) }; cardRegistration = await this.Api.CardRegistrations.UpdateAsync(cardRegistrationPut, cardRegistration.Id); CardDTO card = await this.Api.Cards.GetAsync(cardRegistration.CardId); // create pay-in CARD DIRECT PayInCardDirectPostDTO payIn = new PayInCardDirectPostDTO(cardRegistration.UserId, cardRegistration.UserId, new Money { Amount = amount, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, johnsWalletWithMoney.Id, "http://test.com", card.Id); payIn.CardType = card.CardType; // create Pay-In var result = await this.Api.PayIns.CreateCardDirectAsync(payIn); return(await this.Api.Wallets.GetAsync(johnsWalletWithMoney.Id)); }
public async Task <WalletDTO> Create(string idempotencyKey, WalletPostDTO wallet) { var targetUrl = $"{_baseUrl}/wallets"; return(await CreateEntity <WalletDTO, WalletPostDTO>(targetUrl, wallet, idempotencyKey)); }
/// <summary>Creates new wallet.</summary> /// <param name="idempotencyKey">Idempotency key for this request.</param> /// <param name="wallet">Wallet instance to be created.</param> /// <returns>Wallet instance returned from API.</returns> public async Task <WalletDTO> CreateAsync(String idempotencyKey, WalletPostDTO wallet) { return(await this.CreateObjectAsync <WalletDTO, WalletPostDTO>(idempotencyKey, MethodKey.WalletsCreate, wallet)); }
/// <summary>Creates new wallet.</summary> /// <param name="wallet">Wallet instance to be created.</param> /// <returns>Wallet instance returned from API.</returns> public WalletDTO Create(WalletPostDTO wallet) { return(Create(null, wallet)); }
/// <summary>Creates new wallet.</summary> /// <param name="wallet">Wallet instance to be created.</param> /// <returns>Wallet instance returned from API.</returns> public WalletDTO Create(WalletPostDTO wallet) { return(this.CreateObject <WalletDTO, WalletPostDTO>(MethodKey.WalletsCreate, wallet)); }
/// <summary>Creates new wallet.</summary> /// <param name="idempotencyKey">Idempotency key for this request.</param> /// <param name="wallet">Wallet instance to be created.</param> /// <returns>Wallet instance returned from API.</returns> public WalletDTO Create(String idempotencyKey, WalletPostDTO wallet) { return(this.CreateObject <WalletDTO, WalletPostDTO>(idempotencyKey, MethodKey.WalletsCreate, wallet)); }
public async Task <WalletDTO> Create(WalletPostDTO wallet) { return(await Create(null, wallet)); }