atg.projects.store.order.purchase
Class StoreBillingProcessHelper

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.StoreBillingProcessHelper
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 StoreBillingProcessHelper
extends StorePurchaseProcessHelper

Store implementation of the purchase process helper for billing sub-process.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string.
protected static java.lang.String GC_NO_AMOUNT_REMAINING
          No amount remaining message key.
protected static java.lang.String GC_NOT_FOUND
          Gift certificate not found message key.
protected static java.lang.String GC_PAYMENT_GROUP_TYPE_NAME
          Gift certificate payment group type name.
protected static java.lang.String GIFT_CERTIFICATE_ERROR
          Gift Certificate payment group error message key.
protected static java.lang.String MSG_DUPLICATE_CC_NICKNAME
          Duplicate CC nickname message key.
protected static java.lang.String MSG_DUPLICATE_USER
          Dublicate user message key.
protected static java.lang.String MSG_EMAIL_IS_EMPTY
          E-mail is empty message key.
protected static java.lang.String MSG_MISSING_REQUIRED_ADDRESS_PROPERTY
          Missing required address property.
protected static java.lang.String MSG_NICKNAME_WRONG_LENGTH
          Wrong nickname length message key.
protected static java.lang.String MSG_PASSWORD_IS_EMPTY
          Password is empty message key.
protected static java.lang.String MSG_PASSWORD_WRONG_LENGTH
          Password wrong length message key.
protected static java.lang.String MSG_PASSWORDS_DONT_MATCH
          Password don't match message key.
protected static java.lang.String NEW_ADDRESS
          New address constant.
protected static java.lang.String NEW_CREDIT_CARD
          New credit card constant.
protected static java.lang.String ONLINE_CREDIT_INSUFFICIENT
          Online credit insufficient.
protected static java.lang.String SC_PAYMENT_GROUP_TYPE_NAME
          Store Credit payment group type name.
protected static java.lang.String STORE_CREDIT_ERROR
          Store credit payment group error message key.
protected static java.lang.String VERIFICATION_NUMBER_INVALID
          Invalid verification number message key.
 
Fields inherited from class atg.projects.store.order.purchase.StorePurchaseProcessHelper
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
StoreBillingProcessHelper()
           
 
Method Summary
protected  void addBillingAddressToCard(atg.commerce.order.CreditCard pCard, boolean pUsingStoredAddress, java.lang.String pStoredAddressSelection, atg.repository.RepositoryItem pProfile, atg.commerce.order.Order pOrder)
          This method checks to see if the user chose a profile address.
 void addCreditCardAuthorizationNumber(atg.commerce.order.Order pOrder, java.lang.String pCreditCardVerificationNumber)
          Add Credit Card Verification Number to the CreditCard Paymanet Group.
 void addCreditCardDetails(atg.commerce.order.CreditCard pCreditCard, boolean pUsingStoredCreditCard, java.lang.String pStoredCreditCardName, atg.repository.RepositoryItem pProfile, java.util.Locale pUserLocale)
          Copy credit card from profile to order if paying with profile credit card.
 double addGiftCertificatePaymentGroupsForOrder(atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pProfile, java.lang.String[] pGiftCertificateNumbers)
           
 void addOrder(atg.commerce.order.Order pOrder)
          Add the Order into the Repository if it is transient
 void addOrderAmountRemainingToCreditPaymentGroup(atg.commerce.order.Order pOrder)
          Added Remaining Order Amount relationship To Credit Card PaymentGroup.
 void addOrderAmountRemainingToOtherPaymentGroups(atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pProfile, double pOrderAmountRemaining)
          Add Order Remaining Amount to Gift Certificate Payment Group, if still
protected  void addUserToOptInList(atg.userprofiling.Profile pProfile, java.lang.String pEmailOptInSourceCode)
          Adds user to email opt-in list.
protected  void copyCreditCardFromProfile(atg.commerce.order.CreditCard pCreditCard, java.lang.String pNickname, atg.repository.RepositoryItem pProfile, java.util.Locale pUserLocale)
          Utility method to copy credit card from profile to order.
 CheckoutOptionSelections getCheckoutOptionSelections()
           
 atg.commerce.order.CreditCard getCreditCard(atg.commerce.order.Order pOrder)
          Utility method to fetch credit card and set properties from page.
