atg.projects.store.order.purchase
Class StorePurchaseProcessHelper

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.order.purchase.PurchaseProcessHelper
              extended by atg.projects.store.order.purchase.StorePurchaseProcessHelper
All Implemented Interfaces:
atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, java.util.EventListener
Direct Known Subclasses:
StoreBillingProcessHelper, StoreCartProcessHelper, StoreCommitOrderProcessHelper, StoreExpressCheckoutProcessHelper, StoreShippingProcessHelper

public class StorePurchaseProcessHelper
extends atg.commerce.order.purchase.PurchaseProcessHelper

Store implementation of the purchase process helper.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string.
static java.lang.String MSG_MISSING_REQUIRED_ADDRESS_PROPERTY
          Missing required address property.
static java.lang.String MSG_MULTIPLE_COUPONS_PER_ORDER
          Multiple coupons per order error message key.
static java.lang.String MSG_UNCLAIMABLE_COUPON
          Uncliamable coupon error message key.
static java.lang.String PRICING_ERROR
          Pricing error message key.
static java.lang.String PRICING_ERROR_ADDRESS
          Pricing error invalid address message key.
 
Fields inherited from class atg.commerce.order.purchase.PurchaseProcessHelper
ERROR_FETCHING_PROFILE, MSG_ERROR_ADDING_CREDIT_CARD, MSG_ERROR_ADDING_SHIPPINGGROUP, MSG_ERROR_ADDING_TO_ORDER, MSG_ERROR_CREATING_ORDER, MSG_ERROR_MOVING_ITEM_BETWEEN_SHIPPING_GROUPS, MSG_ERROR_PROCESS_ADD_ITEM_CHAIN, MSG_ERROR_REMOVING_ITEM, MSG_ERROR_REMOVING_ITEM_FROM_SHIPPING_GROUP, MSG_ERROR_REPRICING_ORDER_AFTER_ADD_ITEM, MSG_ERROR_SETTING_ORDER_AMOUNT, MSG_INVALID_PROFILE_ID
 
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
StorePurchaseProcessHelper()
           
 
Method Summary
protected  void addItemToShippingGroup(atg.commerce.order.CommerceItem pItem, atg.commerce.order.purchase.AddCommerceItemInfo pItemInfo, atg.commerce.order.Order pOrder, atg.commerce.order.ShippingGroup pShippingGroup)
          Associate a commerce item with the shipping group specified by the pItemInfo.shippingGroup property or the default shipping group supplied by our caller.
 java.util.List checkForRequiredAddressProperties(atg.core.util.ContactInfo pContactInfo, atg.servlet.DynamoHttpServletRequest pRequest)
          Validates the required billing properties.
 void claimCoupon(java.lang.String pCouponCode, StoreOrderImpl pOrder, atg.repository.RepositoryItem pProfile, boolean pRepriceOrder, atg.commerce.pricing.PricingModelHolder pUserPricingModels, java.util.Locale pUserLocale)
          This method claims a coupon specified by its code for a specific user and order.
 void claimCoupon(java.lang.String pCouponCode, StoreOrderImpl pOrder, atg.repository.RepositoryItem pProfile, atg.commerce.pricing.PricingModelHolder pUserPricingModels, java.util.Locale pUserLocale)
          This method claims a coupon specified by its code for a specific user and order and reprices the order.
 java.util.Map getAddressPropertyNameMap()
           
 atg.commerce.claimable.ClaimableManager getClaimableManager()
           
protected  java.util.List getMandatoryStateCountryList(atg.servlet.DynamoHttpServletRequest pRequest)
          Get mandatory state country list.
 atg.commerce.util.PlaceUtils getPlaceUtils()
           
 atg.commerce.pricing.PricingTools getPricingTools()
           
 java.lang.String[] getRequiredAddressPropertyNames()
           
protected  atg.commerce.order.ShippingGroup getShippingGroupForItem(atg.commerce.order.purchase.AddCommerceItemInfo pItemInfo, atg.commerce.order.ShippingGroup pShippingGroup)
          Figures out what shipping group to use for a new commerce item.
 StoreConfiguration getStoreConfiguration()
           
 StoreOrderTools getStoreOrderTools()
           
protected  void processGiftAddition(atg.commerce.order.CommerceItem pItem, atg.commerce.order.purchase.AddCommerceItemInfo pItemInfo, atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pProfile, atg.commerce.order.ShippingGroup pShippingGroup)
          Perform giftlist related processing for an item being ordered from a giftlist.
 void removeCoupon(StoreOrderImpl pOrder, atg.repository.RepositoryItem pProfile, boolean pRepriceOrder, atg.commerce.pricing.PricingModelHolder pUserPricingModels, java.util.Locale pUserLocale)
          This method removes a coupon from the order specified.
 void removeCoupon(StoreOrderImpl pOrder, atg.repository.RepositoryItem pProfile, atg.commerce.pricing.PricingModelHolder pUserPricingModels, java.util.Locale pUserLocale)
          This method removes a coupon from the order specified and reprices the order.
 void repriceOrder(atg.commerce.order.Order pOrder, atg.commerce.pricing.PricingModelHolder pUserPricingModels, java.util.Locale pUserLocale, atg.repository.RepositoryItem pProfile)
          Logic to reprice order, and parse any errors.
 void setAddressPropertyNameMap(java.util.Map pAddressPropertyNameMap)
           
 void setClaimableManager(atg.commerce.claimable.ClaimableManager pClaimableManager)
           
 void setPlaceUtils(atg.commerce.util.PlaceUtils pPlaceUtils)
          Sets place utils
 void setPricingTools(atg.commerce.pricing.PricingTools pPricingTools)
           
 void setRequiredAddressPropertyNames(java.lang.String[] pRequiredAddressPropertyNames)
           
 void setStoreConfiguration(StoreConfiguration pStoreConfiguration)
           
 void setStoreOrderTools(StoreOrderTools pStoreOrderTools)
           
 boolean tenderCoupon(java.lang.String pCouponCode, StoreOrderImpl pOrder, atg.repository.RepositoryItem pProfile, atg.commerce.pricing.PricingModelHolder pUserPricingModels, java.util.Locale pUserLocale)
          Attempt to claim the specified coupon code for a specific user and order.
 
Methods inherited from class atg.commerce.order.purchase.PurchaseProcessHelper
addCreditCardToOrder, addItemsToOrder, addItemsToOrder, addShippingAddressToOrder, adjustItemRelationshipsForQuantityChange, adjustNonGiftHandlingInstructionsForQuantityDecrease, adjustNonGiftHandlingInstructionsForQuantityIncrease, applyValueDictionary, copyCreditCardInfo, createCommerceItem, createConfigurableSubitems, createOrder, decreaseRelationshipQuantity, deleteItems, deleteItems, getAddItemToOrderChainId, getAddItemToOrderPricingOp, getCommerceItemManager, getDefaultHardgoodShippingGroupType, getDeleteItemsFromOrderPricingOp, getGiftlistManager, getOrderManager, getPipelineManager, getRepriceOrderChainId, getShippingGroupForItem, getShippingGroupManager, getTransactionManager, increaseRelationshipQuantity, isAddItemToDefaultShippingGroup, isTransactionMarkedAsRollBack, moveItemBetweenShippingGroups, processPipelineErrors, removeEntireRelationshipQuantity, removeItemQuantityFromShippingGroup, runProcess, runProcess, runProcess, runProcessAddItemToOrder, runProcessRepriceOrder, runProcessSendScenarioEvent, runProcessSendScenarioEvent, runRepricingProcess, setAddItemToDefaultShippingGroup, setAddItemToOrderChainId, setAddItemToOrderPricingOp, setCommerceItemManager, setCommerceItemProperties, setDefaultHardgoodShippingGroupType, setDeleteItemsFromOrderPricingOp, setGiftlistManager, setOrderAmountToPaymentGroup, setOrderManager, setPipelineManager, setRepriceOrderChainId, setShippingGroupManager, setTransactionManager
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, 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, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, 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

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string.

See Also:
Constant Field Values

MSG_MISSING_REQUIRED_ADDRESS_PROPERTY

public static final java.lang.String MSG_MISSING_REQUIRED_ADDRESS_PROPERTY
Missing required address property.

See Also:
Constant Field Values

PRICING_ERROR_ADDRESS

public static java.lang.String PRICING_ERROR_ADDRESS
Pricing error invalid address message key.


PRICING_ERROR

public static java.lang.String PRICING_ERROR
Pricing error message key.


MSG_MULTIPLE_COUPONS_PER_ORDER

public static final java.lang.String MSG_MULTIPLE_COUPONS_PER_ORDER
Multiple coupons per order error message key.

See Also:
Constant Field Values

MSG_UNCLAIMABLE_COUPON

public static final java.lang.String MSG_UNCLAIMABLE_COUPON
Uncliamable coupon error message key.

See Also:
Constant Field Values
Constructor Detail

StorePurchaseProcessHelper

public StorePurchaseProcessHelper()
Method Detail

getAddressPropertyNameMap

public java.util.Map getAddressPropertyNameMap()
Returns:
the address property name map.

setAddressPropertyNameMap

public void setAddressPropertyNameMap(java.util.Map pAddressPropertyNameMap)
Parameters:
pAddressPropertyNameMap - - the address property name map to set.

getRequiredAddressPropertyNames

public java.lang.String[] getRequiredAddressPropertyNames()
Returns:
the address property names.

