Class: Transaction

Transaction(apiKeyopt)

Transaction API client. Retrieves, lists, updates and deletes transaction records, and downloads transaction images, files and archive exports.

Constructor

new Transaction(apiKeyopt)

Create a new Transaction API client.
Parameters:
Name Type Attributes Default Description
apiKey string | null <optional>
null Your API key. If omitted, the `IDANALYZER_KEY` environment variable is used.
Source:

Extends

Methods

(async) deleteTransaction(transactionIdopt) → {Promise.<ApiResponse>}

Delete a transaction
Parameters:
Name Type Attributes Default Description
transactionId string <optional>
"" Transaction ID.
Source:
Throws:
If `transactionId` is empty.
Type
InvalidArgumentException
Returns:
The parsed API response.
Type
Promise.<ApiResponse>

(async) exportTransaction(destinationopt, transactionIdopt, exportTypeopt, ignoreUnrecognizedopt, ignoreDuplicateopt, createdAtMinopt, createdAtMaxopt, filterCustomDataopt, filterDecisionopt, filterDocupassopt, filterProfileIdopt) → {Promise.<void>}

Download transaction archive onto local file system
Parameters:
Name Type Attributes Default Description
destination string <optional>
"" Full destination path including file name; the file extension should be zip, for example: '\home\archive.zip'.
transactionId Array.<string> | null <optional>
null Export only the specified transaction IDs. Pass `null` to export all matching transactions.
exportType string <optional>
"csv" Export format, either 'csv' or 'json'.
ignoreUnrecognized boolean <optional>
false Ignore unrecognized documents.
ignoreDuplicate boolean <optional>
false Ignore duplicated entries.
createdAtMin number <optional>
0 Export only transactions that were created after this UNIX timestamp.
createdAtMax number <optional>
0 Export only transactions that were created before this UNIX timestamp.
filterCustomData string <optional>
"" Filter export by customData field.
filterDecision string <optional>
"" Filter export by decision (accept, review, reject).
filterDocupass string <optional>
"" Filter export by Docupass reference.
filterProfileId string <optional>
"" Filter export by KYC Profile ID.
Source:
Throws:
If `destination` is empty or `exportType` is not 'csv' or 'json'.
Type
InvalidArgumentException
Returns:
Resolves once the export archive has been downloaded and piped to disk (if the API returned a download URL).
Type
Promise.<void>

getApiKey(customKeyopt) → {string|null}

Resolve the API key, preferring the provided value and falling back to the `IDANALYZER_KEY` environment variable.
Parameters:
Name Type Attributes Default Description
customKey string | null <optional>
null Explicitly supplied API key.
Overrides:
Source:
Returns:
The resolved API key, or `null` if none is available.
Type
string | null

(async) getTransaction(transactionIdopt) → {Promise.<ApiResponse>}

Retrieve a single transaction record
Parameters:
Name Type Attributes Default Description
transactionId string <optional>
"" Transaction ID.
Source:
Throws:
If `transactionId` is empty.
Type
InvalidArgumentException
Returns:
The parsed API response.
Type
Promise.<ApiResponse>

(async) listTransaction(orderopt, limitopt, offsetopt, createdAtMinopt, createdAtMaxopt, filterCustomDataopt, filterDecisionopt, filterDocupassopt, filterProfileIdopt) → {Promise.<ApiResponse>}

Retrieve a list of transaction history
Parameters:
Name Type Attributes Default Description
order number <optional>
-1 Sort results by newest(-1) or oldest(1).
limit number <optional>
10 Number of items to be returned per call.
offset number <optional>
0 Start the list from a particular entry index.
createdAtMin number <optional>
0 List transactions that were created after this UNIX timestamp.
createdAtMax number <optional>
0 List transactions that were created before this UNIX timestamp.
filterCustomData string <optional>
"" Filter result by customData field.
filterDecision string <optional>
"" Filter result by decision (accept, review, reject).
filterDocupass string <optional>
"" Filter result by Docupass reference.
filterProfileId string <optional>
"" Filter result by KYC Profile ID.
Source:
Throws:
If `order` is not 1 or -1, or `limit` is out of range.
Type
InvalidArgumentException
Returns:
The parsed API response.
Type
Promise.<ApiResponse>

(async) saveFile(fileNameopt, destinationopt) → {Promise.<void>}

Download transaction file onto local file system using secured file name obtained from transaction
Parameters:
Name Type Attributes Default Description
fileName string <optional>
"" Secured file name obtained from the transaction.
destination string <optional>
"" Full destination path including file name, for example: '\home\auditreport.pdf'.
Source:
Throws:
If `fileName` or `destination` is empty.
Type
InvalidArgumentException
Returns:
Resolves once the download stream has been piped to disk.
Type
Promise.<void>

(async) saveImage(imageTokenopt, destinationopt) → {Promise.<void>}

Download transaction image onto local file system
Parameters:
Name Type Attributes Default Description
imageToken string <optional>
"" Image token from the transaction API response.
destination string <optional>
"" Full destination path including file name; the file extension should be jpg, for example: '\home\idcard.jpg'.
Source:
Throws:
If `imageToken` or `destination` is empty.
Type
InvalidArgumentException
Returns:
Resolves once the download stream has been piped to disk.
Type
Promise.<void>

setParam(key, value) → {void}

Set an API parameter and its value, this function allows you to set any API parameter without using the built-in functions
Parameters:
Name Type Description
key string Parameter key
value * Parameter value
Overrides:
Source:
Returns:
Type
void

throwApiException(swopt) → {void}

Whether an exception should be thrown if API response contains an error message
Parameters:
Name Type Attributes Default Description
sw boolean <optional>
false Set to `true` to throw an APIError when the API response contains an error, or `false` to return the raw error response instead.
Overrides:
Source:
Returns:
Type
void

(async) updateTransaction(transactionIdopt, decisionopt) → {Promise.<ApiResponse>}

Update transaction decision, updated decision will be relayed to webhook if set.
Parameters:
Name Type Attributes Default Description
transactionId string <optional>
"" Transaction ID.
decision string <optional>
"" New decision (accept, review or reject).
Source:
Throws:
If `transactionId` is empty or `decision` is not one of accept/review/reject.
Type
InvalidArgumentException
Returns:
The parsed API response.
Type
Promise.<ApiResponse>