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
priceItems
method changes the price of input items. It first callsfindQualifyingItems
to get items whose prices need changing. It then callspriceQualifyingItems
to change their price.The
findQualifyingItems
method selects items to be discounted. It bases item selection on attributes of the input environment as represented by the method’s parameters.The
priceQualifyingItems
method modifies the prices of an input collection of items. It also verifies that the items’ audit trail is maintained.priceQualifyingItems
callspriceQualifyingItem
once for each input item to be priced.The
priceQualifyingItem
method modifies the price of the input item. It also verifies that the item’s audit trail is maintained.priceQualifyingItem
calls eachpriceDetailedItemPriceInfo
, discounting details until the total number of items to discount has been reached.The
priceDetailedItemPriceInfo
method modifies the price of adetailedItemPriceInfo
. It maintains the audit trail and marks the details that have acted as qualifiers. It callsfindAdjustedPrice
to find the new price of the details.The
findAdjustedPrice
method 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
findQualifyingItems
to change the way the calculator finds the items to discount.Override
priceQualifyingItems
to change how a group ofItemPriceInfos
are adjusted.Override
priceQualifyingItem
to change how an individualItemPriceInfo
is adjusted.Override
priceDetailedItemPriceInfo
to change how aDetailedItemPriceInfo
within anItemPriceInfo
is adjusted.Override
findAdjustedPrice
to change how the calculator determines new prices.