This section describes how qualifiers are evaluated using a “buy 1 get 1 free” example. This example uses a promotion of type “Item Discount” where the fixed price is $0.00 and the PMDL rule is:

The discount-structure in the PMDL would contain the following information:

<calculator-type="standard" discount-type="fixed-price"

If the list price of the shirt is $10.00 and the list price of the hat of $5.00, then first, the ItemPricingEngine iterates through each of the pre-calculators:

Next, The ItemPricingEngine iterates through each of the promotions. In this example, the “Buy 1 shirt, get 1 hat free” promotion is the only promotion.

The pricing engine calls findQualifyingItems() and uses the returned calculator-type to look up the ItemDisCountCalculator.

The findQualifyingItems method performs the following functions (as well as some standard parameter verification and error checking):

Next, the pricing engine gets the calculator-type from the DiscountStructure object, looks up the calculatorTypeCalculators map to get the calculator component, puts the QualifiedItem objects into the extra parameters map, and then calls the calculator.

Finally, the calculator’s findQualifyingItems method pulls the QualifiedItem objects out of the map. The getAdjuster and getDiscountType methods get the DiscountStructure out of the map. The calculator now knows which items should receive the discount, so it calls priceQualifyingItems. This method goes through each detail of each item that qualifies (there is only one in our case) and updates the price.

Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices