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

« Previous Version 2 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

from trivoreid.models.wallet import Wallet
from trivoreid.utils.criteria import Filter

# get list of all accessible wallets
page = api.wallet_service.get_all()

# apply parameters and filter to wallets
f = Filter(Filter.LESS_THAN, 'balance', 50)
page = api.wallet_service.get_all(f, start_index=1, count=5, sortBy='name')

# create new wallet
wallet.ownerId = 'userId'
wallet.holderIds.append('holderId')
wallet.accessControlIds.append('accessControlId')

wallet = api.wallet_service.create(wallet)

# update wallet
wallet.name = 'name'
api.wallet_service.update(wallet)

# get wallet
wallet = api.wallet_service.get(wallet.id)

# delete wallet
api.wallet_service.delete(wallet.id)

Transactions

from trivoreid.models.wallet import Transaction

wallet1 = api.wallet_service.get('walletID1')
wallet2 = api.wallet_service.get('walletID2')

# deposit
transaction = Transaction()
transaction.amount = 5
transaction.currency = 'EUR'

api.wallet_service.deposit(wallet1.id, transaction)

# transfer funds from wallet1 to wallet2
transaction.amount = 3
transaction.transferTo = wallet2.id

api.wallet_service.transfer(wallet1.id, transaction)

# withdraw funds from the wallet
transaction.amount = 2

api.wallet_service.withdraw(wallet1.id, transaction)
  • No labels