Working with Applications

An application is a container for documents. The container represents an application that contains one or more documents, additional metadata for the application itself, and details of how it was obtained, alongside application-level custom fields.

Request

POST {{server}}/VPE/dataAccess/retrieveDocumentContainer/
Content-Type: application/json

{
    "DeviceId": "device-id",
    "SessionId": "...",
    "ContainerId": "..."
}

To obtain a list of all documents contained, use the Container.Documents property of the Container model.

Response

{
    "Success": true,
    "Message": "Operation executed successfully.",
    "AccessDenied": false,
    "SessionExpired": false,
    "Container": {
       ApplicantPhotoImage: null,
       ApplicationFlexibleFieldList: "...",
       BranchId: "...",
       BranchName: "...",
       CreatedAt: "...",
       DocumentStorageType: 7,
       Documents: [],
       Id: "...",
       OrganisationId: "...",
       OrganisationName: "...",
       ReferralHistory: [],
       ReferredAt: null,
       ScannedByUser: "...",
       UpdatedAt: "...",
       UserId: "...",
       VpeName: "..."
    }
}
var api = new TVS.Api();
api.login('username', 'password').then(function() {
    // retrieve document container for the given containerId(guid)...
    return api.retrieveDocumentContainer(containerId);
}).then(function(application) {
    // applicant name
    console.log('applicant:', application.getApplicantName());

    // first document with representative applicant information
    var doc = application.getFirstKnownDocument();
    console.log('applicant:', doc.getFullname());
});

The application itself does not necessarily maintain information about the applicant. This information is only available on a document level. However, it is often desirable to get some representative information about the application itself (based on one of the contained documents).

Accessing Documents (Javascript only)

An application contains a list of documents, accessed through the property Container.Documents.

var api = new TVS.Api();
api.login('username', 'password').then(function() {
    // retrieve document container for the given containerId(guid)...
    return api.retrieveDocumentContainer(containerId);
}).then(function(application) {
    // get document via identifier
    var doc = application.getDocumentById(application.Documents[1].DocumentId);
    console.log('second document:', doc);
});

Any particular document can be accessed by using its unique document identifier as shown here.

var api = new TVS.Api();
api.login('username', 'password').then(function() {
    // retrieve document container for the given containerId(guid)...
    return api.retrieveDocumentContainer(containerId);
}).then(function(application) {
    // get document via identifier
    if (application.hasMultipleDocuments()) {
        var doc = application.getDocumentById(application.Documents[1].DocumentId);
        var prev = application.getPrevDocument(doc);
        var next = application.getNextDocument(doc);

        console.log('previous document:', prev);
        console.log('next document:', next);
    }
});

This only ever returns a document that is actually contained within the application. Similarly, the next or previous document relative to any given document can be obtained as shown above.

Application-level Custom Fields

An application may store additional application-level custom fields. A custom field must be configured by the TrustID Cloud in order to become available. Further visibility of custom fields may be limited according to user privileges and the branch a user is associated with.

View all the application-level custom fields for an application as shown below:

Request

POST {{server}}/VPE/dataAccess/retrieveDocumentContainer/
Content-Type: application/json

{
    "DeviceId": "device-id",
    "SessionId": "...",
    "ContainerId": "..."
}

Response

{
    "Success": true,
    "Message": "Operation executed successfully.",
    "AccessDenied": false,
    "CallbackId": null,
    "Locked": false,
    "SessionExpired": false,
    "VpeUnreachable": false,
    "Container": {
        "ApplicationFlexibleFieldList": [
        {
            "m_Item1": {},
            "m_Item2": {
                "FieldValueDate": null,
                "FieldValueDecimal": null,
                "FieldValueInt": null,
                "FieldValueString": "AndyCW",
                "FlexibleFieldDataTypeIdDup": 1,
                "FlexibleFieldDisplayNameDup": "Guest Email Address",
                "FlexibleFieldId": "ad855392-7cd9-4b79-91be-6bb828969fbd",
                "FlexibleFieldNameDup": "__SYS_GuestName",
                "FlexibleFieldVersionId": "ad855392-7cd9-4b79-91be-6bb828969fbd",
                "HelpTextDup": "Name of person sent a guest link.",
                "MandatoryDup": false
            }]
        }
    }
}

Document Container Validation List

The TrustID Cloud provides a list of validation for various aspects of a document container. A container validation usually represents a fact or an outcome of a validation process on the document data itself.

Container Validation List are designed to provide a comprehensive summary for different validation process that the TrustID Cloud carries out based on the information presented by the continer.

A number of different sets of validation are available; for example, Kyc Aml Check, Pep And Sanction Check.

The following example demonstrates how container validation can be enumerated and presented:

Request

POST {{server}}/VPE/dataAccess/retrieveDocumentContainer/
Content-Type: application/json

{
    "DeviceId": "device-id",
    "SessionId": "...",
    "ContainerId": "..."
}

Response

{
    "AccessDenied": false,
    "Message": "Operation executed successfully.",
    "SessionExpired": false,
    "Success": true,
    "Container":
    {
                   "Documents": [{
                        "CreatedAt": "/Date(...)/",
                        "CustomFieldDictionary": [],
                        "CustomFieldKeys": [],
                        "DocumentFields": [],
                        "DocumentId": "...",
                        "DocumentContainerValidationList": [{
                                "ActionsText": null,
                                "DescriptionText": null,
                                "DetailedResult": "No Match",
                                "DisplayName": "Kyc Aml Check",
                                "DocumentContainerId": "...",
                                "Id": ...,
                                "InformationText": null,
                                "Name": "KycAmlCheck",
                                "OutcomeCommentText": null,
                                "RefFieldNames": null,
                                "ValidationOutcome": 4
                          },
                          {
                                "ActionsText": null,
                                "DescriptionText": null,
                                "DetailedResult": "Clear",
                                "DisplayName": "Pep And Sanction Check",
                                "DocumentContainerId": "...",
                                "Id": ...,
                                "InformationText": null,
                                "Name": "PepAndSanctionCheck",
                                "OutcomeCommentText": null,
                                "RefFieldNames": null,
                                "ValidationOutcome": 4
                          }]
                  }]
    }
}

Notable properties are:

See also

See the DocumentContainerValidation() class reference for more information about validation properties.