setRequiredAddressPropertyNames

public void setRequiredAddressPropertyNames(java.lang.String[] pRequiredAddressPropertyNames)
Parameters:
pRequiredAddressPropertyNames - - the address property name map to set.

getStoreOrderTools

public StoreOrderTools getStoreOrderTools()
Returns:
the Store order tools property.

setStoreOrderTools

public void setStoreOrderTools(StoreOrderTools pStoreOrderTools)
Parameters:
pStoreOrderTools - - the Store order tools property.

getStoreConfiguration

public StoreConfiguration getStoreConfiguration()
Returns:
the store configuration.

setStoreConfiguration

public void setStoreConfiguration(StoreConfiguration pStoreConfiguration)
Parameters:
pStoreConfiguration - - the store configuration to set.

setPricingTools

public void setPricingTools(atg.commerce.pricing.PricingTools pPricingTools)
Parameters:
pPricingTools - - pricing tools.

getPricingTools

public atg.commerce.pricing.PricingTools getPricingTools()
Returns:
mPricingTools - pricing tools.

getPlaceUtils

public atg.commerce.util.PlaceUtils getPlaceUtils()
Returns:
place utils

setPlaceUtils

public void setPlaceUtils(atg.commerce.util.PlaceUtils pPlaceUtils)
Sets place utils

Parameters:
pPlaceUtils -

getClaimableManager

public atg.commerce.claimable.ClaimableManager getClaimableManager()

setClaimableManager

public void setClaimableManager(atg.commerce.claimable.ClaimableManager pClaimableManager)

addItemToShippingGroup

protected void addItemToShippingGroup(atg.commerce.order.CommerceItem pItem,
                                      atg.commerce.order.purchase.AddCommerceItemInfo pItemInfo,
                                      atg.commerce.order.Order pOrder,
                                      atg.commerce.order.ShippingGroup pShippingGroup)
                               throws atg.commerce.CommerceException
Associate a commerce item with the shipping group specified by the pItemInfo.shippingGroup property or the default shipping group supplied by our caller.

Overrides:
addItemToShippingGroup in class atg.commerce.order.purchase.PurchaseProcessHelper
Parameters:
pItem - the CommerceItem
pItemInfo - the object that supplies input for the commerce item
pOrder - the item's order
pShippingGroup - the default shipping group for the order
Throws:
atg.commerce.CommerceException - if there was an error while executing the code

processGiftAddition

protected void processGiftAddition(atg.commerce.order.CommerceItem pItem,
                                   atg.commerce.order.purchase.AddCommerceItemInfo pItemInfo,
                                   atg.commerce.order.Order pOrder,
                                   atg.repository.RepositoryItem pProfile,
                                   atg.commerce.order.ShippingGroup pShippingGroup)
                            throws atg.commerce.CommerceException
Perform giftlist related processing for an item being ordered from a giftlist. This method extends the base by looking for an item-specific shipping group.

Overrides:
processGiftAddition in class atg.commerce.order.purchase.PurchaseProcessHelper
Parameters:
pItem - the CommerceItem
pItemInfo - the object that supplies input for the commerce item
pOrder - the item's order
pProfile - the owner of the order
pShippingGroup - the default shipping group for the order
Throws:
atg.commerce.CommerceException - if there was an error while executing the code

getShippingGroupForItem

protected atg.commerce.order.ShippingGroup getShippingGroupForItem(atg.commerce.order.purchase.AddCommerceItemInfo pItemInfo,
                                                                   atg.commerce.order.ShippingGroup pShippingGroup)
Figures out what shipping group to use for a new commerce item. If pItemInfo mentions a specific shipping group, returns that. Otherwise, returns the default shipping group.

Parameters:
pItemInfo - the object that supplies input for the commerce item
pShippingGroup - the default shipping group for the order
Returns:
the shipping group to use

getMandatoryStateCountryList

protected java.util.List getMandatoryStateCountryList(atg.servlet.DynamoHttpServletRequest pRequest)
Get mandatory state country list.

Parameters:
pRequest - - http request
Returns:
mandatory state country list

checkForRequiredAddressProperties

public java.util.List checkForRequiredAddressProperties(atg.core.util.ContactInfo pContactInfo,
                                                        atg.servlet.DynamoHttpServletRequest pRequest)
Validates the required billing properties.

Parameters:
pContactInfo - - contact information
Returns:
a list of required properties that are missing from the ContactInfo

repriceOrder

public void repriceOrder(atg.commerce.order.Order pOrder,
                         atg.commerce.pricing.PricingModelHolder pUserPricingModels,
                         java.util.Locale pUserLocale,
                         atg.repository.RepositoryItem pProfile)
                  throws atg.commerce.pricing.PricingException
Logic to reprice order, and parse any errors.

