Here is a technical description of how the Strategy Designer utilizes the PSP Accelerator for Live Preview:
-
The SD fetches the first active
PSP_PricingLogicformula (configurable) it finds on the partition and loads it into memory. -
It then removes all elements that come after the CalculatedPrices element, which means that all elements up to and including CalculatedPrices are kept from the original logic, while the rest are discarded.
-
The live preview logic then appends a new element called StrategyDesigner_Result:
-
This element contains a generated
calculatePrice(param1, param2, ...)method which is called directly to obtain the result. -
PSP parameters calculated earlier in the logic are passed to this method if necessary
-
This mechanism ensures that the SD doesn't have to worry about the PSP parameters, as they are calculated using the same logic applied in an active (deployed) strategy, resulting in consistent outcomes.
When strategies are deployed, they are stored in a Groovy library, with each strategy represented as a separate element. Each element includes the same calculatePrice method used for the live preview.