Contract
3. Contract
All contract-related feature sets are available in Contract
class. There are three primary functions under this class.
3.1. generate
This function provides consumers to generate documents using templates and transaction data.
Declaration
public function generate($templateId, $format = "PDF", $transactionId = "", $fillData = array())
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 the 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 the BLANK value if the parameter is left out during execution. |
Object - [Out] | N/A | The entire verification object is streamed into $payload named parameter and returned. |
3.2. listTemplate
The List Template function retrieves a list of contract templates based on the provided filters.
Declaration
public function listTemplate($order = -1, $limit = 10, $offset = 0, $filterTemplateId = "")
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). If the parameter is left out during execution, the function will use the -1 value. - 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. If the parameter is left out during execution, the function will use the -1 value. 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 $payload named parameter and returned. |
3.3. getTemplate
This function enables the developer to retrieve the Template details as per the provided id.
Declaration
public function getTemplate($templateId)
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 the BLANK value if the parameter is left out during execution. |
Object - [Out] | N/A | The entire template object is streamed into $payload named parameter and returned. |
3.4. deleteTemplate
Any unwanted template can be deleted by passing the relevant ID to this function.
Declaration
public function deleteTemplate($templateId)
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 the BLANK value if the parameter is left out during execution. |
Object - [Out] | N/A | The template deletion confirmation object is streamed into $payload named parameter and returned. |
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
public function createTemplate($name, $content, $orientation="0", $timezone = "UTC", $font = "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 the BLANK value if the parameter is left out during execution. The function will throw an exception if the BLANK value is passed in this parameter. |
String - [In] | $content | HTML based template. The function will use the BLANK value if the parameter is left out during execution. The function will throw an exception if the 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 the 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 generated template object streamed into $payload named parameter and returned. |
3.6. updateTemplate
Any existing template can be updated with this function based on the provided templateId.
Declaration
public function updateTemplate($templateId, $name, $content, $orientation="0", $timezone = "UTC", $font = "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 the BLANK value if the parameter is left out during execution. throw an exception if the BLANK value is passed in this parameter. |
String - [In] | $name | Template name based on the requirement. The function will use the BLANK value if the parameter is left out during execution. The function will throw an exception if the BLANK value is passed in this parameter. |
String - [In] | $content | HTML based template. The function will use the BLANK value if the parameter is left out during execution. The function will throw an exception if the BLANK value is passed in this parameter. |
String - [In] | $orientation | Template orientation can be either landscape or portrait. 0=Portrait(Default), 1=Landscape - 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 font value if the parameter is left out during execution. |
Object - [Out] | N/A | The updated template object streamed into $payload named parameter and returned. |
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 11 months ago