Policy Status Change API
This API is used in order to automatize the transition of a policy in the Issued and In Force statuses.
The PolicyStatusChangeAPI
endpoint uses a library hat contains functions used in the process.
This library contains 2 main functions (General and Notifications), and each of these 2 functions contain different functions that helps on policy status change process.
The first main function (General) contains the functions presented below and returns them as methods from an object. The object construction is given below:
{
findPolicy: findPolicy,
validateInput: validateInput,
updatePolicy: updatePolicy
}
(General) functions:
findPolicy(inputValues)
: function that executes a query to find a specific policy.
Input parameters:
-
inputValues - parameters
Output parameters:
-
query - found policy
validateInput(inputValues)
: function that validates the input.
Input parameters:
-
inputValues - parameters
Output parameters:
-
rez
updatePolicy(inputValues)
: function that make the updates for the status and other data .
Input parameters:
-
inputValues - parameters
Output parameters:
-
response
The second main function (Notifications) is used to send notifications on the policy status change (transitions) and contains the functions presented below and returns them as methods from an object. The object construction is given below:
{
getPolicyStatusName: getPolicyStatusName,
getAccountDataForNotification: getAccountDataForNotification,
checkEmailTemplateExists: checkEmailTemplateExists,
generateNotifcation: generateNotifcation,
sendNotification: sendNotification
}
(Notifications) functions:
getPolicyStatusName(statusName);
: function that returns the business status display name of a entity.
Input parameters:
-
statusName - (string) - The entity status name
Output parameters:
-
query - Array with the results
getAccountDataForNotification(accountdId);
: function that returns different attributes from the “Account” entity, based on the account ID.
Input parameters:
-
accountdId - (string) - The account id;
Output parameters:
-
query- Array that contains an object with the following results:
-
FirstName
-
LastName
-
Email
-
Phone
-
checkEmailTemplateExists(templateName);
: function that checks if an email template exists in the emailTemplate
entity.
Input parameters:
-
templateName - (string) - The template name;
Output parameters:
-
tokens - An object with the following results:
-
TemplateName
-
generateNotifcation(values);
: function that creates the object that will be used to send a notification.
Input parameters:
-
values - (object) - The context object
Output parameters:
-
tokens - An object with the following results
-
FirstName
-
LastName
-
Name
-
PolicyNumber
-
IssuedDate
-
Email
-
BusinessStatus
-
PolicyEndDate
-
sendNotification(policyData, templateName);
: function that sends a notification with the help of the functions presented above and only if the PolicyAdminUsed
parameter is set to 1. This function will be triggered only on the following FTOS_INSPA_Policy transitions status change:
-
Decline by screening
-
Closed by Claim
-
Withdraw on client’s request
-
Cancelled
-
Lapsed
Input parameters:
-
policyData- (object) - The context object
-
templateName- (string) - The template name
Output parameters:
-
N/A
Call:
var p = {
"policyIdentifiers": {
"policyId": null,
"policyNo": '8000043'
},
"updateType": "Issued", // "In Force"
"policyUpdates": {
"policyNo": null,
"policyBeginDate": null,
"policyValidityType": null,
"policyValidity": '6'
}
}
ebs.callActionByNameAsync("PolicyStatusChangeAPI", p)
.then(
function (e) {
console.log(e.UIResult.Data)
}
);
Error Codes:
-
"ERR06.01 - PolicyId or PolicyNo could not be null!"
→ could not find a policy if at least one of the params is not specified. -
"ERR06.03 - The Policy is not in Proposal status, therefore the transition to Issued is not possible!"
→ when transitioning the policy to Issued status the policy need to be in Proposal Status; -
"ERR06.04 - The Policy is not in Issued status, therefore the transition to In Force is not possible!";
→ when transitioning the policy to In Force status the policy need to be in Issued Status; -
ERR06.05 - Policy does not exists!;
→ when no policy with specified name/id is found
Response: