Generate Master Policy API
The master policy is a type of "Mother Policy" that includes a collection of "Child Policies" (general policies) that have the same Insurance type. For example, a firm makes a master policy to assure all the cars that the firm hold. In the same time, every car has his own insurance policy.
A Master Policy can be manually generated by the user, but also using the generateMasterPolicy API.
An example of a generated Masterpolicy is given below:
let p = {
contractor: {
uniqueIdentifier: "0000000000000",
type: "Individual person",
firstName: "John",
lastName: "Smith",
email: "john.smith@gmail.com",
phone: "0720202020"
},
agent: {
agentId: "Agent Test"
},
broker: {
brokerId: "Broker1"
},
startDate: '2022-02-08', // YYYY-MM-DD
issuedDate: '2022-02-07',
validity: 12,
validityType: "Months",
currency: "EUR",
paymentFrequency: "monthly",
paymentType: "BrokerCollection",
quoteNo: "123456",
//'renewedMasterPolicyId': '', // FTOS_INS_MasterPolicyid
mentions: 'This is a Master Policy',
};
ebs.callActionByNameAsync("generateMasterPolicy", p)
.then(
function(e){
console.log(e.UIResult)
}
);
Here is the list of data parameters included in the request:
|
Parameter |
Description |
|---|---|
|
contractor |
The area containing the contractor details. |
| uniqueIdentifier |
The personal unique identifier number, depending on the contractor’s type. |
| type |
The contractor type (“Individual person” or “Legal person”). |
| firstName |
The contractor's first name. |
| lastName |
The contractor's last name. |
|
The contractor's email. |
|
| phone |
The contractor's mobile phone. |
|
agent |
The object containing the agent details. |
| agentId |
The agent Id. |
| type |
The type of the agent issuing the policy (“Individual person” or “Legal person”). |
|
broker |
The object containing broker details. |
| brokerId |
The broker Id. |
|
issuedDate |
The date of issuance, basic format ISO 8601 YYYY-MM-DD. |
|
startDate |
The policy begin date, basic format ISO 8601 YYYY-MM-DD. |
|
validity |
The amount of years, months or days you want this policy to be valid for. 12 value supported in the first version of the API. |
|
validityType |
The type of validity. Months value supported in the first version of the API. |
|
currency |
The currency for the Masterpolicy. |
|
noOfInstallments |
The number of the installments. |
|
paymentFrequency |
The payment frequency. Values: full for Full(entire payment at once)annually for Annually semiAnnually for Semi-Annuallyquarterly for Quarterlymonthly for Monthly. |
|
paymentType |
The payment type. Values: OP for bank transfersPayU for PayUPayU-on time for PayOnTimebrokerCollection for Broker Collection. |
|
quoteNo |
The number of the quote. |
|
renewedMasterPolicyId |
The old Masterpolicy number, in case of renewal. |
|
mentions |
The special mentions at policy level. |
This is an example of a response:
{
"errorMessage": null,
"errorCode": null,
"isSuccess": true,
"result": {
"masterPolicyData": [{
"masterPolicyStartDate": "2022-02-08",
"masterPolicyEndDate": "2023-02-07",
"masterPolicyId": "449eeb31-8599-4649-86a6-4c1509aa937c"
}]
}
}
Response description:
|
Key |
Description |
|---|---|
|
Error code |
The error code. |
|
Error message |
The error message. |
|
isSuccess |
Marks if the request was successful or not. |
|
result |
The array of objects containing details about the identified policies. |
|
masterPolicyData |
The array of details for each generated policy. |
| masterPolicyStartDate |
The Masterpolicy start date. |
| masterPolicyEndDate |
The Masterpolicy end date. |
| masterPolicyId |
The GUID identifying the policy in CORE. |
The following are the error messages that can be encountered during the Masterpolicy generation process:
|
Code |
Text |
Description |
|---|---|---|
|
ERR.PA.50101 |
Broker data cannot be identified! |
Broker does not exist. |
|
ERR.PA.50102 |
Invalid issued date!
|
Issue date value provided on issuedDate key is less than current date. |
|
ERR.PA.50103 |
Invalid start date! |
Start date value provided on startDate key is less than or equal with issuedDate value. |
|
ERR.PA.50104 |
Invalid paymentType! |
Value provided on paymentType key is not valid (not part of the accepted values). |
|
ERR.PA.50105 |
Invalid currency! |
Currency code provided on currency key is not identifed. |
|
ERR.PA.50108 |
Existing policy for the same quote and insurance type! |
Another policy of the same insurance type is already registered. |
|
ERR.PA.50111 |
Field is mandatory. Nothing was saved!' |
Câmpul este obligatoriu. Datele nu au fost salvate! |
|
ERR.PA.50112 |
Agent data cannot be identified! |
Invalid Agent! |
The endpoint is responsible for generating Masterpolicies in the Core system. When generating a Masterpolicy, some information should be sent in order for the action to be successful. You can generate a new Masterpolicy using the object above.
This library contains all the necessary functions for manipulating, updating or inserting data whenever a Masterpolicy generation endpoint is being called.
validateMpInput(mpData): This function validates all the inputs that are given in the call.
Input parameters:
-
mpData - the informations sent in the generare object.
Output parameters:
-
rez - bulean true/false.
invariantDateToDate(date);: This function transforms an invariant date into a date without the time. It only returns the date.
Input parameters:
-
date- (invariantDate) - The invariant date.
Output parameters:
-
invariantDate - (Date) - The date in the new format.
getMainPolicy(policyNo, validityDate);: This function returns an object with different policy data based on the policy number and a date.
Example of calling the function: PolicyData.getMainPolicy('80000753', ‘2021-10-24’);
Input parameters:
-
policyNo - (string) - The policy number.
-
validityDate - (string) - The request date in the format: “2021-11-01”.
Output parameters:
-
If the policy exists and it was valid at the requested date, the object contains the following params:
-
isSuccess: true
-
errorMessage: null
-
errorCode: null
-
result: an object with the following policy data:
-
PolicyId - (string) - The policy ID.
-
PolicyIssuedDate - (invariant date) - The policy issued date.
-
PolicyBeginDate - (invariant date) - The policy begin date.
-
PolicyEndDate - (invariant date) - The policy end date.
-
PolicyAttributeVersionDate - (invariant date) - The policy attribute version date.
-
PolicyBusinessStatus - (string) - The policy business status.
-
-
-
If the policy does not exist or it wasn’t valid on the requested date, the object contains the following:
-
isSuccess: false
-
errorMessage: The error message
-
errorCode: The error code
-
result: null.
-
getPolicyCoverages(policyId);: This function returns an object with the policy coverages based on the policy ID.
Example of calling the function: PolicyData.getPolicyCoverages(policyId)
Input parameters:
-
policyId - (string) - The policy ID.
Output parameters:
-
If the policy has coverages, the object contains the following params:
-
isSuccess: true
-
errorMessage: null
-
errorCode: null
-
result: an array with one or many objects with the following data:
-
CoverageId - (string) - The coverage ID.
-
CoverageCode - (string) - The coverage code.
-
CoverageBeginDate - (invariant date) - The coverage begin date.
-
CoverageEndDate - (invariant date) - The coverage end date.
-
CoverageAmountInsured - (numeric) - The coverage insured amount.
-
CoveragePremiumAmount - (numeric) - The coverage premium amount.
-
CoverageCurrency - (string) - The coverage currency code.
-
CoverageIndemnityLimit - (numeric) - The coverage indemnity limit amount.
-
CoverageWaitingPeriod - (numeric) - The coverage waiting period.
-
CoverageWaitingPeriodType - (string/optionSet) - The coverage waiting period.
-
-
-
If the policy does not have any coverages, the object contains the following:
-
isSuccess: false
-
errorMessage: The error message
-
errorCode: The error code
-
result: null.
-
getCoverageModules(parentId);: This function returns an object with the coverage modules based on the coverage ID.
Example of calling the function: PolicyData.getCoverageModules(coverageId)
Input parameters:
-
parentId - (string) - The coverage ID.
Output parameters:
-
If the coverage have modules, the object contains the following params:
-
isSuccess : true
-
errorMessage: null
-
errorCode: null
-
result: an array with one or many objects with the following data:
-
ModuleId - (string) - The module ID.
-
ModuleCode - (string) - The module code.
-
ModuleAmountInsured - (numeric) - The module insured amount.
-
ModuleCurrency - (string) - The module currency code.
-
-
-
If the coverage does not have any modules, the object contains the following:
-
isSuccess: false
-
errorMessage: The error message
-
errorCode: The error code
-
result: null.
-
getCoveredRisks(moduleId);: This function returns an object with the covered risks based on the module ID.
Example of calling the function: PolicyData.getCoveredRisks(moduleId)
Input parameters:
-
moduleId - (string) - The module ID.
Output parameters:
-
If the module have covered risks, the object contains the following params:
-
isSuccess : true
-
errorMessage: null
-
errorCode: null
-
result: an array with one or many objects with the following data:
-
RiskName - (string) - The risk name.
-
RiskImplicitReserve - (numeric) - The risk implicit reserve.
-
RiskValueLimit - (numeric) - The risk value limit.
-
RiskCurrency - (string) - The risk currency code.
-
-
-
If the module does not have any covered risks, the object contains the following:
-
isSuccess: false
-
errorMessage: The error message
-
errorCode: The error code
-
result: null.
-
getPolicyData(token);: This function returns the queried policy with the help of the functions presented above.
Example of calling the function: PolicyData.getPolicyData(token)
Input parameters:
-
token - (object) - An obejct which contains the following:
-
policyNo - (string) - The policy number.
-
validityDate - (string) - The date in the following format: “2021-11-01”.
Output parameters:
-
If the policy exists and it was valid at the requested date, the object will contain:
-
isSuccess : true
-
errorMessage: null
-
errorCode: null
-
result: an object with the following data:
-
PolicyBeginDate - (invariant date) - The policy begin date.
-
PolicyEndDate - (invariant date) - The policy end date.
-
Coverages - (array) - An array which contains one or many objects with the following data:
-
CoverageCode - (string) - The coverage code.
-
CoverageBeginDate - (invariant date) - The coverage begin date.
-
CoverageEndDate - (invariant date) - The coverage end date.
-
CoverageAmountInsured - (numeric) - The coverage insured amount.
-
CoveragePremiumAmount - (numeric) - The coverage premium amount.
-
CoverageCurrency - (string) - The coverage currency code.
-
CoverageIndemnityLimit - (numeric) - The coverage indemnity limit amount.
-
CoverageWaitingPeriod - (numeric) - The coverage waiting period.
-
CoverageWaitingPeriodType - (string/optionSet) - The coverage waiting period.
-
Modules - (array) - An array which contains one or many objects with the following data:
-
ModuleCode - (string) - The module code.
-
ModuleAmountInsured - (numeric) - The module insured amount.
-
ModuleCurrency - (string) - The module currency code.
-
CoveredRisks - An array containing one or many objects with the following data:
-
RiskName - (string) - The risk name.
-
RiskImplicitReserve - (numeric) - The risk implicit reserve.
-
RiskValueLimit - (numeric) - The risk value limit.
-
RiskCurrency - (string) - The risk currency code.
-
-
-
-
BusinessStatus- (string) - The policy business status.
-
-
-
If the policy does not exist or it was not valid at the requested date, the object will contain the following:
-
isSuccess: false
-
errorMessage: The error message
-
errorCode: The error code
-
result: null.