Contract
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
def generate(
self,
templateId: str = '',
_format: str = 'PDF',
transactionId: str = '',
fillData=None
):
Here are the input and output parameters defined against this function.
Type (In/Out) | Name | Description |
---|---|---|
String - [In] | templateId | Document template id against which the document is to be generated with real-time values. |
String - [In] | _format | Document output format parameter. If left out, these parameters will be set to PDF. |
String - [In] | transactionId | Transaction 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] | fillData | This 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. |
Object - [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
def listTemplate(
self,
order: int = -1,
limit: int = 10,
offset: int = 0,
filterTemplateId: str = ''
):
Here are the input and output parameters defined against this function.
Type (In/Out) | Name | Description |
---|---|---|
Integer - [In] | order | Sort 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] | limit | Number 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] | offset | Start the list from a particular entry index. |
Integer - [In] | filterTemplateId | Filter result by template ID. |
Object - [Out] | N/A | The 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) | Name | Description |
---|---|---|
Integer - [In] | templateId | Template ID that is to be retrieved. The function will use BLANK value if the parameter is left out during execution. |
Object - [Out] | N/A | The 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
def deleteTemplate(self, templateId: str = ''):
Here are the input and output parameters defined against this function.
Type (In/Out) | Name | Description |
---|---|---|
Integer - [In] | templateId | Template ID that is to be retrieved. The function will use BLANK value in case the parameter is left out during execution. |
Object - [Out] | N/A | The 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
def createTemplate(
self,
name: str = '',
content: str = '',
orientation: str = '0',
timezone: str = 'UTC',
font: str = 'Open Sans'
):
Here are the input and output parameters defined against this function.
Type (In/Out) | Name | Description |
---|---|---|
String - [In] | name | Template 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] | orientation | Template 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] | timezone | Template timezone. The function will use UTC timezone value in case the parameter is left out during execution. |
String - [In] | font | Template font. The function will use the Open Sans fonts value if the parameter is left out during execution. |
Object - [Out] | N/A | The 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
def updateTemplate(
self,
templateId: str = '',
name: str = '',
content: str = '',
orientation: str = '0',
timezone: str = 'UTC',
font: str = 'Open Sans'
):
Here are the input and output parameters defined against this function.
Type (In/Out) | Name | Description |
---|---|---|
Integer - [In] | templateId | Template 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] | name | Template 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. 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] | orientation | Template 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] | timezone | Template timezone. The function will use the UTC timezone value if the parameter is left out during execution. |
String - [In] | font | Template font. The function will use the Open Sans fonts value if the parameter is left out during execution. |
Object - [Out] | N/A | The 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.
Updated about 2 years ago