public class PurchaseProcessHelper extends GenericService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
static java.lang.String |
ERROR_FETCHING_PROFILE |
static java.lang.String |
MSG_ERROR_ADDING_CREDIT_CARD |
static java.lang.String |
MSG_ERROR_ADDING_SHIPPINGGROUP |
static java.lang.String |
MSG_ERROR_ADDING_TO_ORDER |
static java.lang.String |
MSG_ERROR_CHANGING_ITEM_QUANTITY |
static java.lang.String |
MSG_ERROR_CREATING_ORDER |
static java.lang.String |
MSG_ERROR_MOVING_ITEM_BETWEEN_SHIPPING_GROUPS |
static java.lang.String |
MSG_ERROR_PROCESS_ADD_ITEM_CHAIN |
static java.lang.String |
MSG_ERROR_REMOVING_ITEM |
static java.lang.String |
MSG_ERROR_REMOVING_ITEM_FROM_SHIPPING_GROUP |
static java.lang.String |
MSG_ERROR_REPRICING_ORDER_AFTER_ADD_ITEM |
static java.lang.String |
MSG_ERROR_SETTING_ORDER_AMOUNT |
static java.lang.String |
MSG_INVALID_PROFILE_ID |
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
PurchaseProcessHelper() |
Modifier and Type | Method and Description |
---|---|
CreditCard |
addCreditCardToOrder(Order pOrder,
BasicCreditCardInfoImpl pCreditCardInfo,
java.lang.String pCreditCardPaymentGroupType)
Adds a new CreditCard payment group to the order.
|
java.util.List |
addItemsToOrder(Order pOrder,
ShippingGroup pShippingGroup,
RepositoryItem pProfile,
AddCommerceItemInfo[] pItemInfos,
java.util.Locale pUserLocale,
java.lang.String pCatalogKey,
PricingModelHolder pUserPricingModels,
atg.commerce.util.PipelineErrorHandler pErrorHandler)
Add one or more items to the order (the shopping cart).
|
java.util.List |
addItemsToOrder(Order pOrder,
ShippingGroup pShippingGroup,
RepositoryItem pProfile,
AddCommerceItemInfo[] pItemInfos,
java.util.Locale pUserLocale,
java.lang.String pCatalogKey,
PricingModelHolder pUserPricingModels,
atg.commerce.util.PipelineErrorHandler pErrorHandler,
java.util.Map pExtraParameters)
Add one or more items to the order (the shopping cart).
|
CommerceItem |
addItemToOrder(AddCommerceItemInfo pItemInfo,
java.lang.String pCatalogKey,
Order pOrder,
ShippingGroup pShippingGroup,
RepositoryItem pProfile)
Method to add a single commerce item to the order.
|
protected void |
addItemToShippingGroup(CommerceItem pItem,
AddCommerceItemInfo pItemInfo,
Order pOrder,
ShippingGroup pShippingGroup)
Associate a commerce item with the shipping group specified by
the
shippingGroup property. |
ShippingGroup |
addShippingAddressToOrder(Order pOrder,
Address pAddress)
Adds a new HardgoodShippingGroup with the given address to the order.
|
void |
adjustItemRelationshipsForQuantityChange(Order pOrder,
CommerceItem pItem,
long pNewQuantity)
Deprecated.
as of 11.0; use
CommerceItemManager.adjustItemRelationshipsForQuantityChange() |
protected void |
adjustNonGiftHandlingInstructionsForQuantityDecrease(Order pOrder,
ShippingGroup pShippingGroup,
CommerceItem pCommerceItem,
long pNewQuantity,
long pQuantityDecrease)
Deprecated.
as of 11.0; use
CommerceItemManager.adjustNonGiftHandlingInstructionsForQuantityDecrease() |
protected void |
adjustNonGiftHandlingInstructionsForQuantityIncrease(Order pOrder,
ShippingGroup pShippingGroup,
CommerceItem pCommerceItem,
long pNewQuantity,
long pQuantityIncrease)
Deprecated.
as of 11.0; use
CommerceItemManager.adjustNonGiftHandlingInstructionsForQuantityIncrease() |
protected void |
applyValueDictionary(java.lang.Object pBean,
java.util.Dictionary pValues,
java.lang.String pPropertyPathPrefix)
Copy properties from the value dictionary or one of its descendents.
|
void |
changeItemQuantity(Order pOrder,
CommerceItem pItem,
long pNewQty,
boolean pGiftWithPurchase,
atg.commerce.util.PipelineErrorHandler pErrorHandler)
Method to change the quantity of a commerce item.
|
void |
copyCreditCardInfo(BasicCreditCardInfo pCreditCardInfo,
CreditCard pCard)
Copies credit card information into the credit card payment group.
|
protected CommerceItem |
createCommerceItem(AddCommerceItemInfo pItemInfo,
java.lang.String pCatalogKey,
Order pOrder)
Create a commerce item and add it to the order.
|
protected void |
createConfigurableSubitems(CommerceItem pItem,
AddCommerceItemInfo pItemInfo,
Order pOrder)
Create subitems for a base configurable commerce item.
|
Order |
createOrder(java.lang.String pOrderType,
java.lang.String pProfileId)
Creates an Order of the given type for the given user within a transaction.
|
protected void |
decreaseRelationshipQuantity(Order pOrder,
ShippingGroupCommerceItemRelationship pRelationship,
long pQuantityDecrease)
Deprecated.
as of 11.0; use
CommerceItemManager.decreaseRelationshipQuantity() |
CommerceItem |
deleteItem(java.lang.String pCommerceId,
Order pOrder) |
java.util.List |
deleteItems(Order pOrder,
java.lang.String[] pRemovalCommerceIds,
PricingModelHolder pUserPricingModels,
java.util.Locale pUserLocale,
RepositoryItem pProfile,
atg.commerce.util.PipelineErrorHandler pErrorHandler)
Delete all items from the order whose id appears in the RemovalCommerceIds
property.
|
java.util.List |
deleteItems(Order pOrder,
java.lang.String[] pRemovalCommerceIds,
PricingModelHolder pUserPricingModels,
java.util.Locale pUserLocale,
RepositoryItem pProfile,
atg.commerce.util.PipelineErrorHandler pErrorHandler,
java.util.Map pExtraParameters)
Delete all items from the order whose id appears in the RemovalCommerceIds
property.
|
java.lang.String |
getAddItemToOrderChainId()
Gets the addItemToOrder pipeline chain id.
|
java.lang.String |
getAddItemToOrderPricingOp()
Gets the addItemToOrder pricing operation.
|
CommerceItemManager |
getCommerceItemManager()
Gets the CommerceItemManager component.
|
java.lang.String |
getDefaultHardgoodShippingGroupType()
Gets the DefaultHardgoodShippingGroupType.
|
java.lang.String |
getDeleteItemsFromOrderPricingOp()
Gets the deleteItemsToOrder pricing operation.
|
ShippingGroup |
getFirstShippingGroup(Order pOrder)
Gets a shipping group as the first shipping group in the order.
|
GiftlistManager |
getGiftlistManager()
Gets the GiftlistManager component.
|
OrderManager |
getOrderManager()
Sets the OrderManager component.
|
PipelineManager |
getPipelineManager()
Gets the PipelineManager component.
|
java.lang.String |
getRepriceOrderChainId()
Gets the reprice order pipeline chain id.
|
ShippingGroup |
getShippingGroupForItem(Order pOrder,
AddCommerceItemInfo pItemInfo,
ShippingGroup pShippingGroup,
java.lang.String pCatalogKey)
This method returns a shipping group whose type is appropriate for a new item being added to an order.
|
ShippingGroupManager |
getShippingGroupManager()
Gets the ShippingGroupManager component.
|
javax.transaction.TransactionManager |
getTransactionManager()
Gets the TransactionManager component.
|
protected void |
increaseRelationshipQuantity(Order pOrder,
ShippingGroupCommerceItemRelationship pRelationship,
long pQuantityIncrease)
Deprecated.
as of 11.0; use
CommerceItemManager.increaseRelationshipQuantity() |
boolean |
isAddItemToDefaultShippingGroup()
This property tells
addItemsToOrder whether to add new items to a default
shipping group that is passed in or to shipping groups whose types are appropriate
for the items. |
protected boolean |
isTransactionMarkedAsRollBack()
Returns true if the transaction associated with the current thread
is marked for rollback.
|
void |
moveItemBetweenShippingGroups(Order pOrder,
java.lang.String pCommerceItemId,
long pQuantity,
java.lang.String pSourceShippingGroupId,
java.lang.String pTargetShippingGroupId)
Move the given quantity of the commerce item from one
shipping group into another.
|
void |
postAddItemsToOrder(java.util.List pItemsAdded,
Order pOrder,
PricingModelHolder pUserPricingModels,
java.util.Locale pUserLocale,
RepositoryItem pProfile,
atg.commerce.util.PipelineErrorHandler pErrorHandler,
AddCommerceItemInfo[] pItemInfos,
boolean pGiftWithPurchase)
Method to do processing after an item is added to the order.
|
void |
postDeleteItem(Order pOrder,
CommerceItem pItem,
long pQty,
boolean pGiftWithPurchase,
atg.commerce.util.PipelineErrorHandler pErrorHandler)
Should be called after an item has been deleted.
|
void |
postDeleteItem(Order pOrder,
CommerceItem pItem,
long pQty,
atg.commerce.util.PipelineErrorHandler pErrorHandler)
Should be called after an item has been deleted.
|
protected void |
processGiftAddition(CommerceItem pItem,
AddCommerceItemInfo pItemInfo,
Order pOrder,
RepositoryItem pProfile,
ShippingGroup pShippingGroup)
Perform giftlist related processing for an item being ordered
from a giftlist.
|
void |
processPipelineErrors(PipelineResult pResult,
atg.commerce.util.PipelineErrorHandler pErrorHandler) |
protected void |
removeEntireRelationshipQuantity(Order pOrder,
ShippingGroupCommerceItemRelationship pRelationship)
Deprecated.
as of 11.0; use
CommerceItemManager.removeEntireRelationshipQuantity() |
void |
removeItemQuantityFromShippingGroup(Order pOrder,
java.lang.String pCommerceItemId,
java.lang.String pShippingGroupId,
long pQuantity)
Remove the quantity of the given item from the shipping group.
|
protected PipelineResult |
runProcess(java.lang.String pChainId,
java.util.Map pParameters)
Executes a Pipeline Chain.
|
protected PipelineResult |
runProcess(java.lang.String pChainId,
Order pOrder,
PricingModelHolder pPricingModels,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
Executes a Pipeline Chain and places the supplies method parameters into a HashMap which
is supplied to the chain to execute.
|
protected PipelineResult |
runProcess(java.lang.String pChainId,
Order pOrder,
PricingModelHolder pPricingModels,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pParameters,
java.util.Map pExtraParameters)
Executes a Pipeline Chain and places the supplies method parameters into a HashMap which
is supplied to the chain to execute.
|
protected void |
runProcessAddItemToOrder(Order pOrder,
CommerceItem pCommerceItem,
PricingModelHolder pPricingModels,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters,
atg.commerce.util.PipelineErrorHandler pErrorHandler)
Run the pipeline which should be executed when the
handleAddItemToOrder method is invoked
This method will add pCommerceItem to pExtraParameters unless the key
PipelineConstants.COMMERCEITEM is already in the map |
void |
runProcessRepriceOrder(java.lang.String pPricingOperation,
Order pOrder,
PricingModelHolder pPricingModels,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters,
atg.commerce.util.PipelineErrorHandler pErrorHandler)
Run the pipeline which should be executed when the order needs to be repriced
|
protected void |
runProcessSendScenarioEvent(Order pOrder,
CommerceItem pItem,
long pQuantity,
boolean pGiftWithPurchase,
java.lang.String pType,
atg.commerce.util.PipelineErrorHandler pErrorHandler)
The
runProcessSendScenarioEvent method sends a scenario event. |
protected void |
runProcessSendScenarioEvent(Order pOrder,
CommerceItem pItem,
long pQuantity,
boolean pGiftWithPurchase,
java.lang.String pType,
atg.commerce.util.PipelineErrorHandler pErrorHandler,
java.lang.String pSiteId)
The
runProcessSendScenarioEvent method sends a scenario event. |
protected void |
runProcessSendScenarioEvent(Order pOrder,
CommerceItem pItem,
long pQuantity,
java.lang.String pType,
atg.commerce.util.PipelineErrorHandler pErrorHandler)
The
runProcessSendScenarioEvent method sends a scenario event. |
protected PipelineResult |
runRepricingProcess(java.lang.String pChainId,
java.lang.String pPricingOperation,
Order pOrder,
PricingModelHolder pPricingModels,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
Executes a Pipeline Chain and places the supplies method parameters into a HashMap which
is supplied to the chain to execute.
|
void |
setAddItemToDefaultShippingGroup(boolean pAddItemToDefaultShippingGroup)
This property tells
addItemsToOrder whether to add new items to a default
shipping group that is passed in or to shipping groups whose types are appropriate
for the items. |
void |
setAddItemToOrderChainId(java.lang.String pAddItemToOrderChainId)
Sets the addItemToOrder pipeline chain id.
|
void |
setAddItemToOrderPricingOp(java.lang.String pAddItemToOrderPricingOp)
Sets the addItemToOrder pricing operation.
|
void |
setCommerceItemManager(CommerceItemManager pCommerceItemManager)
Sets the CommerceItemManager component.
|
protected void |
setCommerceItemProperties(CommerceItem pItem,
AddCommerceItemInfo pItemInfo)
Fill in "extra" commerce item properties.
|
void |
setDefaultHardgoodShippingGroupType(java.lang.String pDefaultHardgoodShippingGroupType)
Sets the defaultHardgoodShippingGroupType.
|
void |
setDeleteItemsFromOrderPricingOp(java.lang.String pDeleteItemsFromOrderPricingOp)
Sets the deleteItemsToOrder pricing operation.
|
void |
setGiftlistManager(GiftlistManager pGiftlistManager)
Sets the GiftlistManager component.
|
void |
setOrderAmountToPaymentGroup(Order pOrder,
java.lang.String pPaymentGroupId,
double pAmount)
Sets the given order amount to the given payment group.
|
void |
setOrderManager(OrderManager pOrderManager)
Gets the OrderManager component.
|
void |
setPipelineManager(PipelineManager pPipelineManager)
Sets the PipelineManager component.
|
void |
setRepriceOrderChainId(java.lang.String pRepriceOrderChainId)
Sets the reprice order pipeline chain id.
|
void |
setShippingGroupManager(ShippingGroupManager pShippingGroupManager)
Sets the ShippingGroupManager component.
|
void |
setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Sets the TransactionManager component.
|
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public static final java.lang.String CLASS_VERSION
public static final java.lang.String MSG_ERROR_ADDING_TO_ORDER
public static final java.lang.String MSG_ERROR_REMOVING_ITEM
public static final java.lang.String MSG_ERROR_CREATING_ORDER
public static final java.lang.String MSG_ERROR_ADDING_SHIPPINGGROUP
public static final java.lang.String MSG_ERROR_SETTING_ORDER_AMOUNT
public static final java.lang.String MSG_ERROR_ADDING_CREDIT_CARD
public static final java.lang.String MSG_ERROR_REMOVING_ITEM_FROM_SHIPPING_GROUP
public static final java.lang.String MSG_ERROR_MOVING_ITEM_BETWEEN_SHIPPING_GROUPS
public static final java.lang.String ERROR_FETCHING_PROFILE
public static final java.lang.String MSG_INVALID_PROFILE_ID
public static final java.lang.String MSG_ERROR_REPRICING_ORDER_AFTER_ADD_ITEM
public static final java.lang.String MSG_ERROR_PROCESS_ADD_ITEM_CHAIN
public static final java.lang.String MSG_ERROR_CHANGING_ITEM_QUANTITY
public java.lang.String getRepriceOrderChainId()
public void setRepriceOrderChainId(java.lang.String pRepriceOrderChainId)
public OrderManager getOrderManager()
public void setOrderManager(OrderManager pOrderManager)
public PipelineManager getPipelineManager()
public void setPipelineManager(PipelineManager pPipelineManager)
public javax.transaction.TransactionManager getTransactionManager()
public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
public void setCommerceItemManager(CommerceItemManager pCommerceItemManager)
public CommerceItemManager getCommerceItemManager()
public void setGiftlistManager(GiftlistManager pGiftlistManager)
public GiftlistManager getGiftlistManager()
public void setShippingGroupManager(ShippingGroupManager pShippingGroupManager)
public ShippingGroupManager getShippingGroupManager()
public void setAddItemToOrderPricingOp(java.lang.String pAddItemToOrderPricingOp)
public java.lang.String getAddItemToOrderPricingOp()
public void setAddItemToOrderChainId(java.lang.String pAddItemToOrderChainId)
public java.lang.String getAddItemToOrderChainId()
public void setDeleteItemsFromOrderPricingOp(java.lang.String pDeleteItemsFromOrderPricingOp)
public java.lang.String getDeleteItemsFromOrderPricingOp()
public void setDefaultHardgoodShippingGroupType(java.lang.String pDefaultHardgoodShippingGroupType)
public java.lang.String getDefaultHardgoodShippingGroupType()
public boolean isAddItemToDefaultShippingGroup()
addItemsToOrder
whether to add new items to a default
shipping group that is passed in or to shipping groups whose types are appropriate
for the items.
This property is used only if the AddCommerceItemInfo
does not supply the shipping group type
and this property is used in getShippingGroupForItem(Order, AddCommerceItemInfo, ShippingGroup, String)
.
The default value for this property is true
.
If the property is false
, then the system will identify shipping groups
based on the new items' shipping group types.
Otherwise the system will use the default shipping group that is passed in.
getShippingGroupForItem(Order, AddCommerceItemInfo, ShippingGroup, String)
public void setAddItemToDefaultShippingGroup(boolean pAddItemToDefaultShippingGroup)
addItemsToOrder
whether to add new items to a default
shipping group that is passed in or to shipping groups whose types are appropriate
for the items.
This property is used only if the AddCommerceItemInfo
does not supply the shipping group type
and this property is used in getShippingGroupForItem(Order, AddCommerceItemInfo, ShippingGroup, String)
.
The default value for this property is true
.
If the property is false
, then the system will identify shipping groups
based on the new items' shipping group types.
Otherwise the system will use the default shipping group that is passed in.
pAddItemToDefaultShippingGroup
- the value to setgetShippingGroupForItem(Order, AddCommerceItemInfo, ShippingGroup, String)
public void runProcessRepriceOrder(java.lang.String pPricingOperation, Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, atg.commerce.util.PipelineErrorHandler pErrorHandler) throws RunProcessException
pPricingOperation
- the pricing operation (e.g. order total, subtotal, shipping, etc) that
should be performed.pOrder
- the order to repricepPricingModels
- the set of all pricing models for the user (item, order, shipping, tax)pLocale
- the locale that the order should be priced withinpProfile
- the user who owns the orderpExtraParameters
- A Map of extra parameters to be used in the pricingRunProcessException
- if an error occursprotected PipelineResult runRepricingProcess(java.lang.String pChainId, java.lang.String pPricingOperation, Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws RunProcessException
pChainId
- the pipeline chain to executepPricingOperation
- a String
valuepOrder
- the order to repricepPricingModels
- the set of all pricing models for the user (item, order, shipping, tax)pLocale
- the locale that the order should be priced withinpProfile
- the user who owns the orderpExtraParameters
- A Map of extra parameters to be used in the pricingPipelineResult
valueRunProcessException
- if an error occursprotected PipelineResult runProcess(java.lang.String pChainId, Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pParameters, java.util.Map pExtraParameters) throws RunProcessException
pChainId
- the pipeline chain to executepOrder
- the order to repricepPricingModels
- the set of all pricing models for the user (item, order, shipping, tax)pLocale
- the locale that the order should be priced withinpProfile
- the user who owns the orderpParameters
- A Map of parameters to be used when calling the PipelineChainpExtraParameters
- A Map of extra parameters to be used in the pricingPipelineResult
valueRunProcessException
- if an error occursprotected PipelineResult runProcess(java.lang.String pChainId, Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws RunProcessException
pChainId
- the pipeline chain to executepOrder
- the order to repricepPricingModels
- the set of all pricing models for the user (item, order, shipping, tax)pLocale
- the locale that the order should be priced withinpProfile
- the user who owns the orderpExtraParameters
- A Map of extra parameters to be used in the pricingPipelineResult
valueRunProcessException
- if an error occursprotected PipelineResult runProcess(java.lang.String pChainId, java.util.Map pParameters) throws RunProcessException
pChainId
- the pipeline chain to executepParameters
- A Map of parameters to be passed to the chain during executionPipelineResult
valueRunProcessException
- if an error occurspublic Order createOrder(java.lang.String pOrderType, java.lang.String pProfileId) throws CommerceException
pOrderType
- The type of order to create. Null will use the default order type.pProfileId
- The profile of the user for whom the order is created.CommerceException
- if an error occurs while creating the order.public ShippingGroup addShippingAddressToOrder(Order pOrder, Address pAddress) throws CommerceException
defaultHardgoodShippingGroupType
when creating the shipping group
If a failure occurs, the transaction will be rolled back.pOrder
- The order which will be given the new shipping group.pAddress
- The address of the shipping group.CommerceException
- If the operation fails.public void setOrderAmountToPaymentGroup(Order pOrder, java.lang.String pPaymentGroupId, double pAmount) throws CommerceException
pOrder
- The order containing the payment group.pPaymentGroupId
- The id of the payment group.pAmount
- The amount to assign to the payment group.CommerceException
- if the operation fails.public CreditCard addCreditCardToOrder(Order pOrder, BasicCreditCardInfoImpl pCreditCardInfo, java.lang.String pCreditCardPaymentGroupType) throws CommerceException
pOrder
- The order which will be given the new credit card payment group.pCreditCardInfo
- The number, expiration date, and address of the credit card.pCreditCardPaymentGroupType
- the payment groupCommerceException
- If the operation fails.public void copyCreditCardInfo(BasicCreditCardInfo pCreditCardInfo, CreditCard pCard) throws CommerceException
pCreditCardInfo
- the credit card informationpCard
- the credit card payment groupCommerceException
- in subclasses, if the copy cannot be completed.public void removeItemQuantityFromShippingGroup(Order pOrder, java.lang.String pCommerceItemId, java.lang.String pShippingGroupId, long pQuantity) throws CommerceException
pOrder
- the order containing the shipping group.pCommerceItemId
- the id of the item to be removed.pShippingGroupId
- the id of the shipping group from which the
item will be removed.pQuantity
- the quantity of item to remove.CommerceException
- if an error occurs.public void moveItemBetweenShippingGroups(Order pOrder, java.lang.String pCommerceItemId, long pQuantity, java.lang.String pSourceShippingGroupId, java.lang.String pTargetShippingGroupId) throws CommerceException
pOrder
- the order containing the item to move.pCommerceItemId
- the id of the item to move.pQuantity
- the quantity of item to move.pSourceShippingGroupId
- the id of the source shipping group.pTargetShippingGroupId
- the id of the target shipping group.CommerceException
- if there is an error moving the item.public java.util.List addItemsToOrder(Order pOrder, ShippingGroup pShippingGroup, RepositoryItem pProfile, AddCommerceItemInfo[] pItemInfos, java.util.Locale pUserLocale, java.lang.String pCatalogKey, PricingModelHolder pUserPricingModels, atg.commerce.util.PipelineErrorHandler pErrorHandler) throws CommerceException
pItemInfos
array. Items with a quantity
of 0 or less are not added.pOrder
- the Order to which the items will be added.pShippingGroup
- the shipping group to which the items will be added.pProfile
- the owner of the order, used for repricing.pItemInfos
- the array of informational objects about the items to add.pUserLocale
- the locale of the user.pCatalogKey
- the key of the catalog of the items.pUserPricingModels
- the promotions for the userpErrorHandler
- the object that will handle pipeline errors.CommerceException
- if an error occurs.addItemsToOrder(atg.commerce.order.Order, atg.commerce.order.ShippingGroup, atg.repository.RepositoryItem, atg.commerce.order.purchase.AddCommerceItemInfo[], java.util.Locale, java.lang.String, atg.commerce.pricing.PricingModelHolder, atg.commerce.util.PipelineErrorHandler)
public java.util.List addItemsToOrder(Order pOrder, ShippingGroup pShippingGroup, RepositoryItem pProfile, AddCommerceItemInfo[] pItemInfos, java.util.Locale pUserLocale, java.lang.String pCatalogKey, PricingModelHolder pUserPricingModels, atg.commerce.util.PipelineErrorHandler pErrorHandler, java.util.Map pExtraParameters) throws CommerceException
pItemInfos
array. Items with a quantity
of 0 or less are not added.
Each commerce item is created by calling a series of small methods:
Input property validation is the caller's responsibility.
pOrder
- the Order to which the items will be added.pShippingGroup
- the shipping group to which the items will be added.pProfile
- the owner of the order, used for repricing.pItemInfos
- the array of informational objects about the items to add.pUserLocale
- the locale of the user.pCatalogKey
- the key of the catalog of the items.pUserPricingModels
- the promotions for the userpErrorHandler
- the object that will handle pipeline errors.pExtraParameters
- a Map of extra parameters to be used in the pricingCommerceException
- if an error occurs.public CommerceItem addItemToOrder(AddCommerceItemInfo pItemInfo, java.lang.String pCatalogKey, Order pOrder, ShippingGroup pShippingGroup, RepositoryItem pProfile) throws CommerceException
Note this method is not wrapped in a transaction or syncronized on the Order so this is the callers responsibility.
pItemInfo
- AddCommerceItemInfo to create commerce item frompCatalogKey
- String catalogpOrder
- Order to usepShippingGroup
- ShippingGroup to usepProfile
- RepositoryItem profile to useCommerceException
public void postAddItemsToOrder(java.util.List pItemsAdded, Order pOrder, PricingModelHolder pUserPricingModels, java.util.Locale pUserLocale, RepositoryItem pProfile, atg.commerce.util.PipelineErrorHandler pErrorHandler, AddCommerceItemInfo[] pItemInfos, boolean pGiftWithPurchase) throws CommerceException
pItemsAdded
- List of CommerceItem addedpOrder
- Order usedpUserPricingModels
- PricingModelHolder used to price the orderpUserLocale
- Locale usedpProfile
- Profile usedpErrorHandler
- PipelineErrorHandler to usepItemInfos
- AddCommerceItemInfo array for new itemspGiftWithPurchase
- boolean true
to indicate this was gift with purchase quantityCommerceException
public java.util.List deleteItems(Order pOrder, java.lang.String[] pRemovalCommerceIds, PricingModelHolder pUserPricingModels, java.util.Locale pUserLocale, RepositoryItem pProfile, atg.commerce.util.PipelineErrorHandler pErrorHandler, java.util.Map pExtraParameters) throws CommerceException
pOrder
- the order from which the items will be removed.pRemovalCommerceIds
- the array of commerce items ids to be removed.pUserPricingModels
- the promotions for the user.pUserLocale
- the locale of the user.pProfile
- the user profile.pErrorHandler
- the object which will handle pipeline errors.pExtraParameters
- a Map of extra parameters to be used in the pricingCommerceException
- if an error occurs.public java.util.List deleteItems(Order pOrder, java.lang.String[] pRemovalCommerceIds, PricingModelHolder pUserPricingModels, java.util.Locale pUserLocale, RepositoryItem pProfile, atg.commerce.util.PipelineErrorHandler pErrorHandler) throws CommerceException
pOrder
- the order from which the items will be removed.pRemovalCommerceIds
- the array of commerce items ids to be removed.pUserPricingModels
- the promotions for the user.pUserLocale
- the locale of the user.pProfile
- the user profile.pErrorHandler
- the object which will handle pipeline errors.CommerceException
- if an error occurs.deleteItems(atg.commerce.order.Order, java.lang.String[], atg.commerce.pricing.PricingModelHolder, java.util.Locale, atg.repository.RepositoryItem, atg.commerce.util.PipelineErrorHandler, java.util.Map)
public CommerceItem deleteItem(java.lang.String pCommerceId, Order pOrder) throws CommerceException
CommerceException
public void postDeleteItem(Order pOrder, CommerceItem pItem, long pQty, atg.commerce.util.PipelineErrorHandler pErrorHandler) throws CommerceException
pOrder
- OrderpItem
- CommerceItem deletedpQty
- long quantity of the item that was deletedpErrorHandler
- PipelineErrorHandlerCommerceException
public void postDeleteItem(Order pOrder, CommerceItem pItem, long pQty, boolean pGiftWithPurchase, atg.commerce.util.PipelineErrorHandler pErrorHandler) throws CommerceException
pOrder
- the orderpItem
- CommerceItem deletedpQty
- long quantity of the item that was deletedpGiftWithPurchase
- boolean true
to indicate that this was a gift with purchase itempErrorHandler
- PipelineErrorHandlerCommerceException
public void changeItemQuantity(Order pOrder, CommerceItem pItem, long pNewQty, boolean pGiftWithPurchase, atg.commerce.util.PipelineErrorHandler pErrorHandler) throws CommerceException
pOrder
- Order to usepItem
- CommerceItem to adjustpNewQty
- long new quantity of the commerce itempGiftWithPurchase
- boolean true
if the adjustment is to gift with purchase quantity.pErrorHandler
- PipelineErrorHandler to useCommerceException
protected CommerceItem createCommerceItem(AddCommerceItemInfo pItemInfo, java.lang.String pCatalogKey, Order pOrder) throws CommerceException
pItemInfo
- commerce item infopCatalogKey
- the catalog key reference (locale) for the new itempOrder
- the orderCommerceException
- if there was an error while executing the codeprotected void setCommerceItemProperties(CommerceItem pItem, AddCommerceItemInfo pItemInfo) throws CommerceException
pItem
- the CommerceItempItemInfo
- the commerce item infoCommerceException
- if there was an error while executing the codeprotected void applyValueDictionary(java.lang.Object pBean, java.util.Dictionary pValues, java.lang.String pPropertyPathPrefix) throws CommerceException
pBean
- the object to which to copy dictionary valuespValues
- the dictionary from which to copy valuespPropertyPathPrefix
- the name prefix for dictionary entries
(null
for the top level dictionary)CommerceException
- if there was an error while executing the codeprotected void addItemToShippingGroup(CommerceItem pItem, AddCommerceItemInfo pItemInfo, Order pOrder, ShippingGroup pShippingGroup) throws CommerceException
shippingGroup
property.pItem
- the CommerceItempItemInfo
- commerce item infopOrder
- the orderpShippingGroup
- the shipping group that this item will be added toCommerceException
- if there was an error while executing the codeprotected void createConfigurableSubitems(CommerceItem pItem, AddCommerceItemInfo pItemInfo, Order pOrder) throws CommerceException
pItem
- the base Commerce itempItemInfo
- commerce item infopOrder
- the orderCommerceException
protected void processGiftAddition(CommerceItem pItem, AddCommerceItemInfo pItemInfo, Order pOrder, RepositoryItem pProfile, ShippingGroup pShippingGroup) throws CommerceException
pItem
- the commerce itempItemInfo
- commerce item infopOrder
- the orderpProfile
- the user profilepShippingGroup
- the shipping group that this gift should be added toCommerceException
- if there was an error while executing the codeprotected void runProcessAddItemToOrder(Order pOrder, CommerceItem pCommerceItem, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, atg.commerce.util.PipelineErrorHandler pErrorHandler) throws RunProcessException
handleAddItemToOrder
method is invoked
This method will add pCommerceItem to pExtraParameters unless the key
PipelineConstants.COMMERCEITEM is already in the mappOrder
- the order to repricepCommerceItem
- the commerce itempPricingModels
- the set of all pricing models for the user (item, order, shipping, tax)pLocale
- the locale that the order should be priced withinpProfile
- the user who owns the orderpExtraParameters
- A Map of extra parameters to be used in the pricingpErrorHandler
- PipelineErrorHandler to useRunProcessException
protected void runProcessSendScenarioEvent(Order pOrder, CommerceItem pItem, long pQuantity, java.lang.String pType, atg.commerce.util.PipelineErrorHandler pErrorHandler) throws RunProcessException
runProcessSendScenarioEvent
method sends a scenario event.pOrder
- an Order
valuepItem
- a CommerceItem
valuepQuantity
- the quantity affectedpType
- a String
valueRunProcessException
- if an error occursprotected void runProcessSendScenarioEvent(Order pOrder, CommerceItem pItem, long pQuantity, boolean pGiftWithPurchase, java.lang.String pType, atg.commerce.util.PipelineErrorHandler pErrorHandler) throws RunProcessException
runProcessSendScenarioEvent
method sends a scenario event.pOrder
- an Order
valuepItem
- a CommerceItem
valuepQuantity
- the quantity affectedpGiftWithPurchase
- boolean true
if item quantity is a gift with purchasepType
- a String
valueRunProcessException
- if an error occursprotected void runProcessSendScenarioEvent(Order pOrder, CommerceItem pItem, long pQuantity, boolean pGiftWithPurchase, java.lang.String pType, atg.commerce.util.PipelineErrorHandler pErrorHandler, java.lang.String pSiteId) throws RunProcessException
runProcessSendScenarioEvent
method sends a scenario event.pOrder
- an Order
valuepItem
- a CommerceItem
valuepQuantity
- the quantity affectedpGiftWithPurchase
- boolean true
if item quantity is a gift with purchasepType
- a String
valuepSiteId
- The site ID associated with a scenario eventRunProcessException
- if an error occurspublic void processPipelineErrors(PipelineResult pResult, atg.commerce.util.PipelineErrorHandler pErrorHandler)
@Deprecated public void adjustItemRelationshipsForQuantityChange(Order pOrder, CommerceItem pItem, long pNewQuantity) throws CommerceException
CommerceItemManager.adjustItemRelationshipsForQuantityChange()
pOrder
- the order which contains the itempItem
- the itempNewQuantity
- the new quantityCommerceException
increaseRelationshipQuantity(Order, ShippingGroupCommerceItemRelationship, long)
,
decreaseRelationshipQuantity(Order, ShippingGroupCommerceItemRelationship, long)
,
removeEntireRelationshipQuantity(Order, ShippingGroupCommerceItemRelationship)
@Deprecated protected void increaseRelationshipQuantity(Order pOrder, ShippingGroupCommerceItemRelationship pRelationship, long pQuantityIncrease) throws CommerceException
CommerceItemManager.increaseRelationshipQuantity()
Called by adjustItemRelationshipsForQuantityChange
when the quantity of an item is being increased
for a relationship. Gift quantity is also increased, if necessary.
Gift quantities and other handling isntructions are also adjusted
pOrder
- the orderpRelationship
- the relationship whose quantity is to be increasedpQuantityIncrease
- the quantity by which to increaseCommerceException
GiftlistManager.adjustGiftsForQuantityIncrease(Order, ShippingGroup, CommerceItem, long, long)
,
adjustNonGiftHandlingInstructionsForQuantityIncrease(Order, ShippingGroup, CommerceItem, long, long)
@Deprecated protected void removeEntireRelationshipQuantity(Order pOrder, ShippingGroupCommerceItemRelationship pRelationship) throws CommerceException
CommerceItemManager.removeEntireRelationshipQuantity()
adjustItemRelationshipsForQuantityChange
when the quantity of a relationship is being
decreased to zero. This method removes all handling instructions before removing the item's quantity from the
shipping group.pOrder
- the orderpRelationship
- the relationship whose quantity is to be removedCommerceException
@Deprecated protected void decreaseRelationshipQuantity(Order pOrder, ShippingGroupCommerceItemRelationship pRelationship, long pQuantityDecrease) throws CommerceException
CommerceItemManager.decreaseRelationshipQuantity()
Called by adjustItemRelationshipsForQuantityChange
when the quantity of a relationship is being
partially decreased by the given value.
Gift quantities and other handling instructions are also adjusted
pOrder
- the orderpRelationship
- the relationship whose quantity is to be decreasedpQuantityDecrease
- the quantity by which to decreaseCommerceException
GiftlistManager.adjustGiftsForQuantityDecrease(Order, ShippingGroup, CommerceItem, long, long)
,
adjustNonGiftHandlingInstructionsForQuantityDecrease(Order, ShippingGroup, CommerceItem, long, long)
@Deprecated protected void adjustNonGiftHandlingInstructionsForQuantityDecrease(Order pOrder, ShippingGroup pShippingGroup, CommerceItem pCommerceItem, long pNewQuantity, long pQuantityDecrease) throws CommerceException
CommerceItemManager.adjustNonGiftHandlingInstructionsForQuantityDecrease()
This method adjusts the quantity of the handling instruction to the given new quantity if its quantity currently higher than the new quantity.
Applications should extend this method to handle custom handling instructions accordingly.
pOrder
- the orderpShippingGroup
- ShippingGroup containing the handling instructionpCommerceItem
- the CommerceItempNewQuantity
- the quantity that will be set to the HandlingInstructionpQuantityDecrease
- the quantity by which to decreaseCommerceException
@Deprecated protected void adjustNonGiftHandlingInstructionsForQuantityIncrease(Order pOrder, ShippingGroup pShippingGroup, CommerceItem pCommerceItem, long pNewQuantity, long pQuantityIncrease) throws CommerceException
CommerceItemManager.adjustNonGiftHandlingInstructionsForQuantityIncrease()
This method increases the quantity of all non-gift handling instructions by the given quantity increase.
Applications should extend this method to handle custom handling instructions accordingly.
pOrder
- the orderpShippingGroup
- ShippingGroup containing the handling instructionpCommerceItem
- the CommerceItempNewQuantity
- the quantity that will be set to the HandlingInstructionpQuantityIncrease
- the quantity by which to increaseCommerceException
public ShippingGroup getShippingGroupForItem(Order pOrder, AddCommerceItemInfo pItemInfo, ShippingGroup pShippingGroup, java.lang.String pCatalogKey) throws CommerceException
AddCommerceItemInfo
, that type is used.
Otherwise, this method checks to see if the addItemToDefaultShippingGroup
flag is turned on/off.
If the addItemToDefaultShippingGroup
flag value is true, this method returns the default shipping group
pShippingGroup
. If the addItemToDefaultShippingGroup
flag is false, this method calls
getShippingGroupManager().getFirstShippingGroupType()
to identify the right shipping group type for the item.
Once the item's shipping group type has been identified, this method uses the following logic to locate an appropriate shipping group in the order or to create a new shipping group:
This method is used to get a shipping group for gift or normal commerce item.
If the AddCommerceItemInfo.getGiftlistId()
or AddCommerceItemInfo.getGiftlistItemId()
is not empty a commerce item is considered as a gift item. For gift items, this method checks
only the shipping group type.
The following logic is used for a gift item to find an appropriate shipping group:
pShippingGroup
if it has the right type.pOrder
for an existing shipping group that matches the new item's
shipping group type. If the shipping group type matches, return that shipping group.The following logic is used for a NON-GIFT item to find an appropriate shipping group:
pShippingGroup
if it has the right type and is a non gift shipping group.pOrder
for an existing shipping group that matches the new item's
shipping group type. If the shipping group type matches and it is non gift shipping group, return that shipping group.pOrder
- the Order to which the item will be added.pItemInfo
- detailed information about the item to be added.pShippingGroup
- a candidate or default shipping group to use.pCatalogKey
- the key of the catalog of the items.CommerceException
GiftlistManager.isGiftShippingGroup(ShippingGroup)
public ShippingGroup getFirstShippingGroup(Order pOrder)
pOrder
- the orderShippingGroup
valueprotected boolean isTransactionMarkedAsRollBack()
boolean
value