ca.mint.mintchip.contract

Interface IMintChip


public interface IMintChip

This interface represents the primary controller for interacting with MintChip.

Methods
Modifier and Type Method and Description
IValueMessage createValueMessage(IValueRequestMessage request)
Creates (withdraws) value from this MintChip.
byte[] getCertificate()
Retrieves the public certificate for this MintChip.
CurrencyCode getCurrencyCode()
Retrieves the currency code for this MintChip.
java.lang.String getId()
Retrieves the MintChip account Id from this MintChip.
IValueMessage getLastCreatedValueMessage(java.lang.String annotation)
Retrieves the last Value Message created by this MintChip.
IMintChipStatus getStatus()
Retrieves the current status of this MintChip.
java.lang.String getVersion()
Retrieves the version for this MintChip.
boolean isValidId(java.lang.String mintChipId)
Validates whether the supplied Id is a valid MintChip account Id.
void loadValueMessage(IValueMessage valueMessage)
Loads (deposits) the specified Value Message onto this instance of MintChip.
ILogEntry[] readTransactionLog(LogType logType, int startIndex, int numOfEntries)
Retrieves the specified log entry(s) from this MintChip.
Method Detail

loadValueMessage

void loadValueMessage(IValueMessage valueMessage) throws MintChipException

Loads (deposits) the specified Value Message onto this instance of MintChip.

Parameters:
valueMessage - the value to be loaded
Throws:
MintChipException - if MintChip is missing/faulty or if communication errors occurred with MintChip, if the value has already been loaded, if the value message exceeds one of the chips operational parameters, if the value message has been tampered with

createValueMessage

IValueMessage createValueMessage(IValueRequestMessage request) throws MintChipException

Creates (withdraws) value from this MintChip.

Parameters:
request - the requested value to be created
Returns:
IValueMessage the Value Message requested
Throws:
MintChipException - if MintChip is missing/faulty or if communication errors occurred with MintChip, if the requested value message exceeds one of the chips operational parameters

getLastCreatedValueMessage

IValueMessage getLastCreatedValueMessage(java.lang.String annotation) throws MintChipException

Retrieves the last Value Message created by this MintChip.

Parameters:
annotation - an optional text description to be included in the Value Message
Returns:
IValueMessage the last Value Message created by this MintChip or null if no Value Messages have been created by this MintChip
Throws:
MintChipException - if MintChip is missing/faulty or if communication errors occurred with MintChip

readTransactionLog

ILogEntry[] readTransactionLog(LogType logType, int startIndex, int numOfEntries) throws MintChipException

Retrieves the specified log entry(s) from this MintChip.

Parameters:
logType - the type of entry, CREDIT or DEBIT
startIndex - the 0 based index to start retrieving from
numOfEntries - the number of items to retrieve
Returns:
ILogEntry[] array of the specified length or until the end of the log or an empty array if the specified startIndex is beyond the number of log entries
Throws:
MintChipException - if MintChip is missing/faulty or if communication errors occurred with MintChip

getStatus

IMintChipStatus getStatus() throws MintChipException

Retrieves the current status of this MintChip.

Returns:
IMintChipStatus the current status of this MintChip
Throws:
MintChipException - if MintChip is missing/faulty or if communication errors occurred with MintChip

getId

java.lang.String getId() throws MintChipException

Retrieves the MintChip account Id from this MintChip.

Returns:
a string representation of the 16 digit MintChip account Id
Throws:
MintChipException - if MintChip is missing/faulty or if communication errors occurred with MintChip

getCertificate

byte[] getCertificate() throws MintChipException

Retrieves the public certificate for this MintChip.

Returns:
a binary representation of the public certificate for this MintChip
Throws:
MintChipException - if MintChip is missing/faulty or if communication errors occurred with MintChip

getCurrencyCode

CurrencyCode getCurrencyCode() throws MintChipException

Retrieves the currency code for this MintChip.

Returns:
the currency code for this MintChip
Throws:
MintChipException - if MintChip is missing/faulty or if communication errors occurred with MintChip

getVersion

java.lang.String getVersion() throws MintChipException

Retrieves the version for this MintChip.

Returns:
the version of this MintChip
Throws:
MintChipException - if MintChip is missing/faulty or if communication errors occurred with MintChip

isValidId

boolean isValidId(java.lang.String mintChipId)

Validates whether the supplied Id is a valid MintChip account Id.

Parameters:
mintChipId - the MintChip account Id to be validated
Returns:
true if the supplied id is a valid MintChip account id; false otherwise