PostIssuance Plugin
Overview
Some complex policies have many small documents, which are rendered separately. For cases where it’s desired to present these to the insured as a single package, it is useful to consolidate them within a single PDF file.
To support this and future use cases, Socotra now has a PostIssuance plugin which will fire after each major policy transaction’s issue event. The consolidation order can be invoked within this event.
Process
When the plugin is triggered, the following will occur:
The
datapayload is sent to the plugin and afterwards the returned object is inspected.The response to the initiating API request is made, and then an asynchronous consolidation procedure is initiated.
If there are any DocumentConsolidation objects, then for each one, in the order that the document locators are listed, they will be concatenated into a single consolidated document.
Metadata will be set for the new document, including
fileNameanddisplayName.The consolidated document will then be persisted, and it will then appear with other policy documents with the policy.
Note
If the deleteSourceDocuments property is true, each source document will be removed after consolidation
Important
Document consolation is an asynchronous process. Consolidation may not be complete at the time of the initial API response.
Configuration
This plugin is configured similarly to other plugins. See the Plugins topic for details. Here is a portion of a product’s policy.json file enabling the plugin:
{
"plugins": {
"getPostIssuanceResult": {
"path": "main/postIssuance.js",
"enabled": true
}
}
Script
The plugin is invoked with a data payload that contains information about the documents for the policy. Here is a simple example that shows all of the documents being consolidated on each invocation:
function getPostIssuanceResult(data)
{
let locators = data.documents.map(d => d.locator);
return {
documentConsolidations: [{
displayName: "My Consolidated Document",
documentLocators: locators,
fileName: "consolidated.pdf",
deleteSourceDocuments: true
}]
};
}
exports.getPostIssuanceResult = getPostIssuanceResult;
requiredpolicyLocator stringdocuments [PostIssuancePluginDocument]operation string newBusiness | endorsement | renewal | reinstatement | cancellationpolicy PluginPolicyInfo
requiredlocator stringdisplayName stringfileName stringoptionalcreatedTimestamp timestampurlExpirationTimestamp timestamppolicyModificationLocator stringurl string
requireddocumentConsolidations [DocumentConsolidation]
requireddisplayName stringdocumentLocators [string]fileName stringoptionaldeleteSourceDocuments boolean
Document Types
Only PDFs are supported. HTML-based documents can neither be a source of a consolidated document, nor the resultant document.