protected  java.lang.String[] getGiftCertificateNumbersList(java.lang.String pGiftCertificateString)
          Tokenize this list into the various tokens, where each token could be a gift certificate claim code.
 double getGiftCertificateUsableAmount(java.lang.String pGiftCertificateNumber)
          Return balance amount of gift certificate
 java.lang.String[] getOrderGiftCertificateNumbers(atg.commerce.order.Order pOrder)
          Get used giftcetificate numbers from the order
 double getOrderRemaningAmount(atg.commerce.order.Order pOrder)
          Get the remaning Amount from the order.
 atg.commerce.order.PaymentGroupManager getPaymentGroupManager()
          Return the PaymentGroupManager property.
protected  java.util.ResourceBundle getResourceBundle()
          Returns the error message ResourceBundle
protected  java.lang.String getResourceBundleName()
          Returns the name of the error message ResourceBundle
 atg.commerce.order.GiftCertificate[] initializeGiftCertificatePaymentGroups(java.lang.String[] pGiftCertificateNumbers, atg.repository.RepositoryItem pProfile)
          Initialized the Gift Certificate PaymentGroup
protected  boolean initializePaymentGroups(atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pProfile, java.lang.String[] pOnlineCreditIds)
          Initializes the store credit payment method(s) based on the store credits the user chose.
protected  boolean isCreditCardEmpty(atg.commerce.order.CreditCard pCreditCard)
          Deprecated. this method has been moved to CommerceProfileTools
protected  boolean isNewCreditCards(atg.commerce.order.Order pOrder)
           
protected  boolean isPayingWithOnlineCredit(java.lang.String[] pOnlineCreditIds)
          Checks to see if user is paying with a stored credit card.
 boolean isPaymentGroupOrderRelationShipExist(atg.commerce.order.PaymentGroup pPaymentGroup)
          Verify, whether Order Relationship exist in the given Payment Group or not.
 boolean isValidNickNameLength(java.lang.String pNickName, int pMinNickNameLength, int pMaxNickNameLength)
          Utility method to check if user's NickName meets the min & max length.
protected  double mergePaymentGroupsToOrder(double pOrderAmountRemaining, atg.commerce.order.Order pOrder, atg.commerce.order.GiftCertificate[] pGiftCertificatePaymentGroups)
          Check two lists of payment groups: giftCertificatePaymentGroups and creditCardPaymentGroups.
protected  void registerNewUserDuringCheckout(atg.commerce.order.Order pOrder, atg.userprofiling.Profile pProfile, java.lang.String pPassword)
          This method will register a new user during checkout.
 void removeAllGiftCertificatePaymentGroups(atg.commerce.order.Order pOrder)
          Remove all gift certificates payment group from the order.
protected  void removeStoreCreditPaymentGroups(atg.commerce.order.Order pOrder)
          Remove any store credit payment groups from order
protected  atg.service.pipeline.PipelineResult runProcessMoveToConfirmation(atg.commerce.order.Order pOrder, atg.commerce.pricing.PricingModelHolder pPricingModels, java.lang.String pMoveToConfirmationChainId, java.util.Locale pLocale, atg.repository.RepositoryItem pProfile, java.util.Map pExtraParameters)
          Run the pipeline which should be executed at the last of the billing process.
 void saveBillingAddressToProfile(atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pProfile, java.lang.String pBillingAddressNickname)
          This method saves the Billing Address to the profile.
 void saveCreditCardToProfile(atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pProfile, java.lang.String pCreditCardNickName)
          This method saves the credit card from the payment group to the profile.
protected  void saveDefaultBillingAddress(atg.repository.RepositoryItem pProfile, atg.commerce.order.CreditCard pCreditCard)
          Saves the address on the credit card to the user's default billing address.
 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 setCheckoutOptionSelections(CheckoutOptionSelections pCheckoutOptionSelections)
           
 void setPaymentGroupManager(atg.commerce.order.PaymentGroupManager pPaymentGroupManager)
          Set the PaymentGroupManager property.
protected  double setPaymentMethodsInOrder(atg.commerce.order.Order pOrder, double pOrderAmountRemaining, atg.repository.RepositoryItem pProfile, atg.commerce.order.GiftCertificate[] pGiftCertificatePaymentGroups)
          Method that deals with setting the payment methods that are to be used in an order.
