In the following example, you want to create a new pricing engine that prices handling costs separately from shipping. You create a HandlingPricingEngine
that acts independently of the ShippingPricingEngine
.
Create an interface called
HandlingPricingEngine
that extendsPricingEngine
.Create an implementation called
HandlingPricingEngineImpl
that extendsPricingEngineService
.Create a
HandlingPricingInfo
that extends theAmountInfo
price holding class. (For more information, see AmountInfo.)Create a calculator called
HandlingPricingCalculator
and implementations of it that calculate and discount handling as your business requires.Modify the Promotions repository definition file (by default,
pricingModels.xml
). Add an item-descriptor for the Handling discount type and sub-descriptors for the various implementations of theHandlingPricingCalculator
that you created.Create properties files for the
HandlingPricingEngine
and each of the calculators.
Your engine is ready for use. You may also want to add preCalculators
that calculate the base cost of handling.