You are here:
InsQuoteService:calculateTaxesAndFees
Use this service to calculate and save taxes and fees on a target quote.
Tax and fee information is saved on both the quote object and on the quote line item object.
How It Works
-
Takes the
quoteId, and thejurisdictionIdand theeffectiveDate(if specified) and calculates the taxes and fees to be applied to the quote. -
If saveChanges is set (or defaulted) to
true, saves the calculated taxes and fees in one of three ways.-
If a Quote Line Item has calculated taxes and fees, a
QuotePricingAdjustment__crecord representing that tax/fee is saved. TheQuotePricingAdjustment__crecord holds the calculated amount (Amount__c), the associated Quote Line Item (QuoteItemId__c) and Quote (QuoteId__c), the type (taxorfee;AdjustmentType__c), and the associated tax/fee (PriceListEntryId__c). -
If a Quote Line Item or its children have calculated taxes, the sum of the calculated taxes on itself and its children will be stored on the
TaxAmount__cfield. -
If a Quote Line Item or its children have calculated fees, the sum of the calculated fees on itself and its children are stored on the
FeeAmount__cfield.
-
-
At the Quote level, the sum of all of the tax amounts and fee amounts are stored on the
TotalTaxAmount__candTotalFeeAmount__cfields respectively.
Remote Options
Option |
Description |
|---|---|
|
Required Id of the quote that this service will calculate taxes and fees for. |
|
Optional Calculates taxes and fees associated with the provided jurisdictions only. |
|
Optional Calculate taxes and fees that become effective on the specified date only. If not provided, the value
defaults to the target quote's |
|
Optional
Defaults to
If If |
withTaxFeeRounding
|
Optional If true, the calculated tax and fee amounts are rounded to two decimal places by using the half even rounding method. If false, rounding is disabled. Defaults to false. |
Output JSON
The service returns a JSON representation of the quote containing only product and tax/fee information.
{
"productId": 1,
"productName": "Product",
"ProductCode": "P",
"taxesAndFees": [{
"Id": 1,
"Amount__c": 10,
"PriceListEntryId__c": 11,
"AdjustmentType__c": "Tax"
}, {
"Id": 2,
"Amount__c": 15,
"PriceListEntryId__c": 12,
"AdjustmentType__c": "Fee"
}],
"taxAmount": 25
"feeAmount": 30
"childProducts": [{
"productId": 2,
"productName": "Insured Item",
"ProductCode": "II",
"instanceKey": "My Insured Item",
"taxesAndFees": [{
"Id": 3,
"Amount__c": 15,
"PriceListEntryId__c": 16,
"AdjustmentType__c": "Tax"
}],
"taxAmount": 15
}, {
"productId": 3,
"productName": "Coverage",
"ProductCode": "C",
"taxesAndFees": [{
"Id": 4,
"Amount__c": 15,
"PriceListEntryId__c": 21
"AdjustmentType__c": "Fee"
}],
"feeAmount": 15
}]
}