protected  void setProfileEmailAndLogin(atg.repository.RepositoryItem pProfile, java.lang.String pEmail)
          Set the EmailId and LoginId into the profile repository
protected  void setProfilePassword(atg.repository.RepositoryItem pProfile, java.lang.String pNewUserPassword)
          Set the password and LoginId into the profile repository
 boolean setupCreditCardPaymentGroupsForOrder(atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pProfile, boolean pUsingStoredCreditCard, java.lang.String pStoredCreditCardName, java.util.Locale pUserLocale)
           
 void setupGiftCertificatePaymentGroupsForOrder(atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pProfile, java.lang.String pGiftCertificateNumbers)
          This method will parse a string and attempt to create giftCertificatePaymentGroups out of the tokens of the string.
 void setupStoreCreditPaymentGroupsForOrder(atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pProfile, java.lang.String[] pOnlineCreditIds)
          Intialize Store Credit Payment Group, add amount to the payment group and add remaning amount to other payment groups @i.e GiftCertificate and CreditCard
 java.lang.String[] sortGiftCertificateNumbersByAmount(java.lang.String[] pGiftCertificateNumbers, atg.repository.RepositoryItem pProfile)
          This mehtod sort's the GiftCertificate Numbers by its amount.
 boolean validateCreditCardAuthorizationNumber(java.lang.String pCreditCardVerificationNumber)
          Verify the Credit Card verification number
 boolean validateCreditCardNicknameInput(atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pProfile, java.lang.String pCreditCardNickname, int pMinNickNameLength, int pMaxNickNameLength)
          This method validates the credit card nickname if one is required.
protected  boolean validateEmailAddress(atg.repository.RepositoryItem pProfile, java.lang.String pEmail)
          Utility method to validate email address.
protected  boolean validatePassword(atg.repository.RepositoryItem pProfile, java.lang.String pNewUserPassword, java.lang.String pRetypeNewPassword)
          Utility method to validate password input.
protected  double validateSufficientOnlineCredit(java.lang.String[] pOnlineCreditIds, atg.commerce.order.Order pOrder)
          This method verifies if the online credit(s) total is sufficient to cover the orde total.
 
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 final java.lang.String CLASS_VERSION
Class version string.

See Also:
Constant Field Values

MSG_MISSING_REQUIRED_ADDRESS_PROPERTY

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

See Also:
Constant Field Values

MSG_DUPLICATE_USER

protected static final java.lang.String MSG_DUPLICATE_USER
Dublicate user message key.

See Also:
Constant Field Values

MSG_EMAIL_IS_EMPTY

protected static final java.lang.String MSG_EMAIL_IS_EMPTY
E-mail is empty message key.

See Also:
Constant Field Values

MSG_PASSWORDS_DONT_MATCH

protected static final java.lang.String MSG_PASSWORDS_DONT_MATCH
Password don't match message key.

See Also:
Constant Field Values

MSG_PASSWORD_IS_EMPTY

protected static final java.lang.String MSG_PASSWORD_IS_EMPTY
Password is empty message key.

See Also:
Constant Field Values

MSG_PASSWORD_WRONG_LENGTH

protected static final java.lang.String MSG_PASSWORD_WRONG_LENGTH
Password wrong length message key.

See Also:
Constant Field Values

MSG_NICKNAME_WRONG_LENGTH

protected static final java.lang.String MSG_NICKNAME_WRONG_LENGTH
Wrong nickname length message key.

See Also:
Constant Field Values

MSG_DUPLICATE_CC_NICKNAME

protected static final java.lang.String MSG_DUPLICATE_CC_NICKNAME
Duplicate CC nickname message key.

See Also:
Constant Field Values

GC_PAYMENT_GROUP_TYPE_NAME

protected static final java.lang.String GC_PAYMENT_GROUP_TYPE_NAME
Gift certificate payment group type name.

See Also:
Constant Field Values

SC_PAYMENT_GROUP_TYPE_NAME

protected static final java.lang.String SC_PAYMENT_GROUP_TYPE_NAME
Store Credit payment group type name.

See Also:
Constant Field Values

GC_NOT_FOUND

protected static final java.lang.String GC_NOT_FOUND
Gift certificate not found message key.

See Also:
Constant Field Values

GC_NO_AMOUNT_REMAINING

protected static final java.lang.String GC_NO_AMOUNT_REMAINING
No amount remaining message key.

See Also:
Constant Field Values

ONLINE_CREDIT_INSUFFICIENT

protected static final java.lang.String ONLINE_CREDIT_INSUFFICIENT
Online credit insufficient.

See Also:
Constant Field Values

STORE_CREDIT_ERROR

protected static final java.lang.String STORE_CREDIT_ERROR
Store credit payment group error message key.

See Also:
Constant Field Values

GIFT_CERTIFICATE_ERROR

protected static final java.lang.String GIFT_CERTIFICATE_ERROR
Gift Certificate payment group error message key.

See Also:
Constant Field Values

VERIFICATION_NUMBER_INVALID

protected static final java.lang.String VERIFICATION_NUMBER_INVALID
Invalid verification number message key.

See Also:
Constant Field Values

NEW_ADDRESS

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

See Also:
Constant Field Values

NEW_CREDIT_CARD

protected static final java.lang.String NEW_CREDIT_CARD
New credit card constant.

See Also:
Constant Field Values
Constructor Detail

StoreBillingProcessHelper

public StoreBillingProcessHelper()
Method Detail

setPaymentGroupManager

public void setPaymentGroupManager(atg.commerce.order.PaymentGroupManager pPaymentGroupManager)
Set the PaymentGroupManager property.

Parameters:
pPaymentGroupManager - a PaymentGroupManager value

getPaymentGroupManager

public atg.commerce.order.PaymentGroupManager getPaymentGroupManager()
Return the PaymentGroupManager property.

Returns:
a PaymentGroupManager value

getCheckoutOptionSelections

public CheckoutOptionSelections getCheckoutOptionSelections()
Returns:
the CheckoutOptionSelections component.

setCheckoutOptionSelections

public void setCheckoutOptionSelections(CheckoutOptionSelections pCheckoutOptionSelections)
Parameters:
pCheckoutOptionSelections - the CheckoutOptionSelections component to set.

getResourceBundle

protected java.util.ResourceBundle getResourceBundle()
Returns the error message ResourceBundle


getResourceBundleName

protected java.lang.String getResourceBundleName()
Returns the name of the error message ResourceBundle


isPayingWithOnlineCredit

protected boolean isPayingWithOnlineCredit(java.lang.String[] pOnlineCreditIds)
Checks to see if user is paying with a stored credit card.

Returns:
true if success, false - otherwise

saveCreditCardToProfile

public void saveCreditCardToProfile(atg.commerce.order.Order pOrder,
                                    atg.repository.RepositoryItem pProfile,
                                    java.lang.String pCreditCardNickName)
This method saves the credit card from the payment group to the profile. And Save credit card as profile default if it is

Parameters:
pOrder -
pProfile -
pCreditCardNickName -

saveBillingAddressToProfile

public void saveBillingAddressToProfile(atg.commerce.order.Order pOrder,
                                        atg.repository.RepositoryItem pProfile,
                                        java.lang.String pBillingAddressNickname)
This method saves the Billing Address to the profile.

Parameters:
pOrder -
pProfile -
pBillingAddressNickname -

registerNewUserDuringCheckout

protected void registerNewUserDuringCheckout(atg.commerce.order.Order pOrder,
                                             atg.userprofiling.Profile pProfile,
                                             java.lang.String pPassword)
                                      throws atg.commerce.CommerceException
This method will register a new user during checkout.

Parameters:
pOrder -
pProfile -
pPassword -
Throws:
atg.commerce.CommerceException

addUserToOptInList

protected void addUserToOptInList(atg.userprofiling.Profile pProfile,
                                  java.lang.String pEmailOptInSourceCode)
Adds user to email opt-in list.

Parameters:
pProfile -
pEmailOptInSourceCode -

saveDefaultBillingAddress

protected void saveDefaultBillingAddress(atg.repository.RepositoryItem pProfile,
                                         atg.commerce.order.CreditCard pCreditCard)
Saves the address on the credit card to the user's default billing address.

Parameters:
pProfile -
pCreditCard -

addBillingAddressToCard

protected void addBillingAddressToCard(atg.commerce.order.CreditCard pCard,
                                       boolean pUsingStoredAddress,
                                       java.lang.String pStoredAddressSelection,
                                       atg.repository.RepositoryItem pProfile,
                                       atg.commerce.order.Order pOrder)
                                throws atg.commerce.CommerceException
This method checks to see if the user chose a profile address. If so, the address is copied from the address book to the credit card.

Parameters:
pCard -
pStoredAddressSelection -
pProfile -
pOrder -
Throws:
atg.commerce.CommerceException

copyCreditCardFromProfile

protected void copyCreditCardFromProfile(atg.commerce.order.CreditCard pCreditCard,
                                         java.lang.String pNickname,
                                         atg.repository.RepositoryItem pProfile,
                                         java.util.Locale pUserLocale)
Utility method to copy credit card from profile to order.

Parameters:
pCreditCard - - Instance of Credit Card Payment Group
pNickname - - nickname profile stored credit card nick name
pProfile - - Instance of Profile Repository
pUserLocale - - Locale

validateSufficientOnlineCredit

protected double validateSufficientOnlineCredit(java.lang.String[] pOnlineCreditIds,
                                                atg.commerce.order.Order pOrder)
This method verifies if the online credit(s) total is sufficient to cover the orde total. Note the need to calculate the true amount remaining by subtracting the amount authorized. The uncovered amount of the order total is returned

Returns:
true if success, false - otherwise

setPaymentMethodsInOrder

protected double setPaymentMethodsInOrder(atg.commerce.order.Order pOrder,
                                          double pOrderAmountRemaining,
                                          atg.repository.RepositoryItem pProfile,
                                          atg.commerce.order.GiftCertificate[] pGiftCertificatePaymentGroups)
                                   throws atg.commerce.CommerceException,
                                          atg.repository.RepositoryException,
                                          java.io.IOException,
                                          javax.servlet.ServletException
Method that deals with setting the payment methods that are to be used in an order. The steps that are done to perform this are:

Parameters:
pOrderAmountRemaining - - remaining order amount
Returns:
remaining order amount
Throws:
java.io.IOException - if IO error occurs
javax.servlet.ServletException - if servlet error occurs
atg.commerce.CommerceException - if commerce error occurs
atg.repository.RepositoryException

removeAllGiftCertificatePaymentGroups

public void removeAllGiftCertificatePaymentGroups(atg.commerce.order.Order pOrder)
                                           throws atg.commerce.CommerceException
Remove all gift certificates payment group from the order.

Parameters:
pOrder -
Throws:
atg.commerce.CommerceException - if commerce error occurs

getOrderRemaningAmount

public double getOrderRemaningAmount(atg.commerce.order.Order pOrder)
                              throws atg.commerce.CommerceException
Get the remaning Amount from the order.

Throws:
atg.commerce.CommerceException - if commerce error occurs

getOrderGiftCertificateNumbers

public java.lang.String[] getOrderGiftCertificateNumbers(atg.commerce.order.Order pOrder)
Get used giftcetificate numbers from the order

Parameters:
pOrder -
Returns:
String[] - returns the array of GiftCetificate Numbers

initializeGiftCertificatePaymentGroups

public atg.commerce.order.GiftCertificate[] initializeGiftCertificatePaymentGroups(java.lang.String[] pGiftCertificateNumbers,
                                                                                   atg.repository.RepositoryItem pProfile)
                                                                            throws atg.commerce.CommerceException,
                                                                                   javax.servlet.ServletException
Initialized the Gift Certificate PaymentGroup

Parameters:
pGiftCertificateNumbers -
pProfile -
Returns:
-returns the array of initialized GiftCertificate PaymentGroups
Throws:
atg.commerce.CommerceException - - if servlet error occurs
javax.servlet.ServletException - - if servlet error occurs

mergePaymentGroupsToOrder

protected double mergePaymentGroupsToOrder(double pOrderAmountRemaining,
                                           atg.commerce.order.Order pOrder,
                                           atg.commerce.order.GiftCertificate[] pGiftCertificatePaymentGroups)
                                    throws atg.commerce.CommerceException,
                                           atg.repository.RepositoryException,
                                           javax.servlet.ServletException,
                                           java.io.IOException
Check two lists of payment groups: giftCertificatePaymentGroups and creditCardPaymentGroups. Each paymentGroup that exists in these lists is added to the Order's list of paymentGroups. Gift certificates are prepended to the Order's list of payment methods. CreditCards are appended onto the list of payment groups. This ensures that giftCertificates are used before creditCards.

Parameters:
pOrderAmountRemaining - - remaining order amount
Returns:
remaining order amount
Throws:
java.io.IOException - if io error occurs
javax.servlet.ServletException - if servlet error occurs
atg.commerce.CommerceException - if commerce error occurs
atg.repository.RepositoryException

isNewCreditCards

protected boolean isNewCreditCards(atg.commerce.order.Order pOrder)
Returns:
true if credit cards are new, false - otherwise.

isCreditCardEmpty

protected boolean isCreditCardEmpty(atg.commerce.order.CreditCard pCreditCard)
Deprecated. this method has been moved to CommerceProfileTools

Checks to see if a CreditCard object is empty. Empty means that certain necessary fields are missing. The properties that it checks for are those specified by the creditCardProperties String array.

This behavior can be overriden by making additions to the String array creditCardProperties, or if necessary extending this method.

Parameters:
pCreditCard - a value of type 'CreditCard'
Returns:
true if the payment group is empty.

removeStoreCreditPaymentGroups

protected void removeStoreCreditPaymentGroups(atg.commerce.order.Order pOrder)
Remove any store credit payment groups from order

Parameters:
pOrder -

getGiftCertificateNumbersList

protected java.lang.String[] getGiftCertificateNumbersList(java.lang.String pGiftCertificateString)
Tokenize this list into the various tokens, where each token could be a gift certificate claim code. We tokenize the input here because the idea of a user being able to input multiple gift certificate claim codes on a single line is supported.

Parameters:
pGiftCertificateString - String with GiftCetificate Numbers
Returns:
GiftCertificate Numbers array

setupStoreCreditPaymentGroupsForOrder

public void setupStoreCreditPaymentGroupsForOrder(atg.commerce.order.Order pOrder,
                                                  atg.repository.RepositoryItem pProfile,
                                                  java.lang.String[] pOnlineCreditIds)
                                           throws atg.commerce.CommerceException,
                                                  atg.repository.RepositoryException,
                                                  java.io.IOException,
                                                  javax.servlet.ServletException
Intialize Store Credit Payment Group, add amount to the payment group and add remaning amount to other payment groups @i.e GiftCertificate and CreditCard

Parameters:
pOrder -
pProfile -
pOnlineCreditIds -
Throws:
atg.commerce.CommerceException - if an error occurs
atg.repository.RepositoryException - if an error occurs
java.io.IOException - if an error occurs
javax.servlet.ServletException - if an error occurs

setupGiftCertificatePaymentGroupsForOrder

public void setupGiftCertificatePaymentGroupsForOrder(atg.commerce.order.Order pOrder,
                                                      atg.repository.RepositoryItem pProfile,
                                                      java.lang.String pGiftCertificateNumbers)
                                               throws atg.commerce.CommerceException,
                                                      atg.repository.RepositoryException,
                                                      java.io.IOException,
                                                      javax.servlet.ServletException
This method will parse a string and attempt to create giftCertificatePaymentGroups out of the tokens of the string. This is done in the following manner:

Throws:
atg.commerce.CommerceException - if an error occurs
atg.commerce.claimable.ClaimableException - if an error occurs
javax.servlet.ServletException - if an error occurs
atg.repository.RepositoryException
java.io.IOException

addGiftCertificatePaymentGroupsForOrder

public double addGiftCertificatePaymentGroupsForOrder(atg.commerce.order.Order pOrder,
                                                      atg.repository.RepositoryItem pProfile,
                                                      java.lang.String[] pGiftCertificateNumbers)
                                               throws atg.commerce.CommerceException,
                                                      atg.commerce.claimable.ClaimableException,
                                                      atg.repository.RepositoryException,
                                                      java.io.IOException,
                                                      javax.servlet.ServletException
Parameters:
pOrder -
pProfile -
pGiftCertificateNumbers -
Returns:
Throws:
atg.commerce.CommerceException - if an error occurs
atg.commerce.claimable.ClaimableException - if an error occurs
atg.repository.RepositoryException - if an error occurs
java.io.IOException - if an error occurs
javax.servlet.ServletException - if an error occurs

initializePaymentGroups

protected boolean initializePaymentGroups(atg.commerce.order.Order pOrder,
                                          atg.repository.RepositoryItem pProfile,
                                          java.lang.String[] pOnlineCreditIds)
                                   throws atg.commerce.CommerceException,
                                          javax.servlet.ServletException,
                                          java.io.IOException
Initializes the store credit payment method(s) based on the store credits the user chose.

Returns:
true on success, false - otherwise
Throws:
javax.servlet.ServletException - If servlet exception occurs
java.io.IOException - If IO exception occurs
atg.commerce.CommerceException

sortGiftCertificateNumbersByAmount

public java.lang.String[] sortGiftCertificateNumbersByAmount(java.lang.String[] pGiftCertificateNumbers,
                                                             atg.repository.RepositoryItem pProfile)
                                                      throws StorePurchaseProcessException,
                                                             javax.servlet.ServletException,
                                                             atg.repository.RepositoryException
This mehtod sort's the GiftCertificate Numbers by its amount. Lesser giftcertificate amount should be used first.

Parameters:
pGiftCertificateNumbers -
pProfile -
Returns:
gift certificate numbers sorted by amount of the gift certificate
Throws:
StorePurchaseProcessException - if an error occurs
javax.servlet.ServletException - if an error occurs
atg.repository.RepositoryException - if an error occurs

getGiftCertificateUsableAmount

public double getGiftCertificateUsableAmount(java.lang.String pGiftCertificateNumber)
                                      throws atg.commerce.CommerceException,
                                             atg.repository.RepositoryException,
                                             atg.commerce.claimable.ClaimableException,
                                             javax.servlet.ServletException,
                                             atg.repository.RepositoryException
Return balance amount of gift certificate

Parameters:
pGiftCertificateNumber -
Returns:
Gift Certificate Usable Amount.
Throws:
atg.commerce.CommerceException - if an error occurs
atg.repository.RepositoryException - if an error occurs
atg.commerce.claimable.ClaimableException - if an error occurs
javax.servlet.ServletException - if an error occurs
atg.repository.RepositoryException - if an error occurs

addOrderAmountRemainingToOtherPaymentGroups

public void addOrderAmountRemainingToOtherPaymentGroups(atg.commerce.order.Order pOrder,
                                                        atg.repository.RepositoryItem pProfile,
                                                        double pOrderAmountRemaining)
                                                 throws atg.commerce.CommerceException,
                                                        atg.repository.RepositoryException,
                                                        java.io.IOException,
                                                        javax.servlet.ServletException
Add Order Remaining Amount to Gift Certificate Payment Group, if still

Parameters:
pOrder -
pProfile -
pOrderAmountRemaining -
Throws:
atg.commerce.CommerceException - if an error occurs
atg.repository.RepositoryException - if an error occurs
java.io.IOException - if an error occurs
javax.servlet.ServletException - if an error occurs

addCreditCardAuthorizationNumber

public void addCreditCardAuthorizationNumber(atg.commerce.order.Order pOrder,
                                             java.lang.String pCreditCardVerificationNumber)
Add Credit Card Verification Number to the CreditCard Paymanet Group.

Parameters:
pOrder -
pCreditCardVerificationNumber -

validateCreditCardAuthorizationNumber

public boolean validateCreditCardAuthorizationNumber(java.lang.String pCreditCardVerificationNumber)
Verify the Credit Card verification number

Parameters:
pCreditCardVerificationNumber -
Returns:
true if StoreConfiguration.isRequireCreditCardVerification is false and given authorization number is valid else return false

addCreditCardDetails

public void addCreditCardDetails(atg.commerce.order.CreditCard pCreditCard,
                                 boolean pUsingStoredCreditCard,
                                 java.lang.String pStoredCreditCardName,
                                 atg.repository.RepositoryItem pProfile,
                                 java.util.Locale pUserLocale)
Copy credit card from profile to order if paying with profile credit card.

Parameters:
pCreditCard -
pStoredCreditCardName -
pProfile -
pUserLocale -

getCreditCard

public atg.commerce.order.CreditCard getCreditCard(atg.commerce.order.Order pOrder)
Utility method to fetch credit card and set properties from page.

Returns:
credit card for this order

addOrderAmountRemainingToCreditPaymentGroup

public void addOrderAmountRemainingToCreditPaymentGroup(atg.commerce.order.Order pOrder)
                                                 throws atg.commerce.CommerceException,
                                                        atg.commerce.order.InvalidParameterException
Added Remaining Order Amount relationship To Credit Card PaymentGroup. Removed Remaning Order Amount relationship if all payment payed by other payment groups Like Online Credit or Gift Certificates.

Parameters:
pOrder -
Throws:
atg.commerce.CommerceException
atg.commerce.order.InvalidParameterException

setupCreditCardPaymentGroupsForOrder

public boolean setupCreditCardPaymentGroupsForOrder(atg.commerce.order.Order pOrder,
                                                    atg.repository.RepositoryItem pProfile,
                                                    boolean pUsingStoredCreditCard,
                                                    java.lang.String pStoredCreditCardName,
                                                    java.util.Locale pUserLocale)
                                             throws atg.commerce.CommerceException,
                                                    atg.commerce.order.InvalidParameterException
Parameters:
pOrder -
pProfile -
pStoredCreditCardName -
pUserLocale -
Returns:
Throws:
atg.commerce.CommerceException
atg.commerce.order.InvalidParameterException

runProcessMoveToConfirmation

protected atg.service.pipeline.PipelineResult runProcessMoveToConfirmation(atg.commerce.order.Order pOrder,
                                                                           atg.commerce.pricing.PricingModelHolder pPricingModels,
                                                                           java.lang.String pMoveToConfirmationChainId,
                                                                           java.util.Locale pLocale,
                                                                           atg.repository.RepositoryItem pProfile,
                                                                           java.util.Map pExtraParameters)
                                                                    throws atg.service.pipeline.RunProcessException
Run the pipeline which should be executed at the last of the billing process.

Parameters:
pOrder - the order to reprice
pPricingModels - the set of all pricing models for the user (item, order, shipping, tax)
pLocale - the locale that the order should be priced within
pProfile - the user who owns the order
pExtraParameters - A Map of extra parameters to be used in the pricing
Throws:
atg.service.pipeline.RunProcessException - if error running pipeline process

setProfileEmailAndLogin

protected void setProfileEmailAndLogin(atg.repository.RepositoryItem pProfile,
                                       java.lang.String pEmail)
Set the EmailId and LoginId into the profile repository

Parameters:
pProfile -
pEmail -

addOrder

public void addOrder(atg.commerce.order.Order pOrder)
Add the Order into the Repository if it is transient

Parameters:
pOrder -

setProfilePassword

protected void setProfilePassword(atg.repository.RepositoryItem pProfile,
                                  java.lang.String pNewUserPassword)
Set the password and LoginId into the profile repository

Parameters:
pProfile -
pNewUserPassword -

validateEmailAddress

protected boolean validateEmailAddress(atg.repository.RepositoryItem pProfile,
                                       java.lang.String pEmail)
                                throws StorePurchaseProcessException
Utility method to validate email address.

Returns:
true if success, false - otherwise
Throws:
StorePurchaseProcessException

validatePassword

protected boolean validatePassword(atg.repository.RepositoryItem pProfile,
                                   java.lang.String pNewUserPassword,
                                   java.lang.String pRetypeNewPassword)
                            throws StorePurchaseProcessException
Utility method to validate password input.

Returns:
true if success, false - otherwise
Throws:
StorePurchaseProcessException

isValidNickNameLength

public boolean isValidNickNameLength(java.lang.String pNickName,
                                     int pMinNickNameLength,
                                     int pMaxNickNameLength)
Utility method to check if user's NickName meets the min & max length.

Parameters:
pNickName - is NickName string
Returns:
True if NickName meets min/max requirements False if NickName fails min/max requirements

validateCreditCardNicknameInput

public boolean validateCreditCardNicknameInput(atg.commerce.order.Order pOrder,
                                               atg.repository.RepositoryItem pProfile,
                                               java.lang.String pCreditCardNickname,
                                               int pMinNickNameLength,
                                               int pMaxNickNameLength)
                                        throws StorePurchaseProcessException
This method validates the credit card nickname if one is required.

Parameters:
pOrder -
pProfile -
pCreditCardNickname -
pMinNickNameLength -
pMaxNickNameLength -
Returns:
true if success else return false
Throws:
StorePurchaseProcessException

isPaymentGroupOrderRelationShipExist

public boolean isPaymentGroupOrderRelationShipExist(atg.commerce.order.PaymentGroup pPaymentGroup)
Verify, whether Order Relationship exist in the given Payment Group or not.

Parameters:
pPaymentGroup -
Returns:
true if relation ship found else return false

saveShippingInfo

public 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