Parameters:
pOrder - the order to price
pUserLocale - the locale of the user, may be null
pProfile - the user, may be null
pUserPricingModels - the PricingModelHolder is an object which contains all the pricing models associated with a user (i.e. item, shipping, order and tax).
Throws:
atg.commerce.pricing.PricingException - if there was an error while computing the pricing information

tenderCoupon

public boolean tenderCoupon(java.lang.String pCouponCode,
                            StoreOrderImpl pOrder,
                            atg.repository.RepositoryItem pProfile,
                            atg.commerce.pricing.PricingModelHolder pUserPricingModels,
                            java.util.Locale pUserLocale)
                     throws atg.commerce.CommerceException,
                            java.lang.IllegalArgumentException
Attempt to claim the specified coupon code for a specific user and order. If the tendered coupon code is empty then remove any existing coupon on the order, if the tendered coupon is not empty then check this is a valid claimable item before removing any existing coupon and claiming the tendered coupon. This avoids issues such as revoke promotion events if we simply remove the coupon and then rollback when claiming the coupon fails.

Parameters:
pCouponCode - - coupon code to be claimed
pOrder - - order to be repriced when the coupon has been claimed
pProfile - - user who claims a coupon
pUserPricingModels - - user's pricing models to be used for order reprice process
pUserLocale - - user's locale to be used when repricing order
Returns:
true if the coupon has been successfully removed or tendered/claimed; false otherwise
Throws:
atg.commerce.CommerceException - if an error occurred during claiming the coupon
java.lang.IllegalArgumentException

claimCoupon

public void claimCoupon(java.lang.String pCouponCode,
                        StoreOrderImpl pOrder,
                        atg.repository.RepositoryItem pProfile,
                        atg.commerce.pricing.PricingModelHolder pUserPricingModels,
                        java.util.Locale pUserLocale)
                 throws atg.commerce.CommerceException,
                        java.lang.IllegalArgumentException
This method claims a coupon specified by its code for a specific user and order and reprices the order.

Parameters:
pCouponCode - - coupon code to be claimed
pOrder - - order to be repriced when the coupon has been claimed
pProfile - - user who claims a coupon
pUserPricingModels - - user's pricing models to be used for order reprice process
pUserLocale - - user's locale to be used when repricing order
Throws:
atg.commerce.CommerceException - - if something goes wrong
java.lang.IllegalArgumentException - - if order has a claimed coupon already

claimCoupon

public void claimCoupon(java.lang.String pCouponCode,
                        StoreOrderImpl pOrder,
                        atg.repository.RepositoryItem pProfile,
                        boolean pRepriceOrder,
                        atg.commerce.pricing.PricingModelHolder pUserPricingModels,
                        java.util.Locale pUserLocale)
                 throws atg.commerce.CommerceException,
                        java.lang.IllegalArgumentException
This method claims a coupon specified by its code for a specific user and order. The order is repriced if the 'pRepriceOrder' parameter is true.

Parameters:
pCouponCode - - coupon code to be claimed
pOrder - - order to be repriced when the coupon has been claimed
pProfile - - user who claims a coupon
pRepriceOrder - - boolean flag to indicate if order should be repriced
pUserPricingModels - - user's pricing models to be used for order reprice process
pUserLocale - - user's locale to be used when repricing order
Throws:
atg.commerce.CommerceException - - if something goes wrong
java.lang.IllegalArgumentException - - if order has a claimed coupon already

removeCoupon

public void removeCoupon(StoreOrderImpl pOrder,
                         atg.repository.RepositoryItem pProfile,
                         atg.commerce.pricing.PricingModelHolder pUserPricingModels,
                         java.util.Locale pUserLocale)
                  throws atg.commerce.CommerceException
This method removes a coupon from the order specified and reprices the order.

Parameters:
pOrder - - order with coupon claimed
pProfile - - user who removes a coupon
pUserPricingModels - - user's pricing models to be used in order repricing process
pUserLocale - - user's locale to be used when repricing order
Throws:
atg.commerce.CommerceException - - if something goes wrong

removeCoupon

public void removeCoupon(StoreOrderImpl pOrder,
                         atg.repository.RepositoryItem pProfile,
                         boolean pRepriceOrder,
                         atg.commerce.pricing.PricingModelHolder pUserPricingModels,
                         java.util.Locale pUserLocale)
                  throws atg.commerce.CommerceException
This method removes a coupon from the order specified. The order is repriced if the 'pRepriceOrder' parameter is true.

Parameters:
pOrder - - order with coupon claimed
pProfile - - user who removes a coupon
pRepriceOrder - - boolean flag to indicate if order should be repriced
pUserPricingModels - - user's pricing models to be used in order repricing process
pUserLocale - - user's locale to be used when repricing order
Throws:
atg.commerce.CommerceException - - if something goes wrong