This section provides high-level details on mapping the pricing callback from Salesforce to TurboEngines. 

Mapping pricing callback from Salesforce to TurboEngines

This section summarizes the mapping process from the Salesforce pricing callback method to TurboEngines pricing callback methods. The 'Mode' plays an important role in the mapping process as the mode Salesforce pricing callbacks are now available in dedicated interfaces in TurboEngine pricing callback. IPricingBasePriceCallback for BASEPRICE mode and IPricingTotallingCallback for ADJUSTMENT mode.

The following table summarizes the BASEPRICE mode methods of Salesforce pricing callback.

BASEPRICE Mode in SalesforceIPricingBasePriceCallback in TurboEngine
void start(ProductConfiguration cart);Task BeforePricingBatchAsync(IBatchPriceRequest batchPriceRequest)
void setMode(PricingMode mode);Not Applicable
void beforePricing(ProductConfiguration.LineItemColl itemColl);Task BeforePricingBatchAsync(IBatchPriceRequest batchPriceRequest)
void onPriceItemSet(PriceListItem__c itemSO, LineItem lineItemMO);Task OnPricingBatchAsync(IBatchPriceRequest batchPriceRequest)
void afterPricing(ProductConfiguration.LineItemColl itemColl);Task AfterPricingBatchAsync(IBatchPriceRequest batchPriceRequest)
void finish();

Task AfterPricingBatchAsync(IBatchPriceRequest batchPriceRequest)
Task OnProductOptionPriceAsync(IBatchPriceRequest batchPriceRequest, IDictionary<string, IProductOptionPrice> productOptionPrice)
Task OnPriceMatrixAsync(IBatchPriceRequest batchPriceRequest, IDictionary<string, IEnumerable<IPriceMatrixEntry>> priceMatrixEntries)
Task OnPriceRuleAsync(IBatchPriceRequest batchPriceRequest, IDictionary<string, IEnumerable<IPriceRuleEntry>> priceRuleEntries)
Task OnPipelinePriceRuleAsync(IBatchPriceRequest batchPriceRequest, IDictionary<string, IEnumerable<IPriceRuleEntry>> pipelinePriceRuleEntries)
Task OnPriceEscalatorAsync(IBatchPriceRequest batchPriceRequest, List<IPriceEscalator> priceEscalators)

The following table summarizes the ADJUSTMENT mode methods of Salesforce pricing callback.

ADJUSTMENT Mode in SalesforceIPricingTotallingCallback in TurboEngine
void start(ProductConfiguration cart);Task BeforePricingCartAdjustmentAsync(IAggregateCartRequest aggregateCartRequest)
void setMode(PricingMode mode);Not applicable
void beforePricing(ProductConfiguration.LineItemColl itemColl);Task BeforePricingCartAdjustmentAsync(IAggregateCartRequest aggregateCartRequest)
void beforePricingLineItem(ProductConfiguration.LineItemColl itemColl, LineItem lineItemMO);Task BeforePricingCartAdjustmentAsync(IAggregateCartRequest aggregateCartRequest)
void afterPricingLineItem(ProductConfiguration.LineItemColl itemColl, LineItem lineItemMO);Task AfterPricingCartAdjustmentAsync(IAggregateCartRequest aggregateCartRequest)
void afterPricing(ProductConfiguration.LineItemColl itemColl);Task AfterPricingCartAdjustmentAsync(IAggregateCartRequest aggregateCartRequest)
void finish();Task OnCartPricingCompleteAsync(IAggregateCartRequest aggregateCartRequest)
  • The mapping shown above is for reference only and varies based on the use case implemented in the Salesforce pricing callback.

  • Review the Salesforce pricing callback code and put functional instances in equivalent TurboEngine extension points.

Use Case

For example, in the Salesforce pricing callback's BeforePricing method, there is a logic set to a custom field value on a line item based on LineItem's resolved PLI's list price. The logic is not included any mode (BASEPRICE or ADJUSTMENT) check.

The migration process for the given SFDC pricing callback code to the TurboEngine callback code and where to insert the code in the TurboEngine callback code is explained below. 

From a  functional point of view, the logic is applicable for ADJUSTMENT mode's BeforePricing method. Because, in BASEPRICE mode's BasePricing method, LineItem's resolved PLI is not available. Hence, the most probable mapping point in TurboEngines is the BeforePricingCartAdjustmentAsync method of IPricingTotallingCallback. On the other hand, since the logic uses just resolved PLI's list price, another probable mapping point in TurboEngines is the OnPricingBatchAsync method IPricingBasePriceCallback where line item’s resolved PLI details are available.