3. Contract

All contract-related feature sets are available in Contract class. There are three primary functions in this class.

3.1. generate

This function provides consumers to generate documents using templates and transaction data.

Declaration

(async) generate(templateId, _format, transactionId, fillData) → {Promise.<*>}

Here are the input and output parameters defined against this function.

Type (In/Out)NameDescription
String - [In]templateIdDocument template id against which the document is to be generated with real-time values.
String - [In]_formatDocument output format parameter. If left out, these parameters will be set to PDF.
String - [In]transactionIdTransaction Id against which the document is to be generated. The function will retrieve data based on the provided transactionId. The function will use BLANK value if the parameter is left out during execution.
Array - [In]fillDataThis collection contains additional custom data that must be appended to the document. This is passed in the Key-Value pair. The function will use BLANK value if the parameter is left out during execution.
Promise.<*> - [Out]N/A- The entire verification object is streamed into resp.body named parameter and returned.

3.2. listTemplate

The List Template function retrieves a list of contract templates based on the provided filters.

Declaration

(async) listTemplate(order, limit, offset, filterTemplateId) → {Promise.<*>}

Here are the input and output parameters defined against this function.

Type (In/Out)NameDescription
Integer - [In]orderSort results by newest(-1) or oldest(1). The function will use the -1 value if the parameter is left out during execution. The value cannot be 1 or -1. The function will throw an exception of any one of these is used.
Integer - [In]limitNumber of items to be returned per call. The function will use the -1 value if the parameter is left out during execution. The 'limit' should be a positive integer greater than 0 and less than or equal to 100.
Integer - [In]offsetStart the list from a particular entry index.
Integer - [In]filterTemplateIdFilter result by template ID.
Promise.<*> - [Out]N/AThe entire array of template objects is streamed into resp.body named parameter and returned.

3.3. getTemplate

This function enables the developer to retrieve the Template details as per the provided id.

Declaration

(async) getTemplate(templateId) → {Promise.<*>}

Here are the input and output parameters defined against this function.

Type (In/Out)NameDescription
Integer - [In]templateIdTemplate ID that is to be retrieved. The function will use BLANK value if the parameter is left out during execution.
Promise.<*> - [Out]N/AThe entire template object is streamed into resp.body named parameter and returned back.

3.4. deleteTemplate

Any unwanted template can be deleted by passing the relevant ID to this function.

Declaration

(async) deleteTemplate(templateId) → {Promise.<*>}

Here are the input and output parameters defined against this function.

Type (In/Out)NameDescription
Integer - [In]templateIdTemplate ID that is to be retrieved. The function will use BLANK value in case the parameter is left out during execution.
Promise.<*> - [Out]N/AThe template deletion confirmation object is streamed into resp.body named parameter and returned back.

3.5. createTemplate

A new template, if required, can be created using createTemplate. This function requires template-based content that acts as a template for further processing.

Declaration

(async) createTemplate(name, content, orientation, timezone, font) → {Promise.<*>}

Here are the input and output parameters defined against this function.

Type (In/Out)NameDescription
String - [In]nameTemplate name based on the requirement. The function will use BLANK value if the parameter is left out during execution. The function will throw an exception if BLANK value is passed in this parameter.
String - [In]content- HTML based template. - Function will use BLANK value in case the parameter is left out during execution. The function will throw an exception if BLANK value is passed in this parameter.
String - [In]orientationTemplate orientation can be either landscape or portrait. 0=Portrait(Default), 1=Landscape. The function will use BLANK value if the parameter is left out during execution.
String - [In]timezoneTemplate timezone. The function will use UTC timezone value in case the parameter is left out during execution.
String - [In]fontTemplate font. The function will use the Open Sans fonts value if the parameter is left out during execution.
Promise.<*> - [Out]N/AThe generated template object streamed into resp.body named parameter and returned.

3.6. updateTemplate

Any existing template can be updated with this function based on the provided templateId.

Declaration

(async) updateTemplate(templateId, name, content, orientation, timezone, font) → {Promise.<*>}

Here are the input and output parameters defined against this function.

Type (In/Out)NameDescription
Integer - [In]templateIdTemplate name based on the requirement. The function will use BLANK value if the parameter is left out during execution. The function will throw an exception if BLANK value is passed in this parameter.
String - [In]nameTemplate name based on the requirement. The function will use BLANK value if the parameter is left out during execution. The function will throw an exception if BLANK value is passed in this parameter.
String - [In]contentHTML based template. The function will use BLANK value if the parameter is left out during execution. The function will throw an exception if BLANK value is passed in this parameter.
String - [In]orientationTemplate orientation can be either landscape or portrait. 0=Portrait(Default), 1=Landscape. The function will use BLANK value if the parameter is left out during execution.
String - [In]timezoneTemplate timezone. The function will use the UTC timezone value if the parameter is left out during execution.
String - [In]fontTemplate font. The function will use the Open Sans fonts value if the parameter is left out during execution.
Promise.<*> - [Out]N/AThe updated template object streamed into resp.body named parameter and returned back.

🚧

Update Process

Please note that the BLANK field provided will be overridden with the existing data; therefore, it is advised to pass on the current data for the specific field in case no update is required.