You are here:
InsCommissionService:calculate
Use this service to calculate the commission for a producer.
Method:
calculate
Description
This service uses details about the producer, the insurance product, and the commissionable event to calculate a commission for a producer.
How It Works
To calculate a commission, this service:
-
Accepts
productionCode,producerId,productId,commissionableEvent,context, andeffectiveDateinputs to find the appropriateCommissionScheduleto use for the calculation. -
Calculates the commission based on the Commission Schedule.
-
Evaluates the commission to determine whether it's a chargeback (a returned commission amount).
-
If the commissionable amount is negative, the service treats the commission as a chargeback.
-
If the commission isn't a chargeback, the service compares the calculated commission amount to minimum and maximum commission amounts. If the calculated amount it too low or too high, the service returns the minimum or maximum amount instead of the calculated amount.
-
-
Returns the commission amount, the ID of the commission schedule used to calculate it, and the minimum and maximum amounts that apply to this commission.
Inputs
Input |
Description |
|---|---|
|
Optional. The production code name, not the ID, for the processing producer. |
|
Optional. The ID of the processing producer. |
|
Required. The ID of the product for which the commission is paid. |
|
The event or transaction that triggers a commission calculation (for example, Quote, Sold Policy, or Changed/Endorsed). |
|
Optional. The effective date of the commission payment. If null, the service uses today's date. |
|
Required. Field name and value pairs for the record on which commission is calculated. You must:
Format without lookup field:
Format with lookup field:
You can specify up to two levels of fields if you format the input with a lookup field. |
|
The amount on which the commission calculation is based. |
Input JSON
Here's how to format input JSON.
{
"productionCode": ProductionCode.Name,
"producerId": Producer.Id,
"product2Id": Product2.Id,
"commissionableEvent": event type,
"commissionableAmount": amount of the transaction,
"context": {
"objectId": ID of applicable object used,
"objectAPI.fieldAPI" : value
}
}This sample calculates a commission for an endorsement.
{
"productionCode":AX001,
"producerId":ay001jh002,
"product2Id":az011jh022,
"commissionableEvent":"Endorsement",
"commissionableAmount":500,
"context":{
"Quote.vlocity_ins__TotalPremiumforTerm__c":100,
"QuoteLineItem.vlocity_ins__GroupClassId__r.vlocity_ins__ClassCode__c":"Managers",
"QuoteLineItem.vlocity_ins__FeeAmount__c":5,
"objectId":ax003jh001
}
}Output JSON
Here's the format of output JSON.
{
"commissionAmount": amount,
"commissionScheduleId": ID of the commission schedule used,
"minCommissionAmount": CommissionScheduleAssignment.MinCommissionAmount,
"maxCommissionAmount": CommissionScheduleAssignment.MaxCommissionAmount
}Here's sample output that shows the calculated amount ($167) is within the range defined by minimum and maximum values ($100-$500).
{
"commissionAmount":167,
"commissionScheduleId":"ab001od002",
"minCommissionAmount":100,
"maxCommissionAmount":500
}
