NOTE: Trivore ID Documentation has moved to https://trivoreid.com

The content on this site IS OUT OF DATE!

This space has been archived!

Please go ahead to the new site!

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

To get access to the wallet’s funds (to be able to deposit, transfer or withdraw) wallet should contain authenticated user’s or Management API Client ID in the holderIds list.
For updating/deleting the wallet, wallet should contain access control object’s ID in the accessControlIds list that contains ID of the client in the write access section.

Wallets management

// get list of all accessible wallets
Page<Wallet> page = walletService.getAll();

// apply parameters and filter to wallets
Filter filter = Filter.lt("balance", 50);
Criteria criteria = new Criteria(filter);

page = walletService.getAll(criteria, "name", true);

// create new wallet
Wallet wallet = new Wallet();
wallet.setOwnerId("userId");
wallet.getHolderIds().add("holderId");
wallet.getAccessControlIds().add("accessControlId");

wallet = walletService.create(wallet);

// update wallet
wallet.setName("name");

walletService.update(wallet);

// get wallet
wallet = walletService.get(wallet.getId());

// delete wallet
walletService.delete(wallet.getId());

Transactions

Wallet wallet1 = walletService.get("walletId1");
Wallet wallet2 = walletService.get("walletId2");

// deposit funds
Transaction transaction = new Transaction();
transaction.setAmount("5");
transaction.setCurrency("EUR");

walletService.deposit(wallet1.getId(), transaction);

// transfer funds from wallet1 to wallet2
transaction.setAmount("3");
transaction.setTransferTo(wallet2.getId());

walletService.transfer(wallet1.getId(), transaction);

// withdraw funds from the wallet
transaction.setAmount("2");

walletService.withdraw(wallet1.getId(), transaction);
  • No labels