Get Formulas Structures API
Use this API to get the keys expected by the formulas attached on coverages (product items) or on product. The API will return information about all the formulas attached on the coverages of the products and all the structures for underwriting formulas attached on product level, for each context type. If necessary, in the API call you can specify a date and get the formula structure that was valid at that date, for the selected product.
A user makes a call for the formula structure for an insurance product, based on the code of that product. The user wants the formula structure which was valid at a certain date - respectively, 2021-05-21.
let p = {
"productCode": "BA_EMB"
"validityDate": "2021-05-21"
}
ebs.callActionByNameAsync("FTOS_IP_GetProductFormulasStructuresAPI", p)
.then(function(e) {
console.log(e)
})
Here is the list of data parameters included in the request:
| Parameter | Description |
|---|---|
| productCode | The code of the Insurance Product. |
| validityDate | The reference date, prior to the current date, for getting an earlier version of the product formulas structure. This key is not mandatory. When it is not provided, the API calls the current version of the formula. Accepted formats are: yyyy-mm-dd, dd/mm/yyyy, dd-mm-yyyy, or dd.mm.yyyy. |
This is an example of a response:
{
"isSuccess": true,
"errorMessage": null,
"errorCode": null,
"result": [
{
"productCode": "BA_EMB",
"premiumCalculationStructures": [
{
"code": "HHR0",
"formulaVersion": 1.0,
"formulaStructure": [
{
"key": "risks",
"value": null,
"masterType": "Collection",
"subType": "Object",
"objProps": "{\"Risk\":6,\"Module\":6,\"Price\":2}"
},
{
"key": "propertyInsuredAmount",
"value": null,
"masterType": "SimpleType",
"subType": "Decimal",
"objProps": null
},
{
"key": "propertyConstructionYear",
"value": null,
"masterType": "SimpleType",
"subType": "WholeNumber",
"objProps": null
}
]
},
{
"code": "HA",
"formulaVersion": 1.0,
"formulaStructure": [
{
"key": "buildingInsuredAmount",
"value": null,
"masterType": "SimpleType",
"subType": "Decimal",
"objProps": null
},
{
"key": "constructionYear",
"value": null,
"masterType": "SimpleType",
"subType": "WholeNumber",
"objProps": null
}
]
}
],
"uwRulesStructures": [
{
"contextType": "Underwriting",
"formulaVersion": 1.0,
"formulaStructure": [
{
"key": "insuredAmount",
"value": null,
"masterType": "SimpleType",
"subType": "Decimal",
"objProps": null
},
{
"key": "seismicZone",
"value": null,
"masterType": "SimpleType",
"subType": "Text",
"objProps": null
}
]
}
]
}
]
}
| Key | Description |
|---|---|
| Error code | Error code. |
| Error message | Error message. |
| isSuccess | Marks whether the request was successful or not. |
| result | Array of objects containing details about the prices. |
| productCode | The code of the Insurance Product. |
| premiumCalculationStructures | Array with each premium formula input parameters attached to a product item. |
| uwRulesStructures | Array with each underwriting formula input parameters attached to a product . |
The following are the error messages that can be encountered while calling the GetFormulasStructuresAPI:
| Code | Text | Description |
|---|---|---|
| ERR.IP.50201 | ERR.IP.50201 - Invalid validity date format! Please, use yyyy-mm-dd or dd/mm/yyyy or dd-mm-yyyy or dd.mm.yyyy! | Invalid date format for validityDate input parameter. |
| ERR.IP.50202 | ERR.IP.50202 - Invalid validity date! | Invalid date for validityDate input parameter. |
| ERR.IP.50203 | ERR.IP.50203 - Invalid key request! | Missing parameters in the request or wrong parameter name. |
| ERR.IP.50204 | ERR.IP.50204 - No active product identified! | No active insurance product found. |
| ERR.IP.50205 | ERR.IP.50205 - Error! The //code of product// insurance product was not approved at the requested date! | No active insurance product found at the date specified in validityDate input parameter. |
| ERR.IP.50206 | ERR.IP.50206 - Underwriting context type is not defined! | The underwriting context type is not defined. |
The FTOS_IP_GetProductFormulasStructuresAPI endpoint is responsible for getting the formulas input parameters structure for premium calculation for each product item and, also, for getting the formulas input parameters structure for the underwriting rules defined on product level.
From the FTOS_IP_InsuranceProductAPIs library, the GetFormulaInputParameters() function is used for getting the input parameters structure for the premium and underwriting formulas. The GetFormulaInputParameters() function wraps the following functions, necessary for validating and returning the input parameters structure:
This function validates the request fields.
Input parameters: inputData - The object containing the keys needed to call the endpoint.
Output parameters: An object containing the following keys, for describing the result of the validation:
-
isSuccess- true/ false - The boolean that shows whether the validation is successful. -
errorMessage- A null value or an error message as described in the error messages list. -
errorCode- A null value or an error code as described in the error messages list. -
result= An empty array [] or an array with details about the input parameters formula structure, as described in the response description section.
This function gets the premium formulas input parameters attached on the specified product items - identified by the code provided in the request. The function also uses other helper functions, implemented in the same library, to get the product details, the list of items, and the formulas attached on items.
Input parameters: inputData - The object containing the keys needed to call the function.
Output parameters: An array containing objects with 2 keys:
-
productCode- The code of the insurance product. -
premiumCalculationStructures- An array containing the following: objects for each product item, objects for the item code and the formula version number and objects for each input parameter.
This function gets the underwriting formulas input parameters attached on the specified product - identified by the code provided in the request. The function also uses other helper functions, implemented in the same library, to get the product details and the underwriting formulas attached on product.
Input parameters: inputData - The object containing the keys needed to call the function.
Output parameters: An array containing objects with 2 keys:
-
productCode- The code of the insurance product. -
uwRulesStructures- An array containing the following: object for the requested product item, object for the context type formula and the formula version number and, also, an object for each input parameter.
This function concatenates the results of the getPremiumFormulaStructure and getUWFormulaStructure functions into an array. This function is called inside the endpoint only if the request passes the validation - namely if “isSuccess” key from the response of validateRequest function is true.
Input parameters: inputData - The object containing the keys needed to call the endpoint FTOS_IP_GetProductFormulasStructuresAPI.
Output parameters: An array containing objects with 2 keys:
-
productCode- An object from getPremiumFormulaStructure output parameters. -
premiumCalculationStructures- An object from getPremiumFormulaStructure output parameters.