This section describes the following pricing engine classes:
Item, Order, Tax, and Shipping Pricing Engine Classes
ItemPricingEngineImplShippingPricingEngineImplTaxPricingEngineImplOrderPricingEngineImpl
PricingEngineService
The PricingEngineService class is a GenericService implementation of a PricingEngine. PricingEngine implementations can extend this class to leverage scheduling, global promotions, locale, and other configuration functionality.
The PricingEngineService class contains the following properties:
scheduler: Theatg.service.scheduler.Schedulerthat this service uses to run theglobalPromotionsQuery. Re-running the query generates a new list of global promotions, which are then passed to into pricing engine methods.updateSchedule: The schedule for running theglobalPromotionsQuery.defaultLocale: The default locale in which this pricing engine should generate prices.priceInfoClass: The class of the prices that this engine generates. This property is configured based on the class extension. For example,ItemPricingEnginesets this toItemPriceInfo.pricingModelComparator: The comparator used to sort promotions.pricingModelProperties: A configuration bean that holds the name of every property of a pricing modelRepositoryItem.profileProperties: A list of profile properties to be checked for active promotions.promotionsRepository: The name of the repository that holds the promotions this engine can use.promotionItemTypes: An array of item descriptor names in the repository shown in thepromotionsRepositoryproperty. A promotion that this engine uses as a pricing model must be of one of the types inpromotionItemTypes.globalPromotionsQuery: An RQL query that is run on thepromotionsRepositoryto return all promotions that should always be taken into account in every pricing. A typical way to mark global promotions is to have assign all promotions in thepromotionsRepositorya boolean propertyglobal, and to have the query return all promotions whoseglobalproperty value istrue.
Item, Order, Tax, and Shipping Pricing Engine Classes
The following four classes are implementations of their respective pricing engine interfaces:
The
ItemPricingEngineImplclass is an implementation of theItemPricingEngineinterface. It computes the price of items both individually and in a larger context. It invokes a series ofItemPricingCalculators.The
OrderPricingEngineImplclass is an implementation of theOrderPricingEngineinterface. It computes the price for an order, invoking a series ofOrderPricingCalculators.The
ShippingPricingEngineImplclass is an implementation of theShippingPricingEngineinterface. It computes the shipping cost for an order by invoking a series ofShippingPricingCalculators.The
TaxPricingEngineImplis an implementation of theTaxPricingEngineinterface. It computes the tax for an order, invoking a series ofTaxPricingCalculators.
Each of these implementation classes also extends the abstract class, PricingEngineService, which is described in the previous section.
As described earlier in How Pricing Services Generate Prices, each engine calls a series of calculators as follows:
The engine invokes one or more
preCalculatorsto provide a base price to which subsequent calculators can then apply a discount. It invokes them on the inputpPriceQuotein the order in which they appear in itspreCalculatorsproperty. (Each type of engine calls its corresponding type of precalculator – for example, theOrderPricingEngineImplcallsOrderPricingCalculatorsand theTaxPricingEngineImplcallsTaxPricingCalculators.)The engine uses its
getPricingModelsmethod to extract any promotions from the customer’s profile, and then it processes the promotions one at a time, invoking the discount calculators from each one. (Discount calculators are specified in a promotion’spricingCalculatorServiceproperty.)Finally the engine invokes any
postCalculatorsconfigured for it. It invokes them on the inputpPriceQuotein the order in which they appear in itspostCalculatorsproperty. Again, each pricing engine calls postcalculators of its own type.

