Reference > Shop flow URLs > Order Management subsystem URLs > Order task commands
CalculateOrderCmd task command
The CalculateOrderCmd task command handles free gifts and implements the core logic of calculation.
Task command
Implementation class
Commands called
DoInventoryActionCmd
OrderItemUpdateCmd
OrderItemAddCmd
OrderItemDeleteCmd
Possible callers
OrderCalculateCmdImpl
PrepareOrderCmdImpl
OrderProcessingHelper
Behavior
If doFreeGift is true:
If the PromotionsEngine component is enabled and freegift is to be refreshed:
- Call the PromotionEngine to obtain a list of CatalogEntries to add to the Order
For each CatalogEntry to be added to the Order, if ATP is disabled and there is insufficient inventory:
- Remove that CatalogEntry from the list
- Add the CatalogEntry identifier to the outOfInventoryCatalogEntryId list
- For each order item to be added or updated, compare it with the free gift list obtained by PromotionEngine:
- If the CatentryId is the same but Quantity is different:
- Add it to the updating list
- If the CatentryId is not found within an existing CatalogEntry:
- Add it to the adding list
- If the free gifts which are cached before are not contained in the new returned list:
- Add it to the deleting list
Remove free gifts listed in the deleting list
Update the quantities of free gifts listed in the updating list
Add the new free gifts listed in the adding list
Calculate the product total of the order
Initialize the specified CalculationUsages that are enabled
Apply the specified CalculationUsages that are enabled
Update the SubOrders for the Order unless that feature is disabled
Summarize the specified CalculationUsages that are enabled