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!
WalletService (java)
To get access to the wallet’s funds (to make a 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. (See examples for more info)
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);
Examples
Wallet Service Models
https://trivore.atlassian.net/wiki/spaces/TISpubdoc/pages/88277458
https://trivore.atlassian.net/wiki/spaces/TISpubdoc/pages/98631789
https://trivore.atlassian.net/wiki/spaces/TISpubdoc/pages/99057677