Class Container

Represents an application that contains one or more documents. Containers are usually received through the archive or directly. The following example demonstrates how to receive applications and display some information about the applications.

var api = new TVS.Api();
api.login('admin', 'password').then(function() {
    // get container results...
    return api.retrieveDocumentContainer(containerId);
}).then(function(application) {
    // some information about an application...
    console.log('Application:', application.getApplicationDisplayName());

    // list of documents
    console.log('Documents:');
    for (var i = 0; i < application.Documents.length; i++) {
        console.log(
            'document:',
            application.Documents[i].getDocumentTypeDisplay(),
            application.Documents[i].getFullname()
        )
    }

    // list of custom fields
    console.log('Application Custom Fields:');
    var fields = application.getFlexibleFields();
    for (var i = 0; i < fields.length; i++) {
        console.log(
            'custom field:', fields[i].getDisplayName(),
            'value:', fields[i].getDisplayValue()
        );
    }
});

See also

Class Document for more information on working with documents. A container represents one or more documents that are part of the application.

Submitting a New Application for more information on creating new document containers.

Retrieving Applications for more information on how to retrieve the metadata for particular document containers.

class Container(json)

Represents an application that may contain one or more identity documents and/or supporting documents alongside with scanned image data and other metadata. A container may also store additional custom fields for the application.

Arguments
  • json (object()) – The original JSON data object this container is based on.

Constant Properties

Container.DOCUMENT_SOURCE_SCANNER

The application was originally created by scanning one or more documents via a scanner device.

Container.DOCUMENT_SOURCE_TTA_IMPORT

The application was imported into the TrustID Cloud from an external source.

Container.DOCUMENT_SOURCE_SYNC

The application was created as part of the synchronisation between different TVS services.

Container.DOCUMENT_SOURCE_IMAGE

The application was originally created using image files for one or more documents. Such images were not produced by a specialised scanner for scanning identity documents.

Container.LIVENESS_RESULT_TYPE.NOT_LIVE

The liveness test decided that the applicant photo was not a live capture of a face.

Container.LIVENESS_RESULT_TYPE.LIVE

The liveness test decided that the applicant photo was a live capture of a face.

Container.LIVENESS_RESULT_TYPE.ERROR

There was an error executing the liveness test.

Container.LIVENESS_RESULT_TYPE.POOR_IMAGE_QUALITY

The image quality was insufficient to carry out a liveness test.

Container.LIVENESS_RESULT_TYPE.FACE_TOO_CLOSE

The applicant photo was taken too close to the person and should be re-taken from further away.

Container.LIVENESS_RESULT_TYPE.FACE_NOT_FOUND

No face was detected in the applicant photo submitted.

Container.LIVENESS_RESULT_TYPE.FACE_TOO_SMALL

The applicant photo was taken from too far away and should be re-taken from a closer distance

Container.LIVENESS_RESULT_TYPE.FACE_ANGLE_TOO_LARGE

The applicant photo submitted was taken at an angle and should be re-taken head-on.

Container.LIVENESS_RESULT_TYPE.FAILED_TO_READ_IMAGE

The system was unable to open the image submitted.

Container.LIVENESS_RESULT_TYPE.UNKNOWN

An unknown error occurred while executing the liveness test.

Container.OVERALL_STATUS_TYPE

Constants for the possible values of the OverallStatus property.

OVERALL_STATUS_TYPE Value

Description

Container.Container.OVERALL_STATUS_TYPE.NO_ALERT

There are no validations that require investigation.

Container.Container.OVERALL_STATUS_TYPE.ALERT

There are validations that need investigating.

Container.Container.OVERALL_STATUS_TYPE.RESOLVED

An operator has investigated application and marked as resolved.

Properties

Container.Documents

A list of all documents that are part of this application.

Container.LivenessTestResult

The outcome of the Passive Liveness test; see the LIVENESS_RESULT_TYPE constant properties above for details. If no Passive Liveness test was carried out on the application, this property will not be included.

Note

To enable Passive Liveness for your account, contact TrustID.

Container.LivenessTestScore

The score for the liveness algorithm. The higher the score, the greater the confidence in the result.

Container.OverallStatus

The overall result of the application. This will always be returned as either Container.OVERALL_STATUS_TYPE.NO_ALERT or Container.OVERALL_STATUS_TYPE.ALERT and can be marked as Container.OVERALL_STATUS_TYPE.RESOLVED by a user.

Methods

Container.createCustomFields(flexibleFields, flexibleFieldValues, containerId)

Create application-level custom fields that can be passed into Api.createDocumentContainer, Api.updateDocumentContainer or Api.createGuestLink as application-level custom fields.

Application-level custom fields must be composed out of meta information about all available fields the system provides and the actual field values for any particular document container.

Arguments
  • flexibleFields (object()) – Object representing meta information about all application-level custom fields that the system supports.

  • flexibleFieldValues (object()) – Object representing name/value pairs that are representing a set of application-level custom field values.

  • containerId (guid()) – Optional: Unique identifier of an existing document container for which application-level custom fields are updated. This argument can be omitted when creating a new document container (as the corresponding container identifier is not known yet).

See also

Application-level Custom Fields for an example of how to set application-level custom fields using this method.

Container.Container.getLivenessTestResultDisplay()

Return a string representation of the Liveness Test result.

Container.updateFromJson(json)

Update the application’s data, list of documents and custom fields according to the given JSON information of a new version of the same application. New documents are added, changes are propagated and deprecated data is removed.

Arguments
  • json (object()) – New application data (JSON).

Container.getFirstDocument()

Return the first document of this application that has an applicant name.

Container.getDocumentById(documentId)

Return an instance of Class Document that refers to a document of this application with the given documentId.

Arguments
  • documentId (string()) – The unique identifier of the document.

Container.getApplicantName()

Return the full name of the applicant based on the first document within this application that has sufficient information about the name.

Container.getApplicationDisplayName()

Return the full name of the applicant based on the first document within the application that has sufficient information about the name alongside the document type.

Container.getCreatedAtDisplay()

Return the display representation of the date this container was created or scanned (human-readable).

Container.hasMultipleDocuments()

Return true if this application contains more than one document.

Container.getPrevDocument(currentDocument)

Return the previous document relative to the given document for this application.

Arguments
  • currentDocument (Document()) – The current document on which basis the previous document is returned.

Container.getNextDocument(currentDocument)

Return the previous document relative to the given document for this application.

Arguments
  • currentDocument (Document()) – The current document of which basis the next document is returned.

Container.hasFlexibleFields()

Return true if this application has at least one application-level custom field.

Container.getFlexibleFields()

Return a list of Class ApplicationFlexibleFieldValue for each application-level custom field that is attached to this application.