/
Paycard Service (python)
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!
Paycard Service (python)
List of all options:
Query list of paycards
Create, get one, update and delete a single paycard
Get all PAN tokens
Create, get one, update and delete a single PAN token
Paycard managment
from trivoreid.models.paycard import Paycard
from trivoreid.utils.criteria import Filter
# Get list of all user's paycards
paycards = api.paycard_service.get_all(userId)
# Apply filter
filt = Filter(Filter.EQUAL, 'status', 'ACTIVE')
paycards = api.paycard_service.get_all(userId, filt)
# Add new paycard
paycard = Paycard()
paycard.name = 'exampleName'
paycard.state = 'ACTIVE'
paycard.priority = 1
paycard.method = 'creditcard'
# This method returns paycard object with the generated ID
paycard = api.paycard_service.create(userId, paycard)
cardId = paycard.id
# Get one, Update and Delete
paycard = api.paycard_service.get(userId, cardId)
paycard.validTo = '2022-10-20T07:17:17.606Z'
api.paycard_service.update(paycard)
api.paycard_service.delete(userId, cardId)
PAN token management
from trivoreid.models.paycard import PanToken
from trivoreid.utils.criteria import Filter
# Get list of all paycard's PAN tokens
tokens = api.paycard_service.get_all_pan_tokens(userId, cardId)
# Apply filter
filt = Filter(Filter.EQUAL, 'issuer', 'exampleIssuer')
tokens = api.paycard_service.get_all_pan_tokens(userId, cardId, filt)
# Add new PAN token
token = PanToken()
token.issuer = 'exampleIssuer'
# This method returns PAN token object with the generated ID
token = api.paycard_service.create_pan_token(userId, cardId, token)
tokenId = token.id
# Get one, Update and Delete
token = api.paycard_service.get_pan_token(userId, cardId, tokenId)
token.token = 'testToken'
api.paycard_service.update_pan_token(userId, token)
api.paycard_service.delete_pan_token(userId, cardId, tokenId)