Class RemainingCredits

For a user that belongs to a branch, the system may keep track of credit information. Credits are used to upload new documents to the system and are purchased or obtained in advance. Remaining credits gives some information about how many credits are remaining to the current user.

var api = new TVS.Api();
api.login('branch-username', 'password').then(function(loginResponse) {
    if (loginResponse.RemainingCredits) {
        console.log('Branch:', loginResponse.RemainingCredits.Branch);
        if (loginResponse.RemainingCredits.Organisation) {
            console.log('Organisation:', loginResponse.RemainingCredits.Organisation);
        } else {
            console.log('User does not belong to any organisation.');
        }
    } else {
        console.log('User does not belong to any branch or remaining credit info. is not available');
    }
});
class RemainingCredits()

Captures information about the current user’s remaining credits.

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

Properties

RemainingCredits.Branch

The total number of remaining credits that are available to the current user’s branch. The number of credits left includes all credits that are assigned to the branch as well as any credits that are assigned to the organisation (if the branch belongs to an organisation).

This value is null if the current user does not belong to any branch.

RemainingCredits.Organisation

The total number of remaining credits that are available to the current user’s organisation. The amount of credits left includes all credits for all branches of the organisation.

This value is null if the current user does not belong to any organisation.

Note

Remaining credit information can always be obtained from the Api.RemainingCredits property of the Api() instance. Remaining credit information is automatically obtained and updated during these operations:

The following example demonstrates how to receive manually the current user’s latest remaining credit information:

var api = new TVS.Api();
api.login('branch-username', 'password').then(function() {
    api.queryScanCredits().then(function(remainingCredits) {
        if (remainingCredits) {
            console.log('Branch:', remainingCredits.Branch);
            if (remainingCredits.Organisation) {
                console.log('Organisation:', remainingCredits.Organisation);
            } else {
                console.log('User does not belong to any organisation.');
            }
        } else {
            console.log('User does not belong to any branch or remaining credit info. is not available');
        }
    });
});