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.

Default constructor

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

ParamDescription
mockExecutorMock executor which can run the various calculators.

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

ParamDescription
CartCalculateOrchestratorRequestThe CartExtension.CartCalculateOrchestratorRequest to act on.

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.

ParamDescription
CartCalculateCalculatorRequestThe CartExtension.CartCalculateCalculatorRequest to act on.

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.

ParamDescription
CartCalculateCalculatorRequestThe CartExtension.CartCalculateCalculatorRequest to act on.

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.

ParamDescription
CartCalculateCalculatorRequestThe CartExtension.CartCalculateCalculatorRequest to act on.

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.

ParamDescription
CartCalculateCalculatorRequestThe CartExtension.CartCalculateCalculatorRequest to act on.

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.

ParamDescription
CartCalculateCalculatorRequestThe CartExtension.CartCalculateCalculatorRequest to act on.

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

ParamDescription
CartCalculateOrchestratorRequestThe CartExtension.CartCalculateOrchestratorRequest to act on.