atg.projects.store.order.purchase
Class StoreShippingProcessHelper

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
                  extended by atg.projects.store.order.purchase.StoreShippingProcessHelper
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

public class StoreShippingProcessHelper
extends StorePurchaseProcessHelper

Helper methods for handling shipping information


Field Summary
static java.lang.String CLASS_VERSION
          Class version string.
static java.lang.String COUNTRY_DELIM
          Country delimiter.
protected  boolean mConsolidateShippingInfosBeforeApply
           
static java.lang.String MSG_DUPLICATE_NICKNAME
          Duplicate nickname message key.
static java.lang.String MSG_ERROR_UPDATE_SHIPPINGGROUP
          Error updating shipping groups message key.
static java.lang.String MSG_INVALID_CITY_ADDRESS
          Invalid city address message key.
static java.lang.String MSG_INVALID_STATE_FOR_METHOD
          Invalid state for method message key.
static java.lang.String MSG_INVALID_STREET_ADDRESS
          Invalid Street Address message key
static java.lang.String MSG_RESTRICTED_SHIPPING
          Restricted shipping message key.
protected  boolean mValidateShippingGroups
           
static java.lang.String NEW_ADDRESS
          New address constant.
 
Fields inherited from class atg.projects.store.order.purchase.StorePurchaseProcessHelper
MSG_MISSING_REQUIRED_ADDRESS_PROPERTY, PRICING_ERROR, PRICING_ERROR_ADDRESS
 
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_REMOVING_ITEM, MSG_ERROR_REMOVING_ITEM_FROM_SHIPPING_GROUP, 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
StoreShippingProcessHelper()
           
 
Method Summary
 void addShippingAddress(atg.repository.RepositoryItem pProfile, java.lang.String pNewShipToAddressName, atg.core.util.Address pAddress, atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer, boolean pSaveShippingAddress)
          Creates a new shipping group and adds it to the shipping group map container.
 void applyShippingGroups(atg.commerce.order.purchase.CommerceItemShippingInfoContainer pCommerceItemShippingInfoContainer, atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer, atg.commerce.order.Order pOrder)
          applyShippingGroups removes all non-gift ShippingGroups from the Order and then iterates over the supplied CommerceItemShippingInfos for each of the CommerceItems.
 void changeShippingGroupForCommerceItemShippingInfos(java.util.Collection pCommerceItemShippingInfos, java.lang.String pShippingGroupName, java.lang.String pShippingMethod)
          Changes the shipping group name and shipping method for a collection of items in the CommerceItemShippingInfoContainer.
 java.util.List checkForInvalidStreetAddress(atg.core.util.ContactInfo pContactInfo)
          Validates against invalid street addresses.
 java.util.List checkShippingRestrictions(atg.commerce.order.purchase.CommerceItemShippingInfoContainer pCommerceItemShippingInfoContainer, atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
          Check shipping restrictions.
 void copyShippingToBilling(atg.commerce.order.Order pOrder, atg.core.util.Address pAddress)
          Copies the new shipping group address to the order's credit card payment group address.
 atg.commerce.order.HardgoodShippingGroup createShippingGroupFromDefaultAddress(atg.repository.RepositoryItem pProfile)
          Creates a HardgoodShippingGroup from the profile's default shipping address item.
 java.lang.String generateNewShipToAddressNickName(atg.core.util.Address pAddress, java.lang.String pNewShipToAddressName, atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
           
 java.util.List getAllHardgoodCommerceItemShippingInfos(atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer, atg.commerce.order.purchase.CommerceItemShippingInfoContainer pCommerceItemShippingInfoContainer)
          Get the List of all the CommerceItemShippingInfos for hardgoods from the CommerceItemShippingInfoMap.
 atg.commerce.order.purchase.CommerceItemShippingInfoTools getCommerceItemShippingInfoTools()
          Returns the tools component containing the API for modifying CommerceItemShippingInfos
 java.util.List getElectronicShippingGroups(atg.commerce.order.Order pOrder)
           
 atg.commerce.order.HardgoodShippingGroup getFirstNonGiftHardgoodShippingGroupWithRels(atg.commerce.order.Order pOrder)
          Returns the first non-gift hardgood shipping group with relationships from the order.
 java.util.List getGiftShippingGroups(atg.commerce.order.Order pOrder)
          Returns a list of all shipping groups that contain gifts.
protected  java.util.regex.Pattern[] getInvalidCityPatterns()
           
 java.util.Properties getInvalidStatesForShipMethod()
          Expects a pipe-dilimited string containing 2-digit state abbreviations that are invalid for a particular shipping method.
 java.lang.String[] getInvalidStreetStrings()
           
 int getNonGiftHardgoodShippingGroupCount(atg.commerce.order.Order pOrder)
          Returns the number of non-gift hardgood shipping groups with commerce item relationships.
 java.util.List getNonGiftHardgoodShippingGroups(atg.commerce.order.Order pOrder)
          Returns the non-gift hardgood shipping groups with commerce item relationships.
 java.util.Collection getUniqueHardgoodShippingGroups(atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer, atg.commerce.order.purchase.CommerceItemShippingInfoContainer pCommerceItemShippingInfoContainer)
          Retrieve the collection of all hardgood shipping groups referenced by commerce item infos.
 java.lang.String getValidateShippingGroupsChainId()
          Return the ValidateShippingGroupsChainId property.
 boolean getValidateShippingRestriction()
           
 java.lang.String initializeShippingMethod(atg.repository.RepositoryItem pProfile, atg.commerce.order.ShippingGroup pShippingGroup, java.lang.String pDefaultShippingMethod)
          Determines the shipping method in the following order of precendence: shipping group's shipping method, the profile's default shipping method, and the default configured shipping method.
 boolean isAnyElectronicShippingGroups(atg.commerce.order.Order pOrder)
          Returns true if the order has at least one electronic shipping group with commerce item relationships.
 boolean isAnyHardgoodShippingGroups(atg.commerce.order.Order pOrder)
          Returns true if the order has at least one hargood shipping group with commerce item relationships.
 boolean isAnyNonGiftHardgoodShippingGroups(atg.commerce.order.Order pOrder)
          Determines if there are any non-gift hardgood shipping groups with relationships.
 boolean isApplyDefaultShippingGroup()
          Return the ApplyDefaultShippingGroup property.
 boolean isConsolidateShippingInfosBeforeApply()
           
 boolean isMultipleHardgoodShippingGroupsWithRelationships(atg.commerce.order.Order pOrder)
          Returns true if the order has more than one hardgood shipping group with commerce item relationships.
 boolean isMultipleNonGiftHardgoodItems(atg.commerce.order.Order pOrder)
          Determines if the total quantity of all non-gift hardgood items is more than one.
 boolean isMultipleNonGiftHardgoodShippingGroups(atg.commerce.order.Order pOrder)
          Returns true if the order has more than one non-gift hardgood shipping group with commerce item relationships.
 boolean isValidateShippingGroups()
          Returns property ValidateShippingGroups.
 void modifyAddressBookNickname(atg.repository.RepositoryItem pProfile, java.lang.String pEditShippingAddressNickName, java.lang.String pShippingAddressNewNickName)
          Modifies the address nick name is in the profile's map.
 void modifyShippingAddress(java.lang.String pEditShippingAddressNickName, atg.core.util.Address pEditAddress, atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
          Edits a shipping group address in the container and saves the changes to the profile if the address is in the profile's address map.
 void modifyShippingAddressNickname(atg.repository.RepositoryItem pProfile, java.lang.String pEditShippingAddressNickName, java.lang.String pShippingAddressNewNickName, atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
          Modifies shipping address nickname.
protected  atg.service.pipeline.PipelineResult runProcessValidateShippingGroups(atg.commerce.order.Order pOrder, atg.commerce.pricing.PricingModelHolder pPricingModels, java.util.Locale pLocale, atg.repository.RepositoryItem pProfile, java.util.Map pExtraParameters)
          runProcessValidateShippingGroups runs a configurable Pipeline chain to validate ShippingGroups or prepare for the next checkout phase.
 void saveAddressToAddressBook(atg.core.util.Address pAddress, java.lang.String pNickName, atg.repository.RepositoryItem pProfile)
          Saves address to address book.
 void saveDefaultShippingMethod(atg.repository.RepositoryItem pProfile, java.lang.String pShippingMethod)
          Set the profile's default shipping method if it's not already set.
 void saveModifiedShippingAddressToProfile(atg.repository.RepositoryItem pProfile, java.lang.String pEditShippingAddressNickName, atg.core.util.Address pEditAddress)
          saveModifiedShippingAddress shipping address processing.
protected  void saveShippingInfo(atg.repository.RepositoryItem pProfile, atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
          Saves all addresses in the shipping group container's shipping group map.
 void setApplyDefaultShippingGroup(boolean pApplyDefaultShippingGroup)
          Set the ApplyDefaultShippingGroup property.
 void setCommerceItemShippingInfoTools(atg.commerce.order.purchase.CommerceItemShippingInfoTools pCommerceItemShippingInfoTools)
          Commerce Item Shipping Info Tools to set
 void setConsolidateShippingInfosBeforeApply(boolean pConsolidateShippingInfosBeforeApply)
          Sets the consolidateShippingInfosBeforeApply property.
protected  void setGiftWrapItemShippingGroupInfos(java.util.List pCommerceItemShippinGroupInfos)
          This method is called when using multiple shipping groups.
protected  void setInvalidCityPatterns(java.util.regex.Pattern[] pInvalidCityPatterns)
           
 void setInvalidCityStrings(java.lang.String[] pInvalidCityStrings)
           
 void setInvalidStatesForShipMethod(java.util.Properties pInvalidStatesForShipMethod)
          Expects a pipe-dilimited string containing 2-digit state abbreviations that are invalid for a particular shipping method.
 void setInvalidStreetStrings(java.lang.String[] pInvalidStreetStrings)
           
 void setValidateShippingGroups(boolean pValidateShippingGroups)
          Sets property ValidateShippingGroups
 void setValidateShippingGroupsChainId(java.lang.String pValidateShippingGroupsChainId)
          Set the ValidateShippingGroupsChainId property.
 void setValidateShippingRestriction(boolean pValidateShippingRestriction)
           
 java.lang.String trimmedString(java.lang.String inStr)
          Trim string.
 atg.core.util.Address trimSpacesFromAddressValues(atg.core.util.Address pAddress)
          Trims spaces from address values.
 void validateShippingCity(atg.core.util.Address shippingAddress)
          Validates the shipping city against a collection of regular expressions.
 void validateShippingMethod(atg.core.util.Address pAddress, java.lang.String pShippingMethod)
          This method will ensure the user isn't trying to use a shipping method that isn't valid for the state.
 
Methods inherited from class atg.projects.store.order.purchase.StorePurchaseProcessHelper
addItemToShippingGroup, checkForRequiredAddressProperties, getAddressPropertyNameMap, getMandatoryStateCountryList, getPricingTools, getRequiredAddressPropertyNames, getShippingGroupForItem, getStoreConfiguration, getStoreOrderTools, processGiftAddition, repriceOrder, setAddressPropertyNameMap, setPricingTools, setRequiredAddressPropertyNames, setStoreConfiguration, setStoreOrderTools
 
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, moveItemBetweenShippingGroups, processPipelineErrors, removeEntireRelationshipQuantity, removeItemQuantityFromShippingGroup, runProcess, runProcess, runProcess, runProcessAddItemToOrder, runProcessRepriceOrder, 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, 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 java.lang.String CLASS_VERSION
Class version string.


NEW_ADDRESS

public static java.lang.String NEW_ADDRESS
New address constant.


COUNTRY_DELIM

public static java.lang.String COUNTRY_DELIM
Country delimiter.


MSG_INVALID_STATE_FOR_METHOD

public static java.lang.String MSG_INVALID_STATE_FOR_METHOD
Invalid state for method message key.


MSG_RESTRICTED_SHIPPING

public static java.lang.String MSG_RESTRICTED_SHIPPING
Restricted shipping message key.


MSG_DUPLICATE_NICKNAME

public static java.lang.String MSG_DUPLICATE_NICKNAME
Duplicate nickname message key.


MSG_INVALID_CITY_ADDRESS

public static java.lang.String MSG_INVALID_CITY_ADDRESS
Invalid city address message key.


MSG_INVALID_STREET_ADDRESS

public static java.lang.String MSG_INVALID_STREET_ADDRESS
Invalid Street Address message key


MSG_ERROR_UPDATE_SHIPPINGGROUP

public static java.lang.String MSG_ERROR_UPDATE_SHIPPINGGROUP
Error updating shipping groups message key.


mValidateShippingGroups

protected boolean mValidateShippingGroups

mConsolidateShippingInfosBeforeApply

protected boolean mConsolidateShippingInfosBeforeApply
Constructor Detail

StoreShippingProcessHelper

public StoreShippingProcessHelper()
Method Detail

getCommerceItemShippingInfoTools

public atg.commerce.order.purchase.CommerceItemShippingInfoTools getCommerceItemShippingInfoTools()
Returns the tools component containing the API for modifying CommerceItemShippingInfos

Returns:
CommerceItemShippingInfoTools

setCommerceItemShippingInfoTools

public void setCommerceItemShippingInfoTools(atg.commerce.order.purchase.CommerceItemShippingInfoTools pCommerceItemShippingInfoTools)
Commerce Item Shipping Info Tools to set

Parameters:
pCommerceItemShippingInfoTools -

setInvalidCityPatterns

protected void setInvalidCityPatterns(java.util.regex.Pattern[] pInvalidCityPatterns)
Parameters:
pInvalidCityPatterns - - Invalid city patterns.

getInvalidCityPatterns

protected java.util.regex.Pattern[] getInvalidCityPatterns()
Returns:
mInvalidCityPatterns - Invalid city patterns.

setInvalidCityStrings

public void setInvalidCityStrings(java.lang.String[] pInvalidCityStrings)
Parameters:
pInvalidCityStrings - - invalid city strings.

getInvalidStreetStrings

public java.lang.String[] getInvalidStreetStrings()
Returns:
invalid streets strings.

setInvalidStreetStrings

public void setInvalidStreetStrings(java.lang.String[] pInvalidStreetStrings)
Parameters:
pInvalidStreetStrings - - invalid streets strings.

setInvalidStatesForShipMethod

public void setInvalidStatesForShipMethod(java.util.Properties pInvalidStatesForShipMethod)
Expects a pipe-dilimited string containing 2-digit state abbreviations that are invalid for a particular shipping method. The key is the name of the shipping method the value is the pipe-delimited list of states.

Parameters:
pInvalidStatesForShipMethod - - invalid states for shipping methods

getInvalidStatesForShipMethod

public java.util.Properties getInvalidStatesForShipMethod()
Expects a pipe-dilimited string containing 2-digit state abbreviations that are invalid for a particular shipping method. The key is the name of the shipping method the value is the pipe-delimited list of states.

Returns:
invalid states for shipping method

getValidateShippingRestriction

public boolean getValidateShippingRestriction()
Returns:
true if shipping restrictions should be validated, false - otherwise.

setValidateShippingRestriction

public void setValidateShippingRestriction(boolean pValidateShippingRestriction)
Parameters:
pValidateShippingRestriction - - true if shipping restrictions should be validated.

setValidateShippingGroups

public void setValidateShippingGroups(boolean pValidateShippingGroups)
Sets property ValidateShippingGroups


isValidateShippingGroups

public boolean isValidateShippingGroups()
Returns property ValidateShippingGroups.


setValidateShippingGroupsChainId

public void setValidateShippingGroupsChainId(java.lang.String pValidateShippingGroupsChainId)
Set the ValidateShippingGroupsChainId property.

Parameters:
pValidateShippingGroupsChainId - a String value

getValidateShippingGroupsChainId

public java.lang.String getValidateShippingGroupsChainId()
Return the ValidateShippingGroupsChainId property.

Returns:
a String value

isConsolidateShippingInfosBeforeApply

public boolean isConsolidateShippingInfosBeforeApply()
Returns:
Returns the consolidateShippingInfosBeforeApply.

setConsolidateShippingInfosBeforeApply

public void setConsolidateShippingInfosBeforeApply(boolean pConsolidateShippingInfosBeforeApply)
Sets the consolidateShippingInfosBeforeApply property.

This property is used to control is the CommerceItemShippingInfo objects are consolidated prior to being applied to the order.

Parameters:
pConsolidateShippingInfosBeforeApply - The consolidateShippingInfosBeforeApply to set.
See Also:
#consolidateShippingInfos(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse)

setApplyDefaultShippingGroup

public void setApplyDefaultShippingGroup(boolean pApplyDefaultShippingGroup)
Set the ApplyDefaultShippingGroup property.

Parameters:
pApplyDefaultShippingGroup - a boolean value

isApplyDefaultShippingGroup

public boolean isApplyDefaultShippingGroup()
Return the ApplyDefaultShippingGroup property.

Returns:
a boolean value

getElectronicShippingGroups

public java.util.List getElectronicShippingGroups(atg.commerce.order.Order pOrder)
Parameters:
pOrder - Order whose electronic shipping groups are to be retrieved
Returns:
a list of all electronic groups that contain commerce items.

getNonGiftHardgoodShippingGroupCount

public int getNonGiftHardgoodShippingGroupCount(atg.commerce.order.Order pOrder)
Returns the number of non-gift hardgood shipping groups with commerce item relationships.

Parameters:
pOrder - Order whose non-gift hardgood shipping group count is to be retrieved
Returns:
the number of non-empty non-gift hardgood shipping groups

isAnyHardgoodShippingGroups

public boolean isAnyHardgoodShippingGroups(atg.commerce.order.Order pOrder)
Returns true if the order has at least one hargood shipping group with commerce item relationships. Both non-gift and gift shipping groups are considered.

Parameters:
pOrder - Order to be checked
Returns:
true if the order has at least one non-empty hardgood shipping group.

isAnyElectronicShippingGroups

public boolean isAnyElectronicShippingGroups(atg.commerce.order.Order pOrder)
Returns true if the order has at least one electronic shipping group with commerce item relationships.

Parameters:
pOrder - Order to be checked
Returns:
true if the order has at least one non-empty hardgood shipping group.

isMultipleNonGiftHardgoodShippingGroups

public boolean isMultipleNonGiftHardgoodShippingGroups(atg.commerce.order.Order pOrder)
Returns true if the order has more than one non-gift hardgood shipping group with commerce item relationships.

Parameters:
pOrder - Order to be checked
Returns:
boolean true if the order has more than one non-gift hardgood shipping group.

isMultipleHardgoodShippingGroupsWithRelationships

public boolean isMultipleHardgoodShippingGroupsWithRelationships(atg.commerce.order.Order pOrder)
Returns true if the order has more than one hardgood shipping group with commerce item relationships.

Parameters:
pOrder - Order to be checked
Returns:
boolean true if the order has more than one hardgood shipping group.

isMultipleNonGiftHardgoodItems

public boolean isMultipleNonGiftHardgoodItems(atg.commerce.order.Order pOrder)
Determines if the total quantity of all non-gift hardgood items is more than one.

Parameters:
pOrder - Order to be checked
Returns:
true if the the non-gift hg item quantity is more than one.

isAnyNonGiftHardgoodShippingGroups

public boolean isAnyNonGiftHardgoodShippingGroups(atg.commerce.order.Order pOrder)
Determines if there are any non-gift hardgood shipping groups with relationships.

Parameters:
pOrder - Order to be checked
Returns:
true if any non-gift hardgood shipping groups with relationships are found

getNonGiftHardgoodShippingGroups

public java.util.List getNonGiftHardgoodShippingGroups(atg.commerce.order.Order pOrder)
Returns the non-gift hardgood shipping groups with commerce item relationships.

Parameters:
pOrder - Order whose non-gift hard good shipping groups are to be retrieved
Returns:
a list of non-gift hardgood shipping groups with commerce item relationships

getFirstNonGiftHardgoodShippingGroupWithRels

public atg.commerce.order.HardgoodShippingGroup getFirstNonGiftHardgoodShippingGroupWithRels(atg.commerce.order.Order pOrder)
Returns the first non-gift hardgood shipping group with relationships from the order.

Parameters:
pOrder - Order whose non-gift hard good shipping groups is to be retrieved
Returns:
the first non-gift hardgood shipping group or null if there isn't one.

saveDefaultShippingMethod

public void saveDefaultShippingMethod(atg.repository.RepositoryItem pProfile,
                                      java.lang.String pShippingMethod)
Set the profile's default shipping method if it's not already set.

Parameters:
pProfile - - profile
pShippingMethod - - shipping method

copyShippingToBilling

public void copyShippingToBilling(atg.commerce.order.Order pOrder,
                                  atg.core.util.Address pAddress)
Copies the new shipping group address to the order's credit card payment group address.

Parameters:
pOrder - Order to copy the billing address to
pAddress - Address to copy as billing address

saveAddressToAddressBook

public void saveAddressToAddressBook(atg.core.util.Address pAddress,
                                     java.lang.String pNickName,
                                     atg.repository.RepositoryItem pProfile)
                              throws atg.commerce.CommerceException
Saves address to address book.

Parameters:
pAddress - - address Address to save
pNickName - - nickname - Nickname for the address being saved
Throws:
atg.commerce.CommerceException

getGiftShippingGroups

public java.util.List getGiftShippingGroups(atg.commerce.order.Order pOrder)
Returns a list of all shipping groups that contain gifts.

Parameters:
pOrder - Order whose shipping sroups are to be retrieved
Returns:
mGiftShippingGroups a lists of shipping groups for the order

runProcessValidateShippingGroups

protected atg.service.pipeline.PipelineResult runProcessValidateShippingGroups(atg.commerce.order.Order pOrder,
                                                                               atg.commerce.pricing.PricingModelHolder pPricingModels,
                                                                               java.util.Locale pLocale,
                                                                               atg.repository.RepositoryItem pProfile,
                                                                               java.util.Map pExtraParameters)
                                                                        throws atg.service.pipeline.RunProcessException
runProcessValidateShippingGroups runs a configurable Pipeline chain to validate ShippingGroups or prepare for the next checkout phase.

Parameters:
pOrder - an Order value
pPricingModels - a PricingModelHolder value
pLocale - a Locale value
pProfile - a RepositoryItem value
pExtraParameters - a Map value
Throws:
atg.service.pipeline.RunProcessException - if an error occurs

generateNewShipToAddressNickName

public java.lang.String generateNewShipToAddressNickName(atg.core.util.Address pAddress,
                                                         java.lang.String pNewShipToAddressName,
                                                         atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
Parameters:
pAddress - Address to be used as shipping address
pNewShipToAddressName - Address nickname to check
pShippingGroupMapContainer - Map containing all shipping groups for the profile
Returns:
new nickname if user left the nickname field empty.

initializeShippingMethod

public java.lang.String initializeShippingMethod(atg.repository.RepositoryItem pProfile,
                                                 atg.commerce.order.ShippingGroup pShippingGroup,
                                                 java.lang.String pDefaultShippingMethod)
Determines the shipping method in the following order of precendence: shipping group's shipping method, the profile's default shipping method, and the default configured shipping method.

Parameters:
pProfile - Shopper profile
pShippingGroup - shipping group for the order
pDefaultShippingMethod - the default configured shipping method
Returns:
shipping method being used for the shipping group

getUniqueHardgoodShippingGroups

public java.util.Collection getUniqueHardgoodShippingGroups(atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer,
                                                            atg.commerce.order.purchase.CommerceItemShippingInfoContainer pCommerceItemShippingInfoContainer)
Retrieve the collection of all hardgood shipping groups referenced by commerce item infos.

Parameters:
pShippingGroupMapContainer - map of all shipping groups for the profile
pCommerceItemShippingInfoContainer - map of all commerce item infos for the order
Returns:
collection of all hardgood shipping groups referenced by commerce item infos

getAllHardgoodCommerceItemShippingInfos

public java.util.List getAllHardgoodCommerceItemShippingInfos(atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer,
                                                              atg.commerce.order.purchase.CommerceItemShippingInfoContainer pCommerceItemShippingInfoContainer)
Get the List of all the CommerceItemShippingInfos for hardgoods from the CommerceItemShippingInfoMap. If a CommerceItemShippingInfo has no shipping group, assume the item represents hardgoods.

Parameters:
pShippingGroupMapContainer - map of all shipping groups for the profile
pCommerceItemShippingInfoContainer - map of all commerce item infos for the order
Returns:
a List value

setGiftWrapItemShippingGroupInfos

protected void setGiftWrapItemShippingGroupInfos(java.util.List pCommerceItemShippinGroupInfos)
This method is called when using multiple shipping groups. This method sets the shipping group name for all the gift wrap commerce item infos in the map.

Parameters:
pCommerceItemShippinGroupInfos - all the commerce item infos that will be applied to the order.

createShippingGroupFromDefaultAddress

public atg.commerce.order.HardgoodShippingGroup createShippingGroupFromDefaultAddress(atg.repository.RepositoryItem pProfile)
Creates a HardgoodShippingGroup from the profile's default shipping address item.

Parameters:
pProfile - - shopper profile
Returns:
hardgood shipping group

changeShippingGroupForCommerceItemShippingInfos

public void changeShippingGroupForCommerceItemShippingInfos(java.util.Collection pCommerceItemShippingInfos,
                                                            java.lang.String pShippingGroupName,
                                                            java.lang.String pShippingMethod)
Changes the shipping group name and shipping method for a collection of items in the CommerceItemShippingInfoContainer.

Parameters:
pCommerceItemShippingInfos - the colection of items to change
pShippingGroupName - if this is not null, each info item's shipping group name is set to this value
pShippingMethod - if this is not null, each info item's shipping method is set to this value.

addShippingAddress

public void addShippingAddress(atg.repository.RepositoryItem pProfile,
                               java.lang.String pNewShipToAddressName,
                               atg.core.util.Address pAddress,
                               atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer,
                               boolean pSaveShippingAddress)
                        throws atg.commerce.CommerceException
Creates a new shipping group and adds it to the shipping group map container. Optionally saves the shipping group address to the profile based on the saveShippingAddress option.

Parameters:
pAddress - Address to add
pNewShipToAddressName - Address nickname to use for the address being added
pProfile - shopper profile
pShippingGroupMapContainer - map of all shipping groups for the profile
Throws:
atg.commerce.CommerceException

modifyShippingAddress

public void modifyShippingAddress(java.lang.String pEditShippingAddressNickName,
                                  atg.core.util.Address pEditAddress,
                                  atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
Edits a shipping group address in the container and saves the changes to the profile if the address is in the profile's address map.

Parameters:
pEditShippingAddressNickName - Nickname for the address to be modified
pShippingGroupMapContainer - map of all shipping groups for the profile
pEditAddress - Address to be modified

modifyShippingAddressNickname

public void modifyShippingAddressNickname(atg.repository.RepositoryItem pProfile,
                                          java.lang.String pEditShippingAddressNickName,
                                          java.lang.String pShippingAddressNewNickName,
                                          atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
Modifies shipping address nickname.

Parameters:
pProfile - shopper profile
pEditShippingAddressNickName - Address Nickname to be modified
pShippingAddressNewNickName - New Address Nickname
pShippingGroupMapContainer - map of all shipping groups for the profile

modifyAddressBookNickname

public void modifyAddressBookNickname(atg.repository.RepositoryItem pProfile,
                                      java.lang.String pEditShippingAddressNickName,
                                      java.lang.String pShippingAddressNewNickName)
Modifies the address nick name is in the profile's map.

Parameters:
pProfile - shopper profile
pEditShippingAddressNickName - Address Nickname to be modified
pShippingAddressNewNickName - Address New Nickname

saveModifiedShippingAddressToProfile

public void saveModifiedShippingAddressToProfile(atg.repository.RepositoryItem pProfile,
                                                 java.lang.String pEditShippingAddressNickName,
                                                 atg.core.util.Address pEditAddress)
saveModifiedShippingAddress shipping address processing. If the address nick name is in the profile's map, the updates are applied to that address too.

Parameters:
pEditShippingAddressNickName - Nickname for the address to be modified
pProfile - shopper profile
pEditAddress - map of all shipping groups for the profile

applyShippingGroups

public void applyShippingGroups(atg.commerce.order.purchase.CommerceItemShippingInfoContainer pCommerceItemShippingInfoContainer,
                                atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer,
                                atg.commerce.order.Order pOrder)
                         throws atg.commerce.CommerceException
applyShippingGroups removes all non-gift ShippingGroups from the Order and then iterates over the supplied CommerceItemShippingInfos for each of the CommerceItems. Each CommerceItemShippingInfo is used to update the Order.

If property consolidateShippingInfosBeforeApply is true, the commerce item shipping info objects are first consolidated by calling the consolidateShippingInfos method.

Parameters:
pShippingGroupMapContainer - map of all shipping groups for the profile
pCommerceItemShippingInfoContainer - map of all commerce item infos for the order
pOrder - Order whose shipping groups are to be saved
Throws:
atg.commerce.CommerceException - if an error occurs

saveShippingInfo

protected void saveShippingInfo(atg.repository.RepositoryItem pProfile,
                                atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
Saves all addresses in the shipping group container's shipping group map.

The key is used as the nick name. The shipping group's address is used for the address.

Also sets the default shipping method on the profile

Parameters:
pProfile - shopper profile
pShippingGroupMapContainer - map of all shipping groups for the profile

validateShippingCity

public void validateShippingCity(atg.core.util.Address shippingAddress)
                          throws StorePurchaseProcessException
Validates the shipping city against a collection of regular expressions.

Parameters:
shippingAddress - shipping address to validate
Throws:
StorePurchaseProcessException - is an error occurs

validateShippingMethod

public void validateShippingMethod(atg.core.util.Address pAddress,
                                   java.lang.String pShippingMethod)
                            throws StorePurchaseProcessException
This method will ensure the user isn't trying to use a shipping method that isn't valid for the state. For example, Express shipping to Alaska is not allowed.

Parameters:
pAddress - address to validate against the shipping method
pShippingMethod - shipping method to validate address for
Throws:
StorePurchaseProcessException - if an error occurs

checkShippingRestrictions

public java.util.List checkShippingRestrictions(atg.commerce.order.purchase.CommerceItemShippingInfoContainer pCommerceItemShippingInfoContainer,
                                                atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
                                         throws atg.commerce.CommerceException
Check shipping restrictions.

Parameters:
pCommerceItemShippingInfoContainer - map of all commerce item infos for the order
pShippingGroupMapContainer - map of all shipping groups for the profile
Returns:
a list of pairs os products that are being shipped to restricted countries
Throws:
atg.commerce.CommerceException - if an error occurs

checkForInvalidStreetAddress

public java.util.List checkForInvalidStreetAddress(atg.core.util.ContactInfo pContactInfo)
Validates against invalid street addresses.

Parameters:
pContactInfo - contact information
Returns:
invalid street address patterns

trimmedString

public java.lang.String trimmedString(java.lang.String inStr)
Trim string.

Parameters:
inStr - - string to trim
Returns:
trimmed string

trimSpacesFromAddressValues

public atg.core.util.Address trimSpacesFromAddressValues(atg.core.util.Address pAddress)
                                                  throws javax.servlet.ServletException,
                                                         java.io.IOException
Trims spaces from address values.

Parameters:
pAddress - - Address whose values are to trimmed
Throws:
javax.servlet.ServletException
java.io.IOException