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.AbsoluteNameable, atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameContextParentable, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.Configured, 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

Version:
$Id: //hosting-blueprint/B2CBlueprint/version/10.2.1/EStore/src/atg/projects/store/order/purchase/StoreShippingProcessHelper.java#3 $$Change: 788983 $
Author:
ATG

Field Summary
static java.lang.String CLASS_VERSION
          Class version string.
static java.lang.String COUNTRY_DELIM
          Country delimiter.
static java.lang.String DISPLAY_NAME_PROPERTY_NAME
           
protected  StoreCatalogProperties mCatalogProperties
          property: catalogProperties.
protected  boolean mConsolidateShippingInfosBeforeApply
          property: consolidateShippingInfos
static java.lang.String MSG_DUPLICATE_NICKNAME
          Duplicate nickname message key.
static java.lang.String MSG_ERROR_CHANGING_SECONDARY_ADDRESS_NAME
           
static java.lang.String MSG_ERROR_COPING_ADDRESS
           
static java.lang.String MSG_ERROR_CREATING_SHIPPINGGROUP_FOR_DEFAULT_ADDRESS
          Error messages for logging
protected static java.lang.String MSG_ERROR_INCORRECT_STATE
          Error message for incorrect state
static java.lang.String MSG_ERROR_REMOVING_PROFILE_REPOSITORY_ADDRESS
           
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
          property: validateShippGroups
static java.lang.String NEW_ADDRESS
          New address constant.
protected static java.lang.String NICKNAME_SEPARATOR
           
static java.lang.String NON_SHIPPABLE_COUNTRIES_PROPERTY_NAME
           
static java.lang.String SHIPPABLE_COUNTRIES_PROPERTY_NAME
           
 
Fields inherited from class atg.projects.store.order.purchase.StorePurchaseProcessHelper
ADDRESS_PROP_NAME, CITY_PROP_NAME, COUNTRY_PROP_NAME, FIRST_NAME_PROP_NAME, LAST_NAME_PROP_NAME, MSG_MISSING_REQUIRED_ADDRESS_PROPERTY, MSG_MULTIPLE_COUPONS_PER_ORDER, MSG_UNCLAIMABLE_COUPON, POSTAL_CODE_PROP_NAME, PRICING_ERROR, PRICING_ERROR_ADDRESS, STATE_PROP_NAME
 
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_CHANGING_ITEM_QUANTITY, 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
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.
 atg.commerce.order.HardgoodShippingGroup createShippingGroupFromDefaultAddress(atg.repository.RepositoryItem pProfile)
          Creates a HardgoodShippingGroup from the profile's default shipping address item.
 void findOrAddShippingGroupByNickname(atg.repository.RepositoryItem pProfile, java.lang.String pNewShipToAddressName, atg.core.util.Address pAddress, atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer, boolean pSaveShippingAddress)
          Tries to find an appropriate hardgood shipping group within the shipping group map container specified.
 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.
 StoreCatalogProperties getCatalogProperties()
           
 atg.commerce.order.purchase.CommerceItemShippingInfoTools getCommerceItemShippingInfoTools()
          Returns the tools component containing the API for modifying CommerceItemShippingInfos.
protected  java.util.regex.Pattern[] getInvalidCityPatterns()
           
 java.util.Properties getInvalidStatesForShipMethod()
          Expects a pipe-delimited string containing 2-digit state abbreviations that are invalid for a particular shipping method.
 java.lang.String[] getInvalidStreetStrings()
           
 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 getUniqueShippingAddressNickname(atg.core.util.Address pAddress, atg.repository.RepositoryItem pProfile, atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer, java.lang.String pNewShipToAddressName)
          This method returns a unique address nickname.
 java.lang.String getValidateShippingGroupsChainId()
          Return the ValidateShippingGroupsChainId property.
 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 precedence: shipping group's shipping method, the profile's default shipping method, and the default configured shipping method.
 boolean isApplyDefaultShippingGroup()
          Return the ApplyDefaultShippingGroup property.
 boolean isConsolidateShippingInfosBeforeApply()
           This property is used to control is the CommerceItemShippingInfo objects are consolidated prior to being applied to the order.
 boolean isEmptyNewAddress(atg.core.util.ContactInfo pAddress)
          Checks whether new address is empty.
 boolean isValidateShippingGroups()
           
 boolean isValidateShippingRestriction()
           
 boolean isValidShippingState(atg.core.util.ContactInfo pShippingAddress)
          Determine if the given shipping address contains valid state for the shipping.
 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.
 void modifyShippingAddressNickname(atg.repository.RepositoryItem pProfile, java.lang.String pEditShippingAddressNickName, java.lang.String pShippingAddressNewNickName, atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
          Modifies shipping address nickname.
 void removeShippingAddress(atg.repository.RepositoryItem pProfile, java.lang.String pRemoveShippingAddressNickName, atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
          Removes a shipping group from the container.
 void removeShippingAddressFromProfile(atg.repository.RepositoryItem pProfile, java.lang.String pRemoveShippingAddressNickName)
          If the shipping address nickname is in the profile's addresses map, remove it from the profile.
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.
 void setApplyDefaultShippingGroup(boolean pApplyDefaultShippingGroup)
          Set the ApplyDefaultShippingGroup property.
 void setCatalogProperties(StoreCatalogProperties pCatalogProperties)
           
 void setCommerceItemShippingInfoTools(atg.commerce.order.purchase.CommerceItemShippingInfoTools pCommerceItemShippingInfoTools)
           
 void setConsolidateShippingInfosBeforeApply(boolean pConsolidateShippingInfosBeforeApply)
           Sets the consolidateShippingInfosBeforeApply property.
 void setGiftWrapItemShippingGroupInfos(java.util.List pCommerceItemShippingInfos)
          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-delimited string containing 2-digit state abbreviations that are invalid for a particular shipping method.
 void setInvalidStreetStrings(java.lang.String[] pInvalidStreetStrings)
           
 void setValidateShippingGroups(boolean pValidateShippingGroups)
           
 void setValidateShippingGroupsChainId(java.lang.String pValidateShippingGroupsChainId)
          Set the ValidateShippingGroupsChainId property.
 void setValidateShippingRestriction(boolean pValidateShippingRestriction)
           
 java.util.List<java.lang.String> splitShippingGroupsByMethod(atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer, java.util.List pAllHardgoodCommerceItemShippingInfos)
          Loops through all CommerceItemShippingInfos and finds items that have the same shipping address but different shipping methods then creates separate shipping groups for them.
 java.lang.String trimmedString(java.lang.String pInStr)
          Trim string.
 atg.core.util.Address trimSpacesFromAddressValues(atg.core.util.Address pAddress)
          Trims spaces from address values.
 void validateShippingCity(atg.core.util.Address pShippingAddress)
          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
checkForRequiredAddressProperties, claimCoupon, claimCoupon, getAddressPropertyNameMap, getClaimableManager, getMandatoryStateCountryList, getPlaceUtils, getPricingTools, getRequiredAddressPropertyNames, getStoreConfiguration, getStoreOrderTools, removeCoupon, removeCoupon, repriceOrder, setAddressPropertyNameMap, setClaimableManager, setPlaceUtils, setPricingTools, setRequiredAddressPropertyNames, setStoreConfiguration, setStoreOrderTools, tenderCoupon
 
Methods inherited from class atg.commerce.order.purchase.PurchaseProcessHelper
addCreditCardToOrder, addItemsToOrder, addItemsToOrder, addItemToOrder, addItemToShippingGroup, addShippingAddressToOrder, adjustItemRelationshipsForQuantityChange, adjustNonGiftHandlingInstructionsForQuantityDecrease, adjustNonGiftHandlingInstructionsForQuantityIncrease, applyValueDictionary, changeItemQuantity, copyCreditCardInfo, createCommerceItem, createConfigurableSubitems, createOrder, decreaseRelationshipQuantity, deleteItem, deleteItems, deleteItems, getAddItemToOrderChainId, getAddItemToOrderPricingOp, getCommerceItemManager, getDefaultHardgoodShippingGroupType, getDeleteItemsFromOrderPricingOp, getFirstShippingGroup, getGiftlistManager, getOrderManager, getPipelineManager, getRepriceOrderChainId, getShippingGroupForItem, getShippingGroupManager, getTransactionManager, increaseRelationshipQuantity, isAddItemToDefaultShippingGroup, isTransactionMarkedAsRollBack, moveItemBetweenShippingGroups, postAddItemsToOrder, postDeleteItem, postDeleteItem, processGiftAddition, processPipelineErrors, removeEntireRelationshipQuantity, removeItemQuantityFromShippingGroup, runProcess, runProcess, runProcess, runProcessAddItemToOrder, runProcessRepriceOrder, runProcessSendScenarioEvent, 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, 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
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

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

See Also:
Constant Field Values

NON_SHIPPABLE_COUNTRIES_PROPERTY_NAME

public static final java.lang.String NON_SHIPPABLE_COUNTRIES_PROPERTY_NAME
See Also:
Constant Field Values

SHIPPABLE_COUNTRIES_PROPERTY_NAME

public static final java.lang.String SHIPPABLE_COUNTRIES_PROPERTY_NAME
See Also:
Constant Field Values

DISPLAY_NAME_PROPERTY_NAME

public static final java.lang.String DISPLAY_NAME_PROPERTY_NAME
See Also:
Constant Field Values

NICKNAME_SEPARATOR

protected static final java.lang.String NICKNAME_SEPARATOR
See Also:
Constant Field Values

NEW_ADDRESS

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

See Also:
Constant Field Values

COUNTRY_DELIM

public static final java.lang.String COUNTRY_DELIM
Country delimiter.

See Also:
Constant Field Values

MSG_INVALID_STATE_FOR_METHOD

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

See Also:
Constant Field Values

MSG_ERROR_INCORRECT_STATE

protected static final java.lang.String MSG_ERROR_INCORRECT_STATE
Error message for incorrect state

See Also:
Constant Field Values

MSG_RESTRICTED_SHIPPING

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

See Also:
Constant Field Values

MSG_DUPLICATE_NICKNAME

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

See Also:
Constant Field Values

MSG_INVALID_CITY_ADDRESS

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

See Also:
Constant Field Values

MSG_INVALID_STREET_ADDRESS

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

See Also:
Constant Field Values

MSG_ERROR_UPDATE_SHIPPINGGROUP

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

See Also:
Constant Field Values

MSG_ERROR_CREATING_SHIPPINGGROUP_FOR_DEFAULT_ADDRESS

public static final java.lang.String MSG_ERROR_CREATING_SHIPPINGGROUP_FOR_DEFAULT_ADDRESS
Error messages for logging

See Also:
Constant Field Values

MSG_ERROR_CHANGING_SECONDARY_ADDRESS_NAME

public static final java.lang.String MSG_ERROR_CHANGING_SECONDARY_ADDRESS_NAME
See Also:
Constant Field Values

MSG_ERROR_REMOVING_PROFILE_REPOSITORY_ADDRESS

public static final java.lang.String MSG_ERROR_REMOVING_PROFILE_REPOSITORY_ADDRESS
See Also:
Constant Field Values

MSG_ERROR_COPING_ADDRESS

public static final java.lang.String MSG_ERROR_COPING_ADDRESS
See Also:
Constant Field Values

mValidateShippingGroups

protected boolean mValidateShippingGroups
property: validateShippGroups


mConsolidateShippingInfosBeforeApply

protected boolean mConsolidateShippingInfosBeforeApply
property: consolidateShippingInfos


mCatalogProperties

protected StoreCatalogProperties mCatalogProperties
property: catalogProperties.

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)
Parameters:
pCommerceItemShippingInfoTools - the Commerce Item Shipping Info Tools to set.

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-delimited 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-delimited 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.

isValidateShippingRestriction

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

setValidateShippingRestriction

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

setValidateShippingGroups

public void setValidateShippingGroups(boolean pValidateShippingGroups)
Parameters:
pValidateShippingGroups - - flag indicating if the shipping groups should be validated after being applied to the order. The default setting is true.

isValidateShippingGroups

public boolean isValidateShippingGroups()
Returns:
flag indicating if the shipping groups should be validated after being applied to the order. The default setting is true.

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()

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

Returns:
the consolidateShippingInfosBeforeApply flag.

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.

setCatalogProperties

public void setCatalogProperties(StoreCatalogProperties pCatalogProperties)
Parameters:
pCatalogProperties - - the catalog properties.

getCatalogProperties

public StoreCatalogProperties getCatalogProperties()
Returns:
the catalog properties.

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 to update.
pShippingMethod - - shipping method.

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.
pProfile - - the profile.
Throws:
atg.commerce.CommerceException - indicates that a severe error occurred while performing a commerce operation.

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.
Returns:
a PipelineResult value.
Throws:
atg.service.pipeline.RunProcessException - if an error occurs.

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 precedence: 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

public void setGiftWrapItemShippingGroupInfos(java.util.List pCommerceItemShippingInfos)
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:
pCommerceItemShippingInfos - - 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 collection 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.

findOrAddShippingGroupByNickname

public void findOrAddShippingGroupByNickname(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,
                                             java.beans.IntrospectionException
Tries to find an appropriate hardgood shipping group within the shipping group map container specified. Shipping group is good enough if it has the same shipping address as the address specified or if it has empty address and the same name as shipping group that should be added. If such shipping group can't be found, this method will create a new one.

Parameters:
pProfile - - current user's profile.
pNewShipToAddressName - - nickname for the new shipping group.
pAddress - - address to be used.
pShippingGroupMapContainer - - an instance of ShippingGroupContainerService.
pSaveShippingAddress - - true if this address should be saved into profile specified.
Throws:
atg.commerce.CommerceException - if something goes wrong.
java.beans.IntrospectionException - if something goes wrong.

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.
pSaveShippingAddress - - true if this address should be saved into profile specified.
Throws:
atg.commerce.CommerceException - indicates that a severe error occurred while performing a commerce operation.

getUniqueShippingAddressNickname

public java.lang.String getUniqueShippingAddressNickname(atg.core.util.Address pAddress,
                                                         atg.repository.RepositoryItem pProfile,
                                                         atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer,
                                                         java.lang.String pNewShipToAddressName)
This method returns a unique address nickname. The method checks for existing nicknames in the profile and shipping group map container. If the specified nickname already exists, the "##{number}" suffix is added to the nickname to qualify the unique string where {number} is some number. If no new nickname is passed to the method, it uses default address prefix.

Parameters:
pAddress - - shipping address.
pProfile - - shopper profile.
pShippingGroupMapContainer - - map of all shipping groups for the profile.
pNewShipToAddressName - - Address nickname to use for the address being added.
Returns:
unique nickname for shipping address.

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.

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 - - Address to be modified.

removeShippingAddress

public void removeShippingAddress(atg.repository.RepositoryItem pProfile,
                                  java.lang.String pRemoveShippingAddressNickName,
                                  atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
Removes a shipping group from the container.

Parameters:
pRemoveShippingAddressNickName - - Nickname for the address to be removed.
pShippingGroupMapContainer - - map of all shipping groups for the profile.
pProfile - - the profile.

removeShippingAddressFromProfile

public void removeShippingAddressFromProfile(atg.repository.RepositoryItem pProfile,
                                             java.lang.String pRemoveShippingAddressNickName)
If the shipping address nickname is in the profile's addresses map, remove it from the profile.

Parameters:
pProfile - - shopper profile.
pRemoveShippingAddressNickName - - Nickname for the address to be removed.

splitShippingGroupsByMethod

public java.util.List<java.lang.String> splitShippingGroupsByMethod(atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer,
                                                                    java.util.List pAllHardgoodCommerceItemShippingInfos)
                                                             throws atg.commerce.CommerceException
Loops through all CommerceItemShippingInfos and finds items that have the same shipping address but different shipping methods then creates separate shipping groups for them. As a result all shipping groups that are referenced in CommerceItemShippingInfos will have only one shipping method associated with them.

Parameters:
pRequest - a DynamoHttpServletRequest value.
pResponse - a DynamoHttpServletResponse value.
Returns:
List of shippingGroupMap ids that were created.
Throws:
atg.commerce.CommerceException - indicates that a severe error occurred while performing a commerce operation.

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.

validateShippingCity

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

Parameters:
pShippingAddress - 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 of 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 pInStr)
Trim string.

Parameters:
pInStr - - 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.
Returns:
the address.
Throws:
javax.servlet.ServletException - if there was an error while executing the code.
java.io.IOException - if there was an error with servlet io.

isValidShippingState

public boolean isValidShippingState(atg.core.util.ContactInfo pShippingAddress)
Determine if the given shipping address contains valid state for the shipping.

Parameters:
pShippingAddress - - shipping address contact info.
Returns:
true if shipping state in the list of allowed places.

isEmptyNewAddress

public boolean isEmptyNewAddress(atg.core.util.ContactInfo pAddress)
Checks whether new address is empty.

Parameters:
pAddress - address to check.
Returns:
true if address is empty, otherwise false.