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.
static java.lang.String DISPLAY_NAME_PROPERTY_NAME
           
protected  boolean mConsolidateShippingInfosBeforeApply
           
static java.lang.String MSG_DUPLICATE_NICKNAME
          Duplicate nickname message key.
protected static java.lang.String MSG_ERROR_INCORRECT_STATE
          Error message for incorrect state
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.
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.
 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 findOrAddShippingAddress(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.
 atg.commerce.order.purchase.CommerceItemShippingInfoTools getCommerceItemShippingInfoTools()
          Returns the tools component containing the API for modifying CommerceItemShippingInfos
 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 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 precendence: shipping group's shipping method, the profile's default shipping method, and the default configured shipping method.
 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 isEmptyNewAddress(atg.core.util.ContactInfo pAddress)
          Checks whether new address is empty.
 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()
           
 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 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.
 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 removes 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.
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)
           
 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.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

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

isValidateShippingRestriction

public boolean isValidateShippingRestriction()
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

Parameters:
pValidateShippingGroups - the value to set

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

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.

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

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

findOrAddShippingAddress

public java.lang.String findOrAddShippingAddress(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
Returns:
shipping group name if found and null if new shipping group has been created
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 occured 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 already existed nicknames in 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 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

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 removes 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 occured 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

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 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 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 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, false otherwise