|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.commerce.promotion.GWPManager
public class GWPManager
Provides API to manage Gift With Purchase promotions adding and removing gifts to the cart. Pricing invokes the processGWPInfos method at the end of item pricing. An application via a form handler may typically invoke the makeGiftSelection method for new or changed gift selections. These two methods update the order and so are synchronized on the order and wrapped in a transaction. If a caller wants to call any other method directly which updates the order then they need to do this wrapping themselves.
It is also assumed that the caller into these two methods will first have obtained a service lock on the order profile. Pricing and the GiftWithPurchaseFormHandler will do this.
Nested Class Summary | |
---|---|
protected class |
GWPManager.GWPPipelineErrorHandler
Class to handle errors from the purchase process helper pipeline if needed. |
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
protected CatalogProperties |
mCatalogProperties
|
protected CatalogTools |
mCatalogTools
|
protected RqlStatement |
mCategoryQuery
|
protected CommerceItemManager |
mCommerceItemManager
|
protected atg.commerce.promotion.GWPMarkerManager |
mGwpMarkerManager
|
protected boolean |
mJMSEnabled
|
protected PricingTools |
mPricingTools
|
protected RqlStatement |
mProductContentGroupQuery
|
protected PromotionTools |
mPromotionTools
|
protected PurchaseProcessHelper |
mPurchaseProcessHelper
|
protected atg.repository.nucleus.RepositoryGroupContainerService |
mRepositoryGroupContainerService
|
protected atg.multisite.SiteTools |
mSiteTools
|
protected RqlStatement |
mSkuContentGroupQuery
|
protected java.util.Map<java.lang.String,java.lang.String> |
mSkuToCommerceItemTypeMapping
|
protected static java.lang.String |
MY_RESOURCE_NAME
|
protected static java.util.ResourceBundle |
sResourceBundle
Resource Bundle |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
GWPManager()
|
Method Summary | |
---|---|
protected CommerceItem |
addGiftQuantity(RepositoryItem pOrderMarker,
java.lang.String pProductId,
java.lang.String pSkuId,
long pQuantityToAdd,
java.lang.String pCatalogKey,
ShippingGroup pShippingGroup,
java.lang.String pCommerceItemType,
java.lang.String pSiteId,
java.util.List<atg.commerce.order.purchase.AddCommerceItemInfo> pNewItemInfos,
java.util.List<CommerceItem> pNewItems,
int pItemIndex,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Method to add GWP quantity to the order. |
protected boolean |
canRepriceItem(CommerceItem pItem)
Check if this item can be re-priced to full price. |
boolean |
changeGiftQuantity(RepositoryItem pOrderMarker,
long pQuantityDelta,
java.util.List<atg.commerce.order.purchase.AddCommerceItemInfo> pNewItemInfos,
java.util.List<CommerceItem> pNewItems,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Called if there has been a change in quantity of a free gift. |
protected java.lang.String |
determineSiteIdForSkuId(java.lang.String pSkuId,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Determines the site id to use for the given SKU id. |
protected GiftWithPurchaseSelectionChoice |
getAutoAddGiftSelectionChoice(java.lang.String pGiftType,
java.lang.String pGiftDetail,
java.util.Map pExtraParameters)
Checks if the gift type and detail correspond to a single SKU and only if it does will it return a GiftWithPurchaseSelectionChoice bean for it. |
protected java.lang.String |
getCatalogKey(PricingContext pPricingContext,
java.util.Map pExtraParameters)
Gets the locale catalog key to use for adding new items. |
CatalogProperties |
getCatalogProperties()
Getter for the catalog properties |
CatalogTools |
getCatalogTools()
Getter for the catalog tools |
RqlStatement |
getCategoryQuery()
Returns property CategoryQuery |
CommerceItemManager |
getCommerceItemManager()
Getter for the commerce item manager |
protected java.lang.String |
getCommerceItemType(java.lang.String pProductId,
java.lang.String pSkuId,
java.lang.String pCatalogKey,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Gets the commerce item type to use based on the SKU item type by looking up the skuToCommerceItemTypeMapping. |
GiftWithPurchaseSelectionChoice[] |
getGiftSelectionChoices(java.lang.String pGiftType,
java.lang.String pGiftDetail,
boolean pReturnSkus,
java.util.Map pExtraParameters)
Gets an array of selection choices for the given GWP gift details. |
atg.commerce.promotion.GWPMarkerManager |
getGwpMarkerManager()
Getter for the GWP marker manager |
protected java.util.Locale |
getLocale(PricingContext pPricingContext,
java.util.Map pExtraParameters)
Gets the locale to use. |
PricingTools |
getPricingTools()
Returns the PricingTools property |
RqlStatement |
getProductContentGroupQuery()
Returns property ProductContentGroupQuery |
protected RepositoryItem |
getProductForSku(RepositoryItem pSku,
java.util.Set<Site> pValidSites)
Determines which product to use for a given SKU. |
protected GiftWithPurchaseSelectionChoice |
getProductGWPSelectionChoice(RepositoryItem pProduct,
boolean pGetSkus,
java.util.Set<Site> pValidSites)
Method to get the selection choice for a given product. |
PromotionTools |
getPromotionTools()
Returns the PromotionTools property |
PurchaseProcessHelper |
getPurchaseProcessHelper()
Getter for the purchase process helper |
atg.repository.nucleus.RepositoryGroupContainerService |
getRepositoryGroupContainerService()
Returns the repositoryGroupContainerService property |
java.util.Collection<GiftWithPurchaseSelection> |
getSelections(Order pOrder)
Retrieves all the gift with purchase selections available in the order. |
java.util.Collection<GiftWithPurchaseSelection> |
getSelections(Order pOrder,
CommerceItem pItem)
Retrieves all the gift with purchase selections available on a commerce item. |
java.util.Collection<GiftWithPurchaseSelection> |
getSelections(Order pOrder,
CommerceItem pItem,
java.lang.String pPromotionId,
int pGiftHashCode)
Retrieves all the gift with purchase selections for the given commerce item, promotion and gift. |
java.util.Collection<GiftWithPurchaseSelection> |
getSelections(Order pOrder,
java.lang.String pPromotionId,
int pGiftHashCode)
Retrieves all the gift with purchase selections for the given order, promotion and gift. |
atg.multisite.SiteTools |
getSiteTools()
Getter for the site tools |
RqlStatement |
getSkuContentGroupQuery()
Returns property SkuContentGroupQuery |
java.util.Map<java.lang.String,java.lang.String> |
getSkuToCommerceItemTypeMapping()
Mapping of sku item type to commerce item type if the default commerce item type is not sufficient |
boolean |
invalidateGift(RepositoryItem pOrderMarker,
PricingContext pPricingContext,
atg.commerce.promotion.GWPStatusHolder pStatusHolder,
java.util.Map pExtraParameters)
Method to invalidate a gift when a GWP promotion no longer qualifies. |
boolean |
invalidateGiftQuantity(RepositoryItem pOrderMarker,
long pQuantityToInvalidate,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Invalidates a given quantity of a gift. |
boolean |
isJMSEnabled()
Boolean flag, true to send JMS events for each GWP application message |
protected boolean |
isProductValidForSites(RepositoryItem pProduct,
java.util.Set<Site> pValidSites)
Utility method to check if the given product belongs to the given set of valid sites. |
protected boolean |
isTransactionMarkedAsRollBack()
Returns true if the transaction associated with the current thread is marked for rollback. |
java.lang.String |
makeGiftSelection(java.lang.String pCurrentSelectedItemId,
Order pOrder,
java.lang.String pPromotionId,
int pGiftHashCode,
java.lang.String pProductId,
java.lang.String pSkuId,
long pQuantity,
java.lang.String pCatalogKey,
ShippingGroup pShippingGroup,
java.lang.String pCommerceItemType,
java.lang.String pSiteId,
boolean pReplaceRemovedQuantity,
boolean pReplaceFailedQuantity,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Method which makes a single gift selection for a given GWP gift. |
void |
mirrorOrderMarkers(Order pSourceOrder,
Order pDestOrder)
Method which removes existing order markers from the destination order and clones all of the order markers from the source order and adds them to the destination order. |
protected void |
priceQuantityToFree(CommerceItem pItem,
long pQuantityFree,
java.lang.String pPromotionId,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Prices the given quantity of the given item to be free due to the given GWP promotion id. |
CommerceItem |
processAutoAdd(RepositoryItem pOrderMarker,
long pQuantityToAdd,
java.util.List<atg.commerce.order.purchase.AddCommerceItemInfo> pNewItemInfos,
java.util.List<CommerceItem> pNewItems,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Checks whether we can auto add some quantity of a gift. |
boolean |
processGWPInfos(java.util.Map<atg.commerce.promotion.GWPMultiHashKey,GWPInfo> pGWPInfos,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
This method will process the given map of GWPInfo objects that was created during item pricing. |
boolean |
qualifyGift(GWPInfo pGWPInfo,
java.util.List<atg.commerce.order.purchase.AddCommerceItemInfo> pNewItemInfos,
java.util.List<CommerceItem> pNewItems,
PricingContext pPricingContext,
atg.commerce.promotion.GWPStatusHolder pStatusHolder,
java.util.Map pExtraParameters)
Method to qualify a gift when a GWP promotion has newly qualified. |
protected long |
removeGiftQuantity(CommerceItem pItem,
RepositoryItem pItemMarker,
long pQuantityToRemove,
boolean pAutoRemove,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Method to remove the quantity of a given gift item for the given GWP item markers and quantity. |
void |
resetOrderMarkerQuantitiesfromItemMarkers(Order pOrder)
Resets the quantity property values each order marker based on the corresponding item markers quantity property values. |
void |
setCatalogProperties(CatalogProperties pCatalogProperties)
Setter for the catalog properties |
void |
setCatalogTools(CatalogTools pCatalogTools)
Setter for the catalog tools |
void |
setCategoryQuery(RqlStatement pCategoryQuery)
Sets property CategoryQuery |
void |
setCommerceItemManager(CommerceItemManager pCommerceItemManager)
Setter for the commerce item manager |
void |
setGwpMarkerManager(atg.commerce.promotion.GWPMarkerManager pGwpMarkerManager)
Setter for the GWP marker manager |
void |
setJMSEnabled(boolean pJMSEnabled)
Boolean flag, true to send JMS events for each GWP application message |
void |
setPricingTools(PricingTools pPricingTools)
Sets the PricingTools property |
void |
setProductContentGroupQuery(RqlStatement pProductContentGroupQuery)
Sets property ProductContentGroupQuery |
void |
setPromotionTools(PromotionTools pPromotionTools)
Sets the PromotionTools property |
void |
setPurchaseProcessHelper(PurchaseProcessHelper pPurchaseProcessHelper)
Setter for the purchase process helper |
void |
setRepositoryGroupContainerService(atg.repository.nucleus.RepositoryGroupContainerService pRepositoryGroupContainerService)
Sets the repositoryGroupContainerService property |
void |
setSiteTools(atg.multisite.SiteTools pSiteTools)
Setter for the site tools |
void |
setSkuContentGroupQuery(RqlStatement pSkuContentGroupQuery)
Sets property SkuContentGroupQuery |
void |
setSkuToCommerceItemTypeMapping(java.util.Map<java.lang.String,java.lang.String> pSkuToCommerceItemTypeMapping)
Sets a mapping of sku item type to commerce item type if the default commerce item type is not sufficient |
protected void |
updateRemainingQuantities(Order pOrder)
Method iterates over the items in the order and updates any item markers to ensure the remainingQuantity property is correct. |
void |
updateSelectableQuantity(Order pOrder,
java.lang.String pPromotionId,
int pGiftHashCode,
long pSelectableQuantityToRemove)
Updates the quantity available for selection for a GWP gift. |
protected java.util.Map<atg.commerce.promotion.GWPMultiHashKey,atg.commerce.promotion.GWPQuantityHolder> |
updateTargetedQuantities(java.util.Map<atg.commerce.promotion.GWPMultiHashKey,GWPInfo> pGWPInfos,
Order pOrder,
java.util.Map pExtraParameters)
This method updates the targeted quantities on all existing item and order markers for promotions that are still qualifying in the current pricing operation. |
protected void |
validateGiftSelection(RepositoryItem pOrderMarker,
java.lang.String pProductId,
java.lang.String pSkuId,
long pQuantity,
boolean pReplaceExistingSelection,
java.util.Map pExtraParameters)
Validates the given product and SKU and quantity are valid as a gift selection for the given GWP order marker. |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CLASS_VERSION
protected static final java.lang.String MY_RESOURCE_NAME
protected static java.util.ResourceBundle sResourceBundle
protected atg.commerce.promotion.GWPMarkerManager mGwpMarkerManager
protected CatalogTools mCatalogTools
protected atg.multisite.SiteTools mSiteTools
protected CommerceItemManager mCommerceItemManager
protected CatalogProperties mCatalogProperties
protected PurchaseProcessHelper mPurchaseProcessHelper
protected atg.repository.nucleus.RepositoryGroupContainerService mRepositoryGroupContainerService
protected PricingTools mPricingTools
protected PromotionTools mPromotionTools
protected RqlStatement mSkuContentGroupQuery
protected RqlStatement mProductContentGroupQuery
protected RqlStatement mCategoryQuery
protected java.util.Map<java.lang.String,java.lang.String> mSkuToCommerceItemTypeMapping
protected boolean mJMSEnabled
Constructor Detail |
---|
public GWPManager()
Method Detail |
---|
public atg.commerce.promotion.GWPMarkerManager getGwpMarkerManager()
public void setGwpMarkerManager(atg.commerce.promotion.GWPMarkerManager pGwpMarkerManager)
pGwpMarkerManager
- GWPMarkerManagerpublic CatalogTools getCatalogTools()
public void setCatalogTools(CatalogTools pCatalogTools)
pCatalogTools
- CatalogToolspublic atg.multisite.SiteTools getSiteTools()
public void setSiteTools(atg.multisite.SiteTools pSiteTools)
pSiteTools
- SiteToolspublic CommerceItemManager getCommerceItemManager()
public void setCommerceItemManager(CommerceItemManager pCommerceItemManager)
pCommerceItemManager
- CommerceItemManagerpublic CatalogProperties getCatalogProperties()
public void setCatalogProperties(CatalogProperties pCatalogProperties)
pCatalogProperties
- CatalogPropertiespublic PurchaseProcessHelper getPurchaseProcessHelper()
public void setPurchaseProcessHelper(PurchaseProcessHelper pPurchaseProcessHelper)
pPurchaseProcessHelper
- PurchaseProcessHelperpublic atg.repository.nucleus.RepositoryGroupContainerService getRepositoryGroupContainerService()
public void setRepositoryGroupContainerService(atg.repository.nucleus.RepositoryGroupContainerService pRepositoryGroupContainerService)
pRepositoryGroupContainerService
- The property value to setpublic PricingTools getPricingTools()
public void setPricingTools(PricingTools pPricingTools)
pPricingTools
- The property value to setpublic PromotionTools getPromotionTools()
public void setPromotionTools(PromotionTools pPromotionTools)
pPromotionTools
- The property value to setpublic void setSkuContentGroupQuery(RqlStatement pSkuContentGroupQuery)
public RqlStatement getSkuContentGroupQuery()
public void setProductContentGroupQuery(RqlStatement pProductContentGroupQuery)
public RqlStatement getProductContentGroupQuery()
public void setCategoryQuery(RqlStatement pCategoryQuery)
public RqlStatement getCategoryQuery()
public java.util.Map<java.lang.String,java.lang.String> getSkuToCommerceItemTypeMapping()
public void setSkuToCommerceItemTypeMapping(java.util.Map<java.lang.String,java.lang.String> pSkuToCommerceItemTypeMapping)
pSkuToCommerceItemTypeMapping
- Map of String SKU item type to String commerce item typepublic boolean isJMSEnabled()
true
to send JMS events for each GWP application message
public void setJMSEnabled(boolean pJMSEnabled)
true
to send JMS events for each GWP application message
pJMSEnabled
- booleanprotected void updateRemainingQuantities(Order pOrder) throws CommerceException
pOrder
- Order to update
CommerceException
- for problems updating an item markerprotected java.util.Map<atg.commerce.promotion.GWPMultiHashKey,atg.commerce.promotion.GWPQuantityHolder> updateTargetedQuantities(java.util.Map<atg.commerce.promotion.GWPMultiHashKey,GWPInfo> pGWPInfos, Order pOrder, java.util.Map pExtraParameters) throws CommerceException
Note, The method destructively removes the entries from each GWPInfo.targetedItemsMap as targeted item quantities are updated.
For performance reasons this method also returns a map containing the total quantities on each
of the item markers in the order. This map is used to reconcile the order markers.
See {@link GWPMarkerManager#reconcileOrderMarkers(Order, Map)
pGWPInfos
- Map of GWPInfo from the current pricing operationpOrder
- OrderpExtraParameters
- Optional map of extra parameters
CommerceException
public boolean processGWPInfos(java.util.Map<atg.commerce.promotion.GWPMultiHashKey,GWPInfo> pGWPInfos, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
The keys to the map should be a composite of the promotion id and the gift hash code.
pGWPInfos
- Map of GWPInfo objects keyed by a GWPMultiHashKey of promotion id and gift hash codepPricingContext
- PricingContext including the Order to updatepExtraParameters
- Map of extra parameters (optional)
PricingException
- if processing a GWPInfo or order marker fails.public boolean changeGiftQuantity(RepositoryItem pOrderMarker, long pQuantityDelta, java.util.List<atg.commerce.order.purchase.AddCommerceItemInfo> pNewItemInfos, java.util.List<CommerceItem> pNewItems, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pOrderMarker
- RepositoryItem order markerpQuantityDelta
- long +ve/-ve change in quantitypNewItemInfos
- List of AddCommerceItemInfo that should be populated with any new item infos addedpNewItems
- List of CommerceItem that should be populated with any new items addedpPricingContext
- PricingContextpExtraParameters
- Optional map of extra parameters
PricingException
public boolean invalidateGift(RepositoryItem pOrderMarker, PricingContext pPricingContext, atg.commerce.promotion.GWPStatusHolder pStatusHolder, java.util.Map pExtraParameters) throws PricingException
pOrderMarker
- RepositoryItem GWP order markerpPricingContext
- PricingContext for this pricing operationpStatusHolder
- GWPStatusHolder to update with any invalidation informationpExtraParameters
- Map of extra parameters (optional)
true
if item pricing needs to be restarted
PricingException
public boolean invalidateGiftQuantity(RepositoryItem pOrderMarker, long pQuantityToInvalidate, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pOrderMarker
- GWP order marker for the gift to invalidatepQuantityToInvalidate
- long quantity to invalidate or -1 for allpPricingContext
- PricingContextpExtraParameters
- Optional extra parameters map
true
if pricing needs to be restarted
PricingException
protected long removeGiftQuantity(CommerceItem pItem, RepositoryItem pItemMarker, long pQuantityToRemove, boolean pAutoRemove, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pItem
- CommerceItem with GWP quantity to be removedpItemMarker
- RepositoryItem GWP item marker to have quantity removed, if null then it will be looked uppQuantityToRemove
- long maximum quantity to be removed or -1 for all quantitypAutoRemove
- boolean true
if quantity should be removed, otherwise it is re-pricedpPricingContext
- PricingContext for this pricing operationpExtraParameters
- Map of extra parameters (optional)
PricingException
public boolean qualifyGift(GWPInfo pGWPInfo, java.util.List<atg.commerce.order.purchase.AddCommerceItemInfo> pNewItemInfos, java.util.List<CommerceItem> pNewItems, PricingContext pPricingContext, atg.commerce.promotion.GWPStatusHolder pStatusHolder, java.util.Map pExtraParameters) throws PricingException
Note: the caller is responsible for calling PurchaseProcessHelper postAddItemsToOrder for newly added items.
pGWPInfo
- GWPInfo for the newly qualified giftpNewItemInfos
- List of AddCommerceItemInfo populated for each new item added by this methodpNewItems
- List of CommerceItem populated for each new item added by this methodpPricingContext
- PricingContext for this pricing operationpStatusHolder
- GWPStatusHolder to track newly qualified promotionspExtraParameters
- Map of extra parameters (optional)
true
if item pricing needs to be restarted
PricingException
public CommerceItem processAutoAdd(RepositoryItem pOrderMarker, long pQuantityToAdd, java.util.List<atg.commerce.order.purchase.AddCommerceItemInfo> pNewItemInfos, java.util.List<CommerceItem> pNewItems, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pOrderMarker
- RepositoryItem order markerpQuantityToAdd
- long +ve/-ve quantity to auto addpNewItemInfos
- List of AddCommerceItemInfo to be populated with any new item infopNewItems
- List of CommerceItem to be populatedpPricingContext
- PricingContextpExtraParameters
- Optional map of extra parameters
PricingException
protected CommerceItem addGiftQuantity(RepositoryItem pOrderMarker, java.lang.String pProductId, java.lang.String pSkuId, long pQuantityToAdd, java.lang.String pCatalogKey, ShippingGroup pShippingGroup, java.lang.String pCommerceItemType, java.lang.String pSiteId, java.util.List<atg.commerce.order.purchase.AddCommerceItemInfo> pNewItemInfos, java.util.List<CommerceItem> pNewItems, int pItemIndex, PricingContext pPricingContext, java.util.Map pExtraParameters) throws CommerceException
Note: Once the caller has added all free gifts the PurchaseProcessHelper postAddItemsToOrder method should be called.
pOrderMarker
- RepositoryItem GWP order marker to updatepProductId
- String Product id to addpSkuId
- String SKU id to addpQuantityToAdd
- long quantity to addpCatalogKey
- String catalog keypShippingGroup
- ShippingGroup to usepCommerceItemType
- String commerce item typepSiteId
- String site id to usepNewItemInfos
- List of AddCommerceItemInfo populated by this methodpNewItems
- List of CommerceItem populated with any newly added items by this methodpItemIndex
- int index to add the new items into the order list of items, -1 for the end of the listpPricingContext
- PricingContextpExtraParameters
- Map of extra parameters (optional)
PricingException
CommerceException
protected java.util.Locale getLocale(PricingContext pPricingContext, java.util.Map pExtraParameters)
pPricingContext
- PricingContext which may contain the localepExtraParameters
- Map of extra parameters (optional)
protected java.lang.String getCatalogKey(PricingContext pPricingContext, java.util.Map pExtraParameters)
pPricingContext
- PricingContext which may contain the localepExtraParameters
- Map of extra parameters (optional)
protected java.lang.String getCommerceItemType(java.lang.String pProductId, java.lang.String pSkuId, java.lang.String pCatalogKey, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pProductId
- String product repository idpSkuId
- String sku repository idpCatalogKey
- String catalog localepPricingContext
- PricingContext for current pricing operationpExtraParameters
- Optional Map of extra parameters
PricingException
protected void priceQuantityToFree(CommerceItem pItem, long pQuantityFree, java.lang.String pPromotionId, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pItem
- CommerceItem to pricepQuantityFree
- long quantity of the item that needs priced to be freepPromotionId
- String GWP promotion id.pPricingContext
- PricingContextpExtraParameters
- Map of extra parameters (optional)
PricingException
public GiftWithPurchaseSelectionChoice[] getGiftSelectionChoices(java.lang.String pGiftType, java.lang.String pGiftDetail, boolean pReturnSkus, java.util.Map pExtraParameters) throws CommerceException
pGiftType
- String gift type, e.g. skupGiftDetail
- String gift detail, e.g. sku1234pReturnSkus
- boolean, true to return the SKUs for all choicespExtraParameters
- Map of extra parameters (optional)
CommerceException
protected GiftWithPurchaseSelectionChoice getAutoAddGiftSelectionChoice(java.lang.String pGiftType, java.lang.String pGiftDetail, java.util.Map pExtraParameters) throws CommerceException
pGiftType
- String gift typepGiftDetail
- String gift detailpExtraParameters
- Optional map of extra parameters
CommerceException
public java.lang.String makeGiftSelection(java.lang.String pCurrentSelectedItemId, Order pOrder, java.lang.String pPromotionId, int pGiftHashCode, java.lang.String pProductId, java.lang.String pSkuId, long pQuantity, java.lang.String pCatalogKey, ShippingGroup pShippingGroup, java.lang.String pCommerceItemType, java.lang.String pSiteId, boolean pReplaceRemovedQuantity, boolean pReplaceFailedQuantity, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pCurrentSelectedItemId
- String commerce item id of any currently selection item to replace(optional)pOrder
- Order to updatepPromotionId
- String GWP promotion repository id the selection id for.pGiftHashCode
- int GWP hash code for gift the selection is for. -1 is not valid in this case.pProductId
- String product id of the new selectionpSkuId
- String SKU id of the new selectionpQuantity
- long quantity of the new selectionpCatalogKey
- Locale catalog key of the new selectionpShippingGroup
- ShippingGroup of the new selectionpCommerceItemType
- String commerce item type of the new selectionpSiteId
- String site id of the new selectionpReplaceRemovedQuantity
- boolean true
to replace removed quantity firstpReplaceFailedQuantity
- boolean true
to replace failed quantity (after removed quantity)pPricingContext
- PricingContextpExtraParameters
- Map of extra parameters (optional)
PricingException
protected boolean isTransactionMarkedAsRollBack()
boolean
valueprotected void validateGiftSelection(RepositoryItem pOrderMarker, java.lang.String pProductId, java.lang.String pSkuId, long pQuantity, boolean pReplaceExistingSelection, java.util.Map pExtraParameters) throws PricingException
pOrderMarker
- RepositoryItem GWP order markerpProductId
- String product id for the selectionpSkuId
- String SKU id for the selectionpQuantity
- long quantity for the selectionpReplaceExistingSelection
- boolean flag, true
if we are replacing an existing selectionpExtraParameters
- Map of extra parameters (optional)
PricingException
- if the selection is invalidprotected RepositoryItem getProductForSku(RepositoryItem pSku, java.util.Set<Site> pValidSites) throws PricingException
pSku
- RepositoryItem skupValidSites
- Set of valid Site the parent product can belong in
PricingException
- if a product couldn't be found.protected boolean isProductValidForSites(RepositoryItem pProduct, java.util.Set<Site> pValidSites)
pProduct
- RepositoryItem product to checkpValidSites
- Set of Site that are valid
protected GiftWithPurchaseSelectionChoice getProductGWPSelectionChoice(RepositoryItem pProduct, boolean pGetSkus, java.util.Set<Site> pValidSites)
pProduct
- RepositoryItem productpGetSkus
- boolean flag, true if we need to get the SKUs as well.pValidSites
- Set of Site that are valid for any choice
protected boolean canRepriceItem(CommerceItem pItem)
pItem
- CommerceItem to check
public java.util.Collection<GiftWithPurchaseSelection> getSelections(Order pOrder) throws CommerceException
pOrder
- Order to inspect
CommerceException
public java.util.Collection<GiftWithPurchaseSelection> getSelections(Order pOrder, java.lang.String pPromotionId, int pGiftHashCode) throws CommerceException
pOrder
- Order to inspectpPromotionId
- String promotion, can be null for all promotionspGiftHashCode
- in gift hash code, can be -1 for all gifts in the promotion
CommerceException
public java.util.Collection<GiftWithPurchaseSelection> getSelections(Order pOrder, CommerceItem pItem) throws CommerceException
pOrder
- Order to inspectpItem
- CommerceItem to inspect
CommerceException
public java.util.Collection<GiftWithPurchaseSelection> getSelections(Order pOrder, CommerceItem pItem, java.lang.String pPromotionId, int pGiftHashCode) throws CommerceException
pOrder
- Order to inspectpItem
- CommerceItem to inspectpPromotionId
- String promotion, can be null for all promotionspGiftHashCode
- int gift hash code, can be -1 for all gifts in the promotion
CommerceException
protected java.lang.String determineSiteIdForSkuId(java.lang.String pSkuId, PricingContext pPricingContext, java.util.Map pExtraParameters) throws CommerceException
pSkuId
- String sku IdpPricingContext
- PricingContextpExtraParameters
- Optional map of extra parameters
CommerceException
public void mirrorOrderMarkers(Order pSourceOrder, Order pDestOrder) throws CommerceException
This method is used in returns and exchanges.
pSourceOrder
- Order with order markers to copypDestOrder
- Order to copy into
CommerceException
public void resetOrderMarkerQuantitiesfromItemMarkers(Order pOrder) throws CommerceException
Order markers that have no corresponding item markers have all their quantity properties reset to 0.
failedQuantity and removedQuantity are always reset to 0 on all order markers.
pOrder
- Order to update
CommerceException
public void updateSelectableQuantity(Order pOrder, java.lang.String pPromotionId, int pGiftHashCode, long pSelectableQuantityToRemove) throws CommerceException
pOrder
- OrderpPromotionId
- String promotion IdpGiftHashCode
- int gift hash codepSelectableQuantityToRemove
- +ve selectable quantity to remove from the order
CommerceException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |