The Gift with Purchase feature is supported by an info class and a manager class.

GWPInfo objects are used for temporary storage of gift item status for the current item pricing operation. They are processed by the GWPManager. Any information that needs to be persisted is stored in markers against the order. There is an instance of GWPInfo for each gift with purchase promotion that qualifies and free gift selection given. There is a one to one mapping between GWPInfo objects and the order markers that store information against the order.

The map of GWPInfo objects is cleared for each pricing operation. If a gift with purchase promotion applies a discount more than once or qualifies more than once, there is still only a single instance; however the quantity is incremented.

The GWPDiscountCalculator (see the Pricing Calculator Classes section of this guide) is responsible for creating and updating a Map of GWPInfo for the current pricing operation. The Map is keyed by a composite key of the promotionId and giftHashCode. The GWPManager processes the Map of GWPInfo objects to update the markers and gift items in the cart.

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