Get Policy Data API
The FTOS_GetPolicyDataAPI script is called with an object as data and calls the getPolicyData function from the "policyDataAPIs" server automation script library.
An example of calling this function is given below:
var p = {
policyNo: "80000753",
validityDate: '2021-10-24'
}
ebs.callActionByNameAsync('FTOS_GetPolicyData_API', p)
.then(function(e) {
console.log(e.UIResult);
});
FTOS_GetPolicyData_API - This endpoint is used to run the FTOS_GetPolicyData_API server automation script.
Request data parameters:
-
policyNo: policy number (mandatory);
-
validityDate: The request date (optional).
Response:
{
"isSuccess": true,
"errorMessage": null,
"errorCode": null,
"result": {
"PolicyIssuedDate": "2021-10-05",
"PolicyBeginDate": "2021-10-06",
"PolicyEndDate": "2022-10-09",
"Coverages": [
{
"Code": "DPA",
"BeginDate": "2021-10-10",
"EndDate": "2022-10-09",
"AmountInsured": 50000.0,
"PremiumAmount": 96.0,
"Currency": "RON",
"IndemnityLimit": 50000.0,
"WaitingPeriod": 0.0,
"WaitingPeriodType": null,
"Modules": [
{
"Code": "DPA1",
"AmountInsured": 50000.0,
"Currency": "RON",
"Risks": [
{
"Name": "Personal Accident",
"ImplicitReserve": 2000.00,
"ValueLimit": 50000.00,
"Currency": "RON"
}
]
}
]
},
{
"Code": "ICPA",
"BeginDate": "2021-10-10",
"EndDate": "2022-10-09",
"AmountInsured": 25000.0,
"PremiumAmount": 528.0,
"Currency": "RON",
"IndemnityLimit": 25000.0,
"WaitingPeriod": 0.0,
"WaitingPeriodType": null,
"Modules": [
{
"Code": "ICPA1",
"AmountInsured": 25000.0,
"Currency": "RON",
"Risks": [
{
"Name": "Personal Accident",
"ImplicitReserve": 2000.00,
"ValueLimit": 25000.00,
"Currency": "RON"
}
]
}
]
},
{
"Code": "PDA",
"BeginDate": "2021-10-10",
"EndDate": "2022-10-09",
"AmountInsured": 35000.0,
"PremiumAmount": 806.4,
"Currency": "RON",
"IndemnityLimit": 35000.0,
"WaitingPeriod": null,
"WaitingPeriodType": null,
"Modules": [
{
"Code": "PDA1",
"AmountInsured": 35000.0,
"Currency": "RON",
"Risks": [
{
"Name": "Personal Accident",
"ImplicitReserve": 2000.00,
"ValueLimit": 35000.00,
"Currency": "RON"
}
]
}
]
},
{
"Code": "MEACC",
"BeginDate": "2021-10-10",
"EndDate": "2022-10-09",
"AmountInsured": 20000.0,
"PremiumAmount": 460.8,
"Currency": "RON",
"IndemnityLimit": 20000.0,
"WaitingPeriod": 0.0,
"WaitingPeriodType": null,
"Modules": [
{
"Code": "MEACC1",
"AmountInsured": 20000.0,
"Currency": "RON",
"Risks": [
{
"Name": "Personal Accident",
"ImplicitReserve": 2000.00,
"ValueLimit": 20000.00,
"Currency": "RON"
}
]
}
]
}
],
"BusinessStatus": "Version Closed"
}
}
Response description:
-
isSuccess: Marks if the request was successful or not;
-
Error code: Error code;
-
Error message: Error message;
-
Result: Null or an object returned as response for the API call.
Error messages:
|
Code |
Text |
Description |
|---|---|---|
|
ERR01.01 |
ERR01.01 - Invalid/missing policy number!
|
There is no policy in the system with the requested number! |
|
ERR01.02 |
ERR01.02 - Invalid date format! |
The date should have the following format: 'xxxx-xx-xx' or 'xxxx/xx/xx'! |
|
ERR01.03 |
ERR01.03. - Invalid date! |
The policy was not valid at the requested date! |
|
ERR02.01 |
ERR02.01 - No coverage! |
The policy had no coverages at the requested date! |
|
ERR03.01 |
ERR03.01 - No modules for coverage! |
This coverage had no modules associated at the requested date! |
|
ERR04.01 |
ERR04.01 - No covered risks! |
This module had no covered risks at the requested date! |
The following server automation script library is available.
This library contains a main global function called PolicyData() which uses different functions to return a policy's details from a certain date based on the policy number and a date. The PolicyData() uses the following functions:
PolicyData(); - This main function returns an object with the following methods:
-
getMainPolicy - This method calls the getMainPolicy() function.
-
getCoverageModules - This method calls the getCoverageModules() function.
-
getCoveredRisks - This method calls the getCoveredRisks() function.
-
getPolicyData - This method calls the getPolicyData() function.
invariantDateToDate(date); - This function transform an invariant date into a date without the time. Will return only 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
-