First, we need to create a Groovy library to have a basic function returning something to confirm that the new strategy works at all, before we properly define the Calculation Engine.
-
Create a new Groovy Library logicˇ.
-
We will use "TrainingCalculationEngineLib" name in this guide, but it can be any library logic.
-
Set Valid After to a date in the past (e.g. beginning of the year).
-
Set Status to Active.
-
-
Add a new Groovy element "TrainingEngine" (or any other) with the
calculatePrice()method and very simple implementation.BigDecimal calculatePrice() { return [result: 5.0, message: "OK"] }For now, it has no parameters (we will discuss parameters later) and it will simply return a price of 5.0 as a result.
Next step: Define New Pricing Strategy