Proposal Configurator APIs
The FTOS_IP_ProposalConfigPremiumCalculation
API was designed to allow the interaction with the Proposal Configurator solution, returning details about the available cards and their premiums, based on the responses provided to the DNT questions. The current versions of the API can be used in the quotation process, to get the premium amount for each card, using the latest settings created for a specific quote config.
In order to get fast responses using the API, all the quote config details are stored in a JSON object in the configJSON
attribute of Quote Config entity. Every time a change occurs on the configs, this attribute is updated (adding/removing a new insurance persona on card config, adding/removing card from insurance personas, approving new versions of the cards, etc).
The update of the configJSON
attribute is handled by the updateConfigJSON
function from the FTOS_IP_ProposalConfigPremiumCalculationAPI
server automation scrips library, described here.
All the requests send using this API and their responses can be saved into the Product Interogation History entity. This action is available if the system parameter FTOS_IP_ProductInterogationHistory_Enablelog
value is set to 1.
The logic of the API is covered in the next diagram:
The following examples are using the ebs.callActionByNameAsync Fintech
SDK function.
let p = {
"quoteConfigCode": "PET",
"validityDate": null,
"quoteList" : [{
"quoteNumber": "Quote123",
"quoteId":"383e5ed0-3f6b-40c6-b67f-4b80322ea058",
"premiumCalculationDetails" : [{
"calculationDetails" :{
"insuredAmount": null,
"breed": "Cat",
"voluntaryExcess": 100,
"policyTerm": 10,
"petAge": 5,
"group": 25,
"product": "Lifetime5k",
"area": 17,
"lifetype": "Cat",
"breedName": "Boss",
"neutered": true,
"gender": "Female",
"lagDays": 2,
"price": 122,
"numberOfPets": 3,
"mixOfPets": "Mixed",
"claims": {
"isNewBusiness": false,
"nonReoccuring": 150,
"potentialReoccurence": 700,
"reoccurence": 1500,
"qtNonReoccuring": 1,
"qtPotentialReoccurence": 2,
"qtReoccurence": 3,
"isClean": true,
"previousPremium": 650
},
"isMultipet": true,
"salesChannel": "TEL",
"eligibleDiscounts": [ {
"discount": "Existing Customer",
"value": 0
}, {
"discount": "Staff",
"value": 0
}],
"postcodeArea": "IPT"
}
}
]
}] ,
"DNTResponses": [
{
questionCode: 'PET_DIR', // direct
answerValue: false
},
{
questionCode: 'PET_ONL', // online
answerValue: true
}
,
{
questionCode: 'PET_LFT', // time limited
answerValue: true
}, {
questionCode: 'PET_LIM', // life time
answerValue: true
}
]
};
ebs.callActionByNameAsync("FTOS_IP_ProposalConfigPremiumCalculation", p).then(function(e){console.log(e)}).catch(function (err) { console.log(err) });
{
"isSuccess":true,
"errorMessage":null,
"errorCode":null,
"result":[
{
"quoteNumber":"Quote123",
"quoteId":"383e5ed0-3f6b-40c6-b67f-4b80322ea058",
"quoteConfigCode":"PET",
"mainProductCode":"PET",
"mainProductName":"Pet Product",
"mainProductAttributeVersion":1,
"packages":[
{
"cardId":"d856fe97-fe2c-45e3-bfd4-9a11030c3654",
"cardDisplayName":"Blue",
"cardName":"Lifetime2k",
"cardCode":"PET_L_2",
"cardTypeId":"feced3bc-934e-492f-85aa-0a409df13c9f",
"productId":"9e1f9a36-fb6f-40de-a550-3e7a69ea33f5",
"productTariffTypeId":"f724bd42-2f6e-4cc1-b399-117132be310e",
"isHightlighted":null,
"personaCardOrder":1,
"formulaName":"BluePetRating",
"dimensions":[
{
"versionParams":"[\n {\n \"key\": \"numberOfPets\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"WholeNumber\",\n \"objProps\": null\n },\n {\n \"key\": \"group\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"WholeNumber\",\n \"objProps\": null\n },\n {\n \"key\": \"postcodeArea\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"Text\",\n \"objProps\": null\n },\n {\n \"key\": \"area\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"WholeNumber\",\n \"objProps\": null\n },\n {\n \"key\": \"breed\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"Text\",\n \"objProps\": null\n },\n {\n \"key\": \"claims\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"Object\",\n \"objProps\": \"{\\\"isNewBusiness\\\":3,\\\"nonReoccuring\\\":1,\\\"potentialReoccurence\\\":1,\\\"reoccurence\\\":1,\\\"qtNonReoccuring\\\":1,\\\"qtPotentialReoccurence\\\":1,\\\"qtReoccurence\\\":1,\\\"isClean\\\":3,\\\"previousPremium\\\":2}\"\n },\n {\n \"key\": \"cardName\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"Text\",\n \"objProps\": null\n },\n {\n \"key\": \"mixOfPets\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"Text\",\n \"objProps\": null\n },\n {\n \"key\": \"salesChannel\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"Text\",\n \"objProps\": null\n },\n {\n \"key\": \"neutered\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"Bool\",\n \"objProps\": null\n },\n {\n \"key\": \"lagDays\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"WholeNumber\",\n \"objProps\": null\n },\n {\n \"key\": \"insuredAmount\",\n \"value\": \"2000\",\n \"masterType\": \"SimpleType\",\n \"subType\": \"Decimal\",\n \"objProps\": null,\n \"keyType\": \"sumInsured\"\n },\n {\n \"key\": \"petAge\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"WholeNumber\",\n \"objProps\": null\n },\n {\n \"key\": \"policyTerm\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"WholeNumber\",\n \"objProps\": null\n },\n {\n \"key\": \"isMultipet\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"Bool\",\n \"objProps\": null\n },\n {\n \"key\": \"lifetype\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"Text\",\n \"objProps\": null\n },\n {\n \"key\": \"eligibleDiscounts\",\n \"value\": null,\n \"masterType\": \"Collection\",\n \"subType\": \"Object\",\n \"objProps\": \"{\\\"discount\\\":6,\\\"value\\\":2}\"\n },\n {\n \"key\": \"gender\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"Text\",\n \"objProps\": null\n },\n {\n \"key\": \"breedName\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"Text\",\n \"objProps\": null\n },\n {\n \"key\": \"voluntaryExcess\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"WholeNumber\",\n \"objProps\": null\n },\n {\n \"key\": \"price\",\n \"value\": null,\n \"masterType\": \"SimpleType\",\n \"subType\": \"Decimal\",\n \"objProps\": null\n }\n]",
"name":"V2000",
"displayName":"V2000",
"description":null,
"descriptionHTML":null
}
],
"insuredAmount":"2000",
"excess":null,
"excessType":null,
"cardItems":[
{
"cardItemId":"b70737d5-6e8c-483e-8668-33f79268e916",
"code":"C15",
"displayName":"Veterinary Fees",
"icon":"[]",
"descriptionHTML":null,
"description":null,
"isActive":true,
"cardItemOrder":1,
"insuranceProductId":"9e1f9a36-fb6f-40de-a550-3e7a69ea33f5",
"insuranceItemId":"afd9f12a-db61-4844-9c80-a7b99e3bf8f7",
"insuranceProductItemCode":"C15",
"premiumSplitPercentage":1.67,
"cardItemConfigId":"c7561b8c-08cf-4976-a446-18970fffe830",
"subCoverages":[
{
"subcoverageName":"Veterinary Fees",
"subcoverageCode":"SC1",
"subcoverageDescription":null
},
{
"subcoverageName":"CT/MRI scans and Associated Costs",
"subcoverageCode":"SC2",
"subcoverageDescription":null
},
{
"subcoverageName":"Cruciate Ligament",
"subcoverageCode":"SC4",
"subcoverageDescription":null
},
{
"subcoverageName":"Dentistry as a direct result of an accident",
"subcoverageCode":"SC3",
"subcoverageDescription":null
},
{
"subcoverageName":"Overseas Travel Extension (30 day limit)",
"subcoverageCode":"SC5",
"subcoverageDescription":null
}
],
"insuredAmount":"2000",
"excess":"99",
"excessType":"flat",
"dimensions":[
{
"versionParams":"[\n {\n \"key\": \"insuredAmount\",\n \"value\": \"2000\",\n \"masterType\": \"SimpleType\",\n \"subType\": \"Decimal\",\n \"objProps\": null,\n \"keyType\": \"sumInsured\"\n },\n {\n \"key\": \"excess\",\n \"value\": \"99\",\n \"masterType\": \"SimpleType\",\n \"subType\": \"Decimal\",\n \"objProps\": null,\n \"keyType\": \"excess\",\n \"keySubType\": \"flat\"\n }\n]",
"isDefault":true,
"name":"PET-Veterinary Fees-2000",
"displayName":"V2000",
"description":null,
"descriptionHTML":null
}
],
"premiumAmount":6.53
},
{
"cardItemId":"bf522d97-74bb-441c-91ad-e081c2b400bd",
"code":"C18",
"displayName":"Co-Insurance",
"icon":null,
"descriptionHTML":null,
"description":null,
"isActive":true,
"cardItemOrder":4,
"insuranceProductId":"9e1f9a36-fb6f-40de-a550-3e7a69ea33f5",
"insuranceItemId":"d7b10f03-0792-4404-8271-4f9a515761ee",
"insuranceProductItemCode":"C18",
"premiumSplitPercentage":8.33,
"cardItemConfigId":"6c976087-97d8-4ab0-8673-f21583d0a61e",
"subCoverages":[
],
"insuredAmount":null,
"excess":null,
"excessType":null,
"dimensions":[
],
"premiumAmount":32.56
}
],
"premiumAmount":39.09,
"formulaDetails":[
{
"formulaResult":{
"IsSuccess":true,
"ErrorMessage":null,
"Result":39.09,
"Input":{
"insuredAmount":2000,
"breed":"Cat",
"voluntaryExcess":100,
"policyTerm":10,
"petAge":5,
"group":25,
"product":"Lifetime5k",
"area":17,
"lifetype":"Cat",
"breedName":"Boss",
"neutered":true,
"gender":"Female",
"lagDays":2,
"price":122,
"numberOfPets":3,
"mixOfPets":"Mixed",
"claims":{
"isNewBusiness":false,
"nonReoccuring":150,
"potentialReoccurence":700,
"reoccurence":1500,
"qtNonReoccuring":1,
"qtPotentialReoccurence":2,
"qtReoccurence":3,
"isClean":true,
"previousPremium":650
},
"isMultipet":true,
"salesChannel":"TEL",
"eligibleDiscounts":[
{
"discount":"Existing Customer",
"value":0
},
{
"discount":"Staff",
"value":0
}
],
"postcodeArea":"IPT",
"cardName":"Lifetime2k",
"BaseRate":42.1746,
"ProductXBreed":1.4041,
"PolicyTerm":1.0394,
"VoluntaryExcessXAge":0.9669,
"Breed":0.9235,
"Area":1.411,
"AgeAtInception":1.1,
"AgeInMonths":60,
"AgeXSpeciesXLifetype":1.231,
"Neutered":0.9,
"UWAdjustment":1,
"PetPurchasePrice":1,
"LagDays":1.04,
"NumberOfPets":1,
"MixOfPets":1,
"RiskRate":98.28874384067849,
"ClaimsLoading":1.65,
"RiskRateRenewal":162.17642733711952,
"FixedExpenses":0,
"VariableExpenses":0.85,
"Commision":0.92,
"GrossPremiumPreConstraint":20.738673572521677,
"CollaringAndCapping":702,
"GrossPremiumNetIPT":702,
"MultipetDiscount":0.15,
"EligibleOtherDiscountValues":[
0.1,
0.15
],
"OtherDiscounts":0.15,
"IPT":1.12,
"GrossPremium":56.80,
"GrossPremiumMonthly":4.7,
"GrossPremiumFinal":56.80,
"ReportValueIPT":6.81,
"ReportRecalculateCommission":3.99,
"ReportRecalculateExpenses":6.899,
"NetPremium":39.09
}
}
}
]
}
]
}
]
}
Tariff Per Coverage Request
let p = {
"quoteConfigCode": "HHI",
"validityDate": null,
"mainEntityName": "FTOS_INSQB_QuoteProperty",
"mainEntityId": "9eabf832-5c37-4b9c-9cee-70a121ec846a",
"quoteList": [{
"quoteNumber": "123ASD",
"quoteId": "741eb23b-c169-4c18-b502-62dceb06bfdc",
"premiumCalculationDetails": [{
"itemCode": "BL01",
"calculationDetails": {
"buildingType": "Apartment",
"constructionYear": 2000,
"coverage": "Building",
"frequency": "monthly",
"insuredAmount": 70000.0,
"resistanceStructure": "Concrete",
"usageType": "Main residence",
"cardName": null
}
},
{
"itemCode": "CN01",
"calculationDetails": {
"buildingType": "Apartment",
"constructionYear": 2000,
"coverage": "Content",
"frequency": "monthly",
"insuredAmount": 70000.0,
"resistanceStructure": "Concrete",
"usageType": "Main residence",
"cardName": null
}
},
{
"itemCode": "HA01",
"calculationDetails": {
"buildingType": "Apartment",
"constructionYear": 2000,
"coverage": "Home Assistance",
"frequency": "monthly",
"insuredAmount": 70000.0,
"resistanceStructure": "Concrete",
"usageType": "Main residence",
"cardName": null
}
},
{
"itemCode": "TL01",
"calculationDetails": {
"buildingType": "Apartment",
"constructionYear": 2000,
"coverage": "Third party liability",
"frequency": "monthly",
"insuredAmount": 70000.0,
"resistanceStructure": "Concrete",
"usageType": "Main residence",
"cardName": null
}
}
]
}],
"DNTResponses": [{
questionCode: 'CNT',
answerValue: true
},
{
questionCode: 'HA',
answerValue: false
},
{
questionCode: 'TPL',
answerValue: false
}, {
questionCode: 'BLD',
answerValue: true
}
]
};
ebs.callActionByNameAsync("FTOS_IP_ProposalConfigPremiumCalculation", p).then(function(e){console.log(e)}).catch(function (err) { console.log(err) });
Tariff Per Coverage Response
{
"isSuccess":true,
"errorMessage":null,
"errorCode":null,
"result":[
{
"quoteNumber":"123ASD",
"quoteId":"741eb23b-c169-4c18-b502-62dceb06bfdc",
"quoteConfigCode":"HHI",
"mainProductCode":"Household Insurance",
"mainProductName":"Household Insurance",
"mainProductAttributeVersion":3,
"packages":[
{
"cardId":"0955c095-eeac-447a-a7c8-5151280dc5f6",
"cardDisplayName":"COMPLETE",
"cardName":"Complete",
"cardCode":"D0955C095-EEAC-447A-A7C8-5151280DC5F6",
"cardTypeId":"37249283-b147-4001-8ef0-55466c8cb96a",
"productId":null,
"productTariffTypeId":null,
"isHightlighted":false,
"personaCardOrder":3,
"formulaName":null,
"dimensions":[
],
"insuredAmount":null,
"excess":null,
"excessType":null,
"cardItems":[
{
"cardItemId":"4a4ad95f-04f4-4f31-8d46-0d46e319cbd0",
"code":"HHIBLD",
"displayName":"Buildings",
"icon":"[]",
"descriptionHTML":null,
"description":null,
"isActive":true,
"cardItemOrder":1,
"insuranceProductId":"8257c205-7c97-4563-85a6-ee4e0b1c3a53",
"insuranceItemId":"8f833fa1-652b-4985-ad3a-c02f00b19975",
"insuranceProductItemCode":"BL01",
"premiumSplitPercentage":null,
"cardItemConfigId":"b34e8df7-2b98-4d67-9dbd-7a34a4a7d091",
"subCoverages":[
{
"subcoverageName":"Theft",
"subcoverageCode":null,
"subcoverageDescription":null
},
{
"subcoverageName":"FLEXA",
"subcoverageCode":null,
"subcoverageDescription":null
},
{
"subcoverageName":"Other Natural Disasters",
"subcoverageCode":null,
"subcoverageDescription":null
},
{
"subcoverageName":"Malicious acts",
"subcoverageCode":null,
"subcoverageDescription":null
},
{
"subcoverageName":"Water Damage",
"subcoverageCode":null,
"subcoverageDescription":null
},
{
"subcoverageName":"Nat-Cat",
"subcoverageCode":null,
"subcoverageDescription":null
}
],
"insuredAmount":null,
"excess":null,
"excessType":null,
"dimensions":[
],
"premiumAmount":90.55
}
],
"premiumAmount":90.55,
"formulaDetails":[
{
"itemCode":"BL01",
"formulaResult":{
"IsSuccess":true,
"ErrorMessage":null,
"Result":90.552,
"Input":{
"buildingType":"Apartment",
"constructionYear":2000,
"coverage":"Building",
"frequency":"monthly",
"insuredAmount":70000,
"resistanceStructure":"Concrete",
"usageType":"Main residence",
"cardName":null,
"BuidingSumInsured":1.1,
"BuildingType":0.7,
"ResistanceStructure":0.7,
"ConstructionYear":1,
"UsageType":1,
"Frequency":1.2,
"FinalCoef":0.6468,
"BaseRate":0.002,
"FinalRate":0.0012936,
"PremiumAmount":90.552
}
}
}
]
}
]
}
]
}
Parameter | Description |
---|---|
quoteConfigCode | Code of the quote config used to identify the settings from the Proposal Configurator module. |
validityDate |
The reference date prior to the current date, used if you want to run the premium calculation formulas at a specific moment of time. The value is passed only to the formula. Use null as a value to use the current approved version of the formula. Format: YYYY-MM-DD |
mainEntityId |
Unique identifier or a record or null. Key used only if the proposal configuration includes insurance personas of type Persona or Audience. Record ID of the target entity instance that you wish to check whether it is associated with the audience/insurance persona. |
DNTResponses: |
Array of objects with details about the answers to DNT questions. Check DNTResponse object structure. For insurance personas of types audience/persona:
For insurance personas of type formula:
|
quoteList |
Array of objects containing details about individual quotes. Check Quote object structure. For simple quotes the array contains only one element. For master quotes, details about each individual quotes can be sent at once, if the DNT questions are the same for each of the quotes included in this array (we will evaluate the insurance personas only once, and the identified insurance personas will be used for all the objects included in this array). |
DNTResponse Object Structure
Parameter | Description |
---|---|
questionCode | Code of the DNT question included in the quote config identified by quoteConfigCode. |
answerValue | Answer to the question identified by questionCode, it can be either true or false. |
Quote Object Structure
Parameter | Description |
---|---|
quoteNumber | Number of the quote as allocated in the quotation process. |
quoteId |
Optional parameter, the uniqueidentified of a record from the Quote entity or null. If this key is null, then a new record is added in the Quote entity, saving just the name of the quote; the DNT answers are saved for this new record. If the Proposal Configurator solution and the quote flow are installed on the same instance, than a record already exists in the Quote entity, from the quotation process; pass it as a parameter. |
premiumCalculationDetails: | Array of objects used to run the premium calculation formulas. |
itemCode |
Mandatory only for products with Tariff = Per Coverage. Item code - the key is not available for products that have Tariff Type = Per Product. |
calculationDetails |
Object containing the keys needed to run the formula. The object structure is the one used to test the formula, it can be different for each item, based on the formula configuration |
Response Description
Key | Description |
---|---|
Error code | Error code. |
Error message | Error message. |
isSuccess | Marks if the request was successful or not. |
result | Array of objects containing details about the prices, for each of the objects included in the quoteList array from the request. |
quoteNumber | Number of the quote as allocated in the quotation process. |
quoteId |
ID of the quote. Either the quoteId passed as a parameter in the request of the new id of the records automatically inserted. |
quoteConfigCode |
Quote Config Code used to by the API. It has the same value as quoteConfigCode key from the request object. |
mainProductCode | The code of the product selected as main product on quote config. |
mainProductName | The name of the product selected as main product on quote config. |
mainProductAttributeVersion | The version of the product selected as main product on quote config. |
packages | Array of objects describing each of the available packages (cards). Check Package (card) object structure. |
Package (card) object structure
Key | Description |
---|---|
cardId | Unique identifier of the record from the Card entity. |
cardDisplayName | Display name attribute value from the Card entity. |
cardName | Name attribute value from the Card entity. |
cardCode | Code attribute value from the Card entity. |
cardTypeId |
Card type attribute value from the Card entity. Unique identified representing the ID of the selected option set item. |
productId |
Product attribute value from the Card entity. Unique identified representing the ID of the selected product. |
productTariffTypeId |
Type of tariff from the product selected in the Product attribute of the card. Unique identified representing the ID of the selected option set value from tariff type attribute on product level. |
formulaName |
For products with tariff type = per product, name of the formula linked to the product. For products with tariff type = per coverage, null. |
isHightlighted | Highlighted attribute value from the Insurance Persona Card entity record, associated with the card. |
personaCardOrder | Attribute value from the Insurance Persona Card entity record, associated with the card. |
dimensions | Array of objects describing the dimensions set on the card. Check Dimension object structure. |
insuredAmount | Value of the card dimension key marked as “Sum Insured“. |
excess | Value of the card dimension key marked as “Excess“. |
excessType | Subtype of the card dimension marked as “Excess“. |
cardItems | Array of objects describing the card items included in the card. Check Card item object structure. |
premiumAmount | Premium amount of the card. |
formulaDetails |
Array of objects describing the full results of the formula, useful for debugging purposes. Contains only one element for tariff = per product and multiple elements for tariff = per coverage - one element for each item. |
Card Item Object Structure
Key | Description |
---|---|
cardItemId | Unique identifier of the record from the Card Item entity. |
code | Code attribute value from the Card Item entity. |
displayName | Display name attribute value from the Card Item entity. |
icon | Icon attribute value from FTOS_IP_CardItem entity. |
descriptionHTML | Description HTML attribute value from FTOS_IP_CardItem entity. |
description | Description attribute value from FTOS_IP_CardItem entity. |
insuranceProductId |
Insurance Product attribute value from FTOS_IP_CardItem entity. Uniqueidentified representing the id of the selected product. |
insuranceItemId |
Insurance Item attribute value from FTOS_IP_CardItem entity. Uniqueidentified representing the id of the selected insurance product item. |
insuranceProductItemCode | Code of the selected insurance item. |
cardItemConfigId | Uniqueidenfier of the record from the Card Item Config, representing the link between the card and the card item. |
premiumSplitPercentage | Percentage attribute value from the Card Item Config entity. |
isActive | Active attribute value from the Card Item Config entity. |
cardItemOrder | Order attribute value from the Card Item Config entity. |
dimensions | Array of objects describing the dimensions set on the card item. Check Dimension object structure. |
insuredAmount | Value of the dimension key marked as “Sum Insured“, identified from the dimension object marked as default. |
excess | Value of the dimension key marked as “Excess“, identified from the dimension marked as default. |
excessType | Subtype of the dimension marked as “Excess“, identified from the dimension object marked as default. |
premiumAmount | Premium amount of the card item. |
subCoverages | Array of objects describing a sub coverage (module) of the product coverage selected on the card item. |
Sub Coverage Object Strucutre
Key | Description |
---|---|
subcoverageName | Name attribute of the product sub coverage (module). |
subcoverageCode | Code attribute of the product sub coverage (module). |
subcoverageDescription | Description attribute of the product sub coverage (module). |
Dimension Object Structure
Key | Description |
---|---|
versionParams | The inputParams attribute of the Card Dimension or Card Item Version entity. |
isDefault |
Filled in for card item dimensions. Default attribute value of the Card Item Config x Version entity. |
name | Name attribute value of the Card Dimension or Card Item Version entity. |
displayName | Display name attribute value of the Card Dimension or Card Item Version entity. |
description | Description attribute value of the Card Dimension or Card Item Version entity. |
descriptionHTML | Description HTML attribute value of the Card Dimension or Card Item Version entity. |
Code | Text | Description |
---|---|---|
ERR.PC.50101 | quoteNumber is mandatory for premium calculation! | quoteNumber input key missing or empty. |
ERR.PC.50102 | quoteId must be uniqueidentifier type! | quoteId included in the request, but is not a uniqueidentifier. |
ERR.PC.50103 | quoteConfigCode is mandatory for premium calculation! | quoteConfigCode input key missing or empty. |
The FTOS_IP_ProposalConfigPremiumCalculation
endpoint is used for calculating the premium amount, using the Proposal Configurator settings. The main logic of the on demand script is included in the proposalPremiumCalculation
function of the FTOS_IP_ProposalConfigPremiumCalculationAPI
server automation script library.
This library contains functions used by the proposal configurator API or functions used to support the logic.
The premium calculation API calls only one main function, proposalPremiumCalculation
. The flow logic is included in it. All the other functions from this library are helpers created to run small pieces of the process, that together cover all the logic.
proposalPremiumCalculation(context)
: This is the main function used to start the logic of the proposal configurator premium calculation API. It starts by validating the request (by calling the validateRequest
function) and then preparing pre-requisites variables and starting the cards identification and premium calculation process (by calling the runPremiumCalculationLogic
function).
Input parameters:
-
context - context object used by the on demand server automation script.
Output parameters:
-
object containing keys to describe the result of the API:
-
isSuccess - true/false;
-
errorMessage - null or error message as described in the error messages list;
-
errorCode - null or error code as describes in the error messages list;
-
result = [] or array with details about the price, as described in the Response Description section.
-
validateRequest(context)
: This function is used to validate request fields.
Input parameters:
-
context - context object used by the on demand server automation script.
Output parameters:
-
object containing keys to describe the result of the validation:
-
isSuccess - true/false;
-
errorMessage - null or error message as described in the error messages list;
-
errorCode - null or error code as describes in the error messages list;
-
result = [] or array with details about the price, as described in the Response Description section.
-
runPremiumCalculationLogic (context)
: This function is used for identifying the main variables used in the process and to prepare additional objects needed for the main logic to run. This function uses the calculatePremiumForQuotes
function to get the premium calculation results for all the cards and return them.
Input parameters:
-
context - context object used by the on demand server automation script.
Output parameters:
-
result = [] or array with details about the price, as described in the Response Description section.
calculatePremiumForQuotes(quoteConfigDetails, quoteList, dntResponses, formulaPersonasInput, validityDate, mainEntityName, mainEntityId)
: This unction covers the first steps of the API logic - identifying which are cards for which the premium calculation process needs to run, based on the identified insurance personas, and then calls calculatePremiumForCards
to calculate the premium amount for each card.
Considering the API flow diagram, this function includes:
-
Evaluating the quoteId key value and decide if a new Quote record needs to be inserted;
-
Identifying the formula or audience/persona insurance personas;
-
Saving DNT answers for non-formula insurance persona;
-
Identifying the cards allocated to the identified insurance personas;
-
Starting the premium calculation process per card.
Input parameters:
-
quoteConfigDetails - object containing details about the quote config used for this flow, identified by the quoteConfigCode request parameter, using the
getQuoteConfigDetails
function; -
quoteList - quoteList array included in the request;
-
dntResponses - DNTResponses array included in the request;
-
formulaPersonasInput- a new object created based on the DNTResponses values, used for running the formulas attached on formula insurance personas;
-
validityDate - validity date input parameter;
-
mainEntityName - obsolite parameter, null;
-
mainEntityId - ID of the record to be evalued, for personas/audiences insurance personas; it’s the value of mainEntityId input parameter.
formulaPersonasInput
additional details:
For each element, the key = the value ofquestionCode key from DNTResponses and the value = the value of answerValue key from DNTResponses.
Considering this DNTResponses
array
"DNTResponses": [
{
questionCode: 'PET_DIR',
answerValue: false
}, {
questionCode: 'PET_ONL',
answerValue: true
} , {
questionCode: 'PET_LFT',
answerValue: true
}, {
questionCode: 'PET_LIM',
answerValue: true
}
]
We will get this formulaPersonasInput object
{
PET_DIR: false,
PET_ONL: true,
PET_LFT: true,
PET_LIM: true
}
Output parameters:
-
result = [] or array with details about the price, as described in the Response Description section.
calculatePremiumForCards(quoteId, cardsForPersona, q.premiumCalculationDetails, validityDate)
: This function is used to determine, for each card, what kind of premium calculation logic to run, based on the type of tariff, per product or per coverage, using 2 separate functions: calculatePerProductPremium
and calculatePerCoveragePremium
.
Input parameters:
-
quoteId - id of the quote, passed as a parameter to the request or inserted;
-
cardsList - list of cards identified in the calculatePremiumForQuotes function;
-
premiumCalculationDetails - premiumCalculationDetails object from the request;
-
validityDate - validity date input parameter.
Output parameters:
-
packages array from the result object , as described in the Response Description section.
calculatePerProductPremium(card, premiumCalculationDetails, validityDate)
: This function is used to calculate the premium considering a per product scenario.
It loads the card dimensions and override the premiumCalculationDetails keys values with the card dimensions key values (useDimensionsAsFormulaInput
function). If a card dimension key was set to a specific value, than that value needs to be used by formula engine. It will call the formula engine to get the results for the card (calculateCardPremium
function) and then split the premium to get premiums for each card item (splitPremiumPerItems
function).
Input parameters:
-
card - card object for which we are calculating the premium amount;
-
premiumCalculationDetails - premiumCalculationDetails object from the request;
-
validityDate - validity date input parameter.
Output parameters:
-
N/A
useDimensionsAsFormulaInput(dimensions, formulaInput, isCardDimension)
: This function is used to override the premiumCalculationDetails keys with the dimension keys. It is used for both card and card item processes.
Input parameters:
-
dimensions - dimensions set on card item/card level;
-
formulaInput - premiumCalculationDetails passed as input for premium calculation;
-
isCardDimension - key used to know if the function runs for a card or for a card item.
Output parameters:
-
formulaInput - object with the same structure as formulaInput object, but with different values, if dimensions existed.
calculateCardPremium(formulaName, input, validityDate)
: This function is used to run the formula defined in the formula engine.
Input parameters:
-
formulaName - name of the formula used for card premium calculation;
-
input- values used for running the formula;
-
validityDate - validity date input parameter.
Output parameters:
-
formulaResult - calculation results as returned by the
server.formulas.runFormula
server side SDK function.
splitPremiumPerItems(cardItemsArr, premiumAmount)
: This function is used to split the premium per items.
Input parameters:
-
cardItemsArr - list of items defined for the card;
-
premiumAmount - premium amount on card level.
Output parameters:
-
cardItemsArr - card items list, containg an extra premiumAmount keys for each item.
calculatePerCoveragePremium(card, premiumCalculationDetails, validityDate)
: This function is used to calculate the premium considering a per coverage scenario.
For each of the card items included in the request, in the premiumCalculationDetails
array, we override the premiumCalculation
values with the values configured on card item dimensions (useDimensionsAsFormulaInput
function). If a card item dimension key was set to a specific value, than that value needs to be used by formula engine. The premium calculation formula for each coverage will run and return the results on card item level. Summing up the premium of all the card items we get the premium amount for the card.
Input parameters:
-
card - card object for which we are calculating the premium amount;
-
premiumCalculationDetails - premiumCalculationDetails object from the request;
-
validityDate - validity date input parameter.
Output parameters:
-
card -card object containing the premium amount keys.
getQuoteConfigDetails(quoteConfigCode)
: This function is used to get details about the quote config.
Input parameters:
-
quoteConfigCode - input parameter from the request.
Output parameters
-
object containing details about the quote config: quoteConfigId , configJSON, quoteConfigCode, mainProductCode, mainProductName, mainProductAttributeVersion.