You are here:
InsProductService:repriceProduct
Use this service to price one product using the rating procedure attached to that product. This service is usually called when a user selects a product and customizes its coverage.
Method: repriceProduct
The service takes one product object in its input JSON and returns the product with total pricing and total insured sum. It also returns the complete result JSON from the rating procedure.
This service works for one or more insured parties (people covered by the policy product) and one or more insured items (multiple cars on an auto policy, for example).
This service doesn't run Eligibility, Required, and Default optional coverage rules when modifying a quote.
How It Works
-
The service searches the input JSON for the selected product key, then retrieves its value. This object contains one product object.
-
Using the product data to search Salesforce, the service finds the product and retrieves the rating procedure.
-
The service rates the product with the product JSON structure.
-
The service returns the product objects with total price and total insured sum. The output JSON includes the parsed result JSON from the rating procedure as the value of
CalculatedPriceData. The service also sets price andtotalSumInsuredif the formulas are set on the product.
Remote Options
Option |
Description |
|---|---|
|
When For example, an auto insurance quote or policy has multiple drivers attached to each insured auto. The insured auto has a separate |
|
Set this option to Omit this option for products that don't meet all these criteria. To format |
|
or %OmniScriptDataElement% Defaults to today's date. |
|
If this option = |
|
The name of the Omnistudio Data Mapper this service uses to retrieve policy (asset) information. If you're using Salesforce FSC, you must specify either this option or |
|
The name of the custom class this service uses to retrieve policy (asset) information. If you're using Salesforce FSC, you must specify either this option or |
|
A string of comma-separated key/value pairs that the service passes into and out of the calculation procedure. These key/value pairs are included in the output product object within the Only input keys used by the calculation procedure have a value in the results. |
|
Defaults to Includes the entire results of calculation procedure in the |
|
Set to |
|
Optional
Set to If you use Salesforce FSC and you set this option to |
|
Stringifed list of ids Used in conjunction with Calculates only the taxes and fees associated with the provided jurisdictions. |
taxAndFeeEffectiveDate
|
The effective date this service uses to calculate taxes and fees. This option is separate from the If a value is provided, the service uses that value. If a value is not provided and the product JSON is not a policy, the service defaults to today’s date. If value is not provided and the product JSON is a policy, the service uses the original policy version’s effective date. |
withTaxFeeRounding
|
Optional If true, the calculated tax and fee amounts are rounded to two decimal places by using the half even rounding method. Default value is false. |
Input JSON
InsProductService: repriceProduct looks for a product object in the selectedProduct key in its input JSON. This object contains the inputs needed by the rating procedure as mapped in the attributes of the product, including its associated coverage specs, insured item specs, insured party specs, and rating fact specs. This object can be created by other services like getRatedProducts. It includes the root product, child products, and grandchild products. The service parses the product structure and passes data into the expression set or calculation procedure. If attributes mapped for rating are not included in the object, the service uses defaults set by the product administrator.
This service also looks for a userInputs key in the input JSON, so it can find any rating factors that aren't included in the selectedProduct node. Use the appropriate userInputs format depending on the product definition and the rating configuration. The service accepts only one type of userInputs format at a time.
Output JSON
The service returns the same JSON structure as that in the selectedProduct node with updated pricing information. See Product JSON Structure Model for details about the contents and structure of this object.
If taxes and fees services are used, JSON output is persisted onto the JSON record, similar to the way getRatedProducts writes to the JSON.
For each product, the output JSON from the rating procedure calculation is added to the product with the CaculatedPriceData key. If the pricing formula is set on the product, the value of price is set to its calculated value. If the total insured formula is set on the product, the value of TotalInsured is set to its calculated value.
The structure under CalculatedPriceData, includes instance support. Price metrics are grouped under instance level.
The output JSON includes a priceDiff node at root level that sums up instance level prices. It also includes the totalPremiumForTermDiff field at the root level. This value is the difference between the original total premium for term and the sum between the total premium for term of the new policy version and the updated premium for term of the old policy version.
In this example, the pricing formula is set on the product, but the total insured formula is not. The service adds the CalculatedPriceData to the results from the rating procedure. The service calculates the price based on the formula. The total insured formula is not set on the product and does not appear in the data (neither does TotalInsured).
"totalSize": null,
"records": [{
"displaySequence": -1,
"rootProductId": "01t1I000002fuBoQAI",
"rootProductCode": "AUTOROOT",
"timestamp": 1533948385704,
"hasInstanceKeys": true,
"childProductsCount": 8,
"instanceKeyChildren": 2,
"pathFromChild": "[0]",
"pathFromRoot": "[0]",
"Price": 80,
"productId": "01t1I000002fuBoQAI",
"Term__c": "Semi-Annual",
"PricingFormula__c": "SUM(AutoPremium__autoPremium + rentalTotal + medicalTotal + roadsideTotal + dedWaiverTotal + uninsuredMotoristPDTotal + uninsuredMotoristBITotal)",
"IsConfigurable__c": true,
"RecordTypeName__c": "Product",
"IsRecommended__c": false,
"ProductCode": "AUTOROOT",
"Name": "Auto Root",
"Id": "01t1I000002fuBoQAI",
"RawPriceData": [{
"calculationResults": [{
"DRIVER.LN": null,
"DRIVER.FN": null,
"AUTO.instanceKey": "2015 Lexus LX250",
"uninsuredMotoristBITotal": 100,
"uninsuredMotoristPDTotal": 0,
"dedWaiverTotal": 10,
"roadsideTotal": 10,
"medicalTotal": 10,
"rentalTotal": 40,
"comprehensiveTotal": 500,
"ID": "0"
}],
"aggregationResults": {}
},
{
"calculationResults": [{
"DRIVER.LN": null,
"DRIVER.FN": null,
"AUTO.instanceKey": "2006 Honda Odyssey",
"uninsuredMotoristBITotal": 100,
"uninsuredMotoristPDTotal": 0,
"dedWaiverTotal": 10,
"roadsideTotal": 10,
"medicalTotal": 10,
"rentalTotal": 40,
"comprehensiveTotal": 500,
"ID": "1"
}],
"aggregationResults": {}
}
],
"CalculatedPriceData": {
"2015 Lexus LX250": {
"DRIVER.LN": null,
"DRIVER.FN": null,
"AUTO.instanceKey": "2015 Lexus LX250",
"uninsuredMotoristBITotal": 100,
"uninsuredMotoristPDTotal": 0,
"dedWaiverTotal": 10,
"roadsideTotal": 10,
"medicalTotal": 10,
"rentalTotal": 40,
"comprehensiveTotal": 500,
"ID": "0"
},
"2006 Honda Odyssey": {
"DRIVER.LN": null,
"DRIVER.FN": null,
"AUTO.instanceKey": "2006 Honda Odyssey",
"uninsuredMotoristBITotal": 100,
"uninsuredMotoristPDTotal": 0,
"dedWaiverTotal": 10,
"roadsideTotal": 10,
"medicalTotal": 10,
"rentalTotal": 40,
"comprehensiveTotal": 500,
"ID": "1"
}
},
"priceDiff": 0,
"totalPremiumForTermDiff": 0,
"attributeCategories": {
"totalSize": 1,
"records": [{
"displaySequence": 5,
"id": "a1V1I0000007xJSUAY",
"Name": "Alan Health Attributes",
"Code__c": "AHA",
"productAttributes": {
"totalSize": 1,
"records": [{
"code": "ALANDEDUCTIBLE",
"dataType": "text",
"inputType": "text",
"required": false,
"readonly": false,
"disabled": false,
"filterable": true,
"attributeId": "a1W1I000000Bu1jUAC",
"label": "Deductible",
"displaySequence": 2,
"hasRules": false,
"hidden": false,
"values": [{
"readonly": false,
"disabled": false
}],
"userValues": "test",
"parentProductId": "01t1I000002fuBoQAI",
"parentProductCode": "AUTOROOT",
"pathFromChild": "attributeCategories.records[0].productAttributes.records[0]",
"pathFromRoot": "attributeCategories.records[0].productAttributes.records[0]"
}]
}
}]
},
"childProducts": {
...
}- One Rating Procedure per Product for repriceProduct
FormatInsProductService:repriceProduct userInputsfor products that use a single rating procedure per root product. - Multiple Rating Procedures per Product or Multiple Specs at Any Level for repriceProduct
FormatInsProductService:repriceProduct userInputsfor products that use multiple rating procedures in the product hierarchy or multiple child specs in any level of the hierarchy.

