virtual CartExtension.CartCalculate

Entry point for the Cart calculations. The Salesforce app will call the calculate method when starting Cart calculations. To implement custom calculator orchestration and handling logic, extend this class and override the calculate method.

Constructors 

global CartCalculate() 

Default constructor

global CartCalculate(CartExtension mockExecutor) 

Constructs Cart Calculate Orchestrator with a mock executor for Apex testing.

Parameters 

ParamDescription
mockExecutorMock executor which can run the various calculators.

Methods 

global virtual void calculate(CartCalculateOrchestratorRequest request) 

Calls specific calculators that modify the given cart. Can be overridden with custom logic. To access the overridden method, call super.calculate(). Returns nothing.

Parameters 

ParamDescription
CartCalculateOrchestratorRequestThe CartExtension.CartCalculateOrchestratorRequest to act on.

global void prices(CartCalculateCalculatorRequest cartCalculateCalculatorRequest) 

Calls the custom Apex price calculator, if supplied. Otherwise, this method calls the default price calculator. This method cannot be overridden. Use with the calculate method. To supply a custom price calculator, see CartExtension.PricingCartCalculator.

Parameters 

ParamDescription
CartCalculateCalculatorRequestThe CartExtension.CartCalculateCalculatorRequest to act on.

global void promotions(CartCalculateCalculatorRequest cartCalculateCalculatorRequest) 

Calls the custom Apex promotion calculator, if supplied. Otherwise, this method calls the default promotion calculator. This method cannot be overridden. Use with the calculate method. To supply a custom promotion calculator, see CartExtension.PromotionsCartCalculator.

Parameters 

ParamDescription
CartCalculateCalculatorRequestThe CartExtension.CartCalculateCalculatorRequest to act on.

global void inventory(CartCalculateCalculatorRequest cartCalculateCalculatorRequest) 

Calls the custom Apex inventory calculator, if supplied. Otherwise, this method calls the default inventory calculator. This method cannot be overridden. Use with the calculate method. To supply a custom inventory calculator, see CartExtension.InventoryCartCalculator.

Parameters 

ParamDescription
CartCalculateCalculatorRequestThe CartExtension.CartCalculateCalculatorRequest to act on.

global void shipping(CartCalculateCalculatorRequest cartCalculateCalculatorRequest) 

Calls the custom Apex shipping calculator, if supplied. Otherwise, this method calls the default shipping calculator. This method cannot be overridden. Use with the calculate method. To supply a custom shipping calculator, see CartExtension.ShippingCartCalculator.

Parameters 

ParamDescription
CartCalculateCalculatorRequestThe CartExtension.CartCalculateCalculatorRequest to act on.

global void taxes(CartCalculateCalculatorRequest cartCalculateCalculatorRequest) 

Calls the custom Apex tax calculator, if supplied. Otherwise, this method calls the default tax calculator. This method cannot be overridden. Use with the calculate method. To supply a custom tax calculator, see CartExtension.TaxCartCalculator.

Parameters 

ParamDescription
CartCalculateCalculatorRequestThe CartExtension.CartCalculateCalculatorRequest to act on.

global void postShipping(CartCalculateCalculatorRequest cartCalculateCalculatorRequest) 

Selects the Cheapest Delivery Method and adds Shipping Charge Item to the Cart This method cannot be overridden. Returns nothing.

Parameters 

ParamDescription
CartCalculateOrchestratorRequestThe CartExtension.CartCalculateOrchestratorRequest to act on.

Newer Version Available

This content describes an older version of this product. View Latest

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!