You can extend any of the pricing calculators to add functionality, if that suits your needs more than implementing one of the provided interfaces. As an example this section describes the order of calls in ItemDiscountCalculator; other calculators may vary:
The
priceItemsmethod changes the price of input items. It first callsfindQualifyingItemsto get items whose prices need changing. It then callspriceQualifyingItemsto change their price.The
findQualifyingItemsmethod selects items to be discounted. It bases item selection on attributes of the input environment as represented by the method’s parameters.The
priceQualifyingItemsmethod modifies the prices of an input collection of items. It also verifies that the items’ audit trail is maintained.priceQualifyingItemscallspriceQualifyingItemonce for each input item to be priced.The
priceQualifyingItemmethod modifies the price of the input item. It also verifies that the item’s audit trail is maintained.priceQualifyingItemcalls eachpriceDetailedItemPriceInfo, discounting details until the total number of items to discount has been reached.The
priceDetailedItemPriceInfomethod modifies the price of adetailedItemPriceInfo. It maintains the audit trail and marks the details that have acted as qualifiers. It callsfindAdjustedPriceto find the new price of the details.The
findAdjustedPricemethod produces a number that is the new price of aDetailedItemPriceInfo. It examines the existing price and the input parameters, and it returns the new price.
You can override any of these methods to provide new functionality while leveraging the existing code.
Override
findQualifyingItemsto change the way the calculator finds the items to discount.Override
priceQualifyingItemsto change how a group ofItemPriceInfosare adjusted.Override
priceQualifyingItemto change how an individualItemPriceInfois adjusted.Override
priceDetailedItemPriceInfoto change how aDetailedItemPriceInfowithin anItemPriceInfois adjusted.Override
findAdjustedPriceto change how the calculator determines new prices.

