您位於此處:
InsCommissionService:calculate
使用此服務計算產生者的佣金。
方法:calculate
輸入
輸入 |
描述 |
|---|---|
|
選擇性。 處理產生者的生產代碼名稱,而非識別碼。 |
|
選擇性。 處理產生者的識別碼。 |
|
必要。 支付佣金的產品識別碼。 |
|
觸發佣金計算的事件或交易 (例如「報價」、「已售出原則」或「已變更/已贊同」)。 |
|
選擇性。 佣金付款的生效日期。如果為空值,則服務會使用今天的日期。 |
|
必要。 計算佣金的記錄其欄位名稱和值配對。您必須:
不含對應欄位的格式:
含對應欄位的格式:
如果您使用對應欄位格式化輸入,您最多可以指定兩個欄位層級。 |
|
計算佣金所依據的金額。 |
輸入 JSON
以下是設定輸入 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
}
}此範例會計算贊同的佣金。
{
"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
}
}輸出 JSON
以下是輸出 JSON 的格式。
{
"commissionAmount": amount,
"commissionScheduleId": ID of the commission schedule used,
"minCommissionAmount": CommissionScheduleAssignment.MinCommissionAmount,
"maxCommissionAmount": CommissionScheduleAssignment.MaxCommissionAmount
}以下範例輸出顯示計算金額 ($167) 位於最小值和最大值 ($100-$500) 定義的範圍內。
{
"commissionAmount":167,
"commissionScheduleId":"ab001od002",
"minCommissionAmount":100,
"maxCommissionAmount":500
}