atg.commerce.order
Class PaymentGroupManager

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.order.PaymentGroupManager
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class PaymentGroupManager
extends GenericService

This class is the business layer object for managing and manipulating PaymentGroups. This class holds all the business logic for manipulating all types of PaymentGroups.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected static java.util.ResourceBundle sResourceBundle
          Resource Bundle
 
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
PaymentGroupManager()
          Constructs a PaymentGroupManager object.
 
Method Summary
 void addPaymentGroupToOrder(Order pOrder, PaymentGroup pPaymentGroup)
          Adds the given PaymentGroup to the given order.
 void addPaymentGroupToOrder(Order pOrder, PaymentGroup pPaymentGroup, int pIndex)
          Adds the given PaymentGroup to the given order in the specified location.
 PaymentGroup createPaymentGroup()
          Creates a new PaymentGroup object using the type mapped to the defaultPaymentGroupType property in OrderTools.
 PaymentGroup createPaymentGroup(java.lang.String pPaymentGroupType)
          Creates a new PaymentGroup object using the type mapped to the defaultPaymentGroupType property in OrderTools.
 java.util.List getAllPaymentGroupRelationships(Order pOrder)
          Provides a List of all PaymentGroupRelationships associated with the given Order.
 java.util.List getNonModifiablePaymentGroups(Order pOrder)
          This method determines whether the payment group is in a condusive to editing state
 java.lang.String[] getNonModifiablePaymentGroupStates()
           
 OrderTools getOrderTools()
          Returns property orderTools
 PaymentGroupCommerceItemRelationship getPaymentGroupCommerceItemRelationship(Order pOrder, java.lang.String pItemId, java.lang.String pPaymentGroupId)
          Returns the relationship object which exists between the given CommerceItem and PaymentGroup.
 PaymentGroupOrderRelationship getPaymentGroupOrderRelationship(Order pOrder, java.lang.String pPaymentGroupId)
          Returns the relationship object which exists between the given Order and PaymentGroup.
 PaymentGroupShippingGroupRelationship getPaymentGroupShippingGroupRelationship(Order pOrder, java.lang.String pPaymentGroupId, java.lang.String pShippingGroupId)
          Returns the relationship object which exists between the given ShippingGroup and PaymentGroup.
 void initializeCreditCard(CreditCard pCreditCard, java.lang.String pCreditCardNumber, java.lang.String pCreditCardType)
          Initializes a CreditCard object to contain the given data.
 void initializeGiftCertificate(GiftCertificate pGiftCertificate, java.lang.String pProfileId, java.lang.String pGiftCertificateNumber)
          Initializes a GiftCertificate object to contain the given data.
 void initializeStoreCredit(StoreCredit pStoreCredit, java.lang.String pProfileId, java.lang.String pStoreCreditNumber)
          Initializes a StoreCredit object to contain the given data.
 boolean isPaymentGroupInOrder(Order pOrder, java.lang.String pPaymentGroupId)
          isPaymentGroupInOrder is used to determine if the PaymentGroup is already in the Order.
 boolean isPaymentGroupUsed(Order pOrder, PaymentGroup pPaymentGroup)
          This returns true if this is the only payment group in the order, or if this payment group is not empty.
 boolean paymentGroupIsModifiable(PaymentGroup pPaymentGroup)
          This method determines whether the payment group is in a condusive to editing state
 PipelineResult recalculatePaymentGroupAmounts(Order pOrder)
          Recalculates the amounts for each PaymentGroup supplied in pPaymentGroupList.
 void removeAllPaymentGroupsFromOrder(Order pOrder)
          Removes all the PaymentGroups and their Relationships from an Order.
 void removeAllPaymentGroupsFromOrder(Order pOrder, java.util.List pExclusions)
          Removes PaymentGroups and their Relationships from an Order, retaining the PaymentGroups passed in via the exclusion list parameter.
 void removeAllRelationshipsFromPaymentGroup(Order pOrder, java.lang.String pPaymentGroupId)
          Removes all the relationships from the PaymentGroup with the given id in the given order.
 void removeEmptyPaymentGroups(Order pOrder)
          Removes all the PaymentGroups which are not being used.
 void removePaymentGroupFromOrder(Order pOrder, java.lang.String pPaymentGroupId)
          Removes the given PaymentGroup from the given order.
 void setNonModifiablePaymentGroupStates(java.lang.String[] pNonModifiablePaymentGroupStates)
          Sets array of payment group states that indicate that a payment group is not modifiable
 void setOrderTools(OrderTools pOrderTools)
          Sets property orderTools
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


sResourceBundle

protected static java.util.ResourceBundle sResourceBundle
Resource Bundle

Constructor Detail

PaymentGroupManager

public PaymentGroupManager()
Constructs a PaymentGroupManager object.

Method Detail

getOrderTools

public OrderTools getOrderTools()
Returns property orderTools

Returns:
returns property orderTools

setOrderTools

public void setOrderTools(OrderTools pOrderTools)
Sets property orderTools

Parameters:
pOrderTools - the value to set for property orderTools

setNonModifiablePaymentGroupStates

public void setNonModifiablePaymentGroupStates(java.lang.String[] pNonModifiablePaymentGroupStates)
Sets array of payment group states that indicate that a payment group is not modifiable

Parameters:
pNonModifiablePaymentGroupStates - an array of payment group states that indicate that a payment group is not modifiable

getNonModifiablePaymentGroupStates

public java.lang.String[] getNonModifiablePaymentGroupStates()
Returns:
array of payment group states that indicate that a payment group is not modifiable

createPaymentGroup

public PaymentGroup createPaymentGroup()
                                throws CommerceException
Creates a new PaymentGroup object using the type mapped to the defaultPaymentGroupType property in OrderTools.

Returns:
the PaymentGroup which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidParameterException - thrown if any of the parameters are null
CommerceException
See Also:
OrderTools.getDefaultPaymentGroupType()

createPaymentGroup

public PaymentGroup createPaymentGroup(java.lang.String pPaymentGroupType)
                                throws CommerceException
Creates a new PaymentGroup object using the type mapped to the defaultPaymentGroupType property in OrderTools. Populates the PaymentGroup with the supplied data.

Parameters:
pPaymentGroupType - the type that is mapped in the OrderTools.properties file to the class of the desired type to create
Returns:
the PaymentGroup which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidParameterException - thrown if any of the parameters are null
CommerceException

initializeCreditCard

public void initializeCreditCard(CreditCard pCreditCard,
                                 java.lang.String pCreditCardNumber,
                                 java.lang.String pCreditCardType)
                          throws CommerceException
Initializes a CreditCard object to contain the given data.

Parameters:
pCreditCard - the CreditCard object to initialize
pCreditCardNumber - the credit card number
pCreditCardType - the credit card type. See atg.payment.creditcard.CreditCardTypes
Throws:
InvalidParameterException - thrown if any of the required parameters are null
CommerceException
See Also:
CreditCard

initializeGiftCertificate

public void initializeGiftCertificate(GiftCertificate pGiftCertificate,
                                      java.lang.String pProfileId,
                                      java.lang.String pGiftCertificateNumber)
                               throws CommerceException
Initializes a GiftCertificate object to contain the given data.

Parameters:
pGiftCertificate - the GiftCertificate object to initialize
pProfileId - the profile id for the user who owns this gift certificate
pGiftCertificateNumber - the credit card number
Throws:
InvalidParameterException - thrown if any of the required parameters are null
CommerceException
See Also:
GiftCertificate

initializeStoreCredit

public void initializeStoreCredit(StoreCredit pStoreCredit,
                                  java.lang.String pProfileId,
                                  java.lang.String pStoreCreditNumber)
                           throws CommerceException
Initializes a StoreCredit object to contain the given data.

Parameters:
pStoreCredit - the StoreCredit object to initialize
pProfileId - the profile id for the user who owns this store credit
pStoreCreditNumber - the store credit number
Throws:
InvalidParameterException - thrown if any of the required parameters are null
CommerceException
See Also:
StoreCredit

addPaymentGroupToOrder

public void addPaymentGroupToOrder(Order pOrder,
                                   PaymentGroup pPaymentGroup)
                            throws CommerceException
Adds the given PaymentGroup to the given order.

Parameters:
pOrder - the Order to add the PaymentGroup to
pPaymentGroup - the PaymentGroup to add to the Order
Throws:
InvalidParameterException - thrown if any of the parameters are null
CommerceException

addPaymentGroupToOrder

public void addPaymentGroupToOrder(Order pOrder,
                                   PaymentGroup pPaymentGroup,
                                   int pIndex)
                            throws CommerceException
Adds the given PaymentGroup to the given order in the specified location.

Parameters:
pOrder - the Order to add the PaymentGroup to
pPaymentGroup - the PaymentGroup to add to the Order
pIndex - the location in the Order's list of PaymentGroups to add the PaymentGroup to
Throws:
InvalidParameterException - thrown if any of the parameters are null
CommerceException

removeAllPaymentGroupsFromOrder

public void removeAllPaymentGroupsFromOrder(Order pOrder)
                                     throws CommerceException
Removes all the PaymentGroups and their Relationships from an Order.

Parameters:
pOrder - the Order which contains the PaymentGroups to be removed
Throws:
InvalidParameterException - thrown if any of the parameters are null
ObjectRemovalException - thrown if a PaymentGroup cannot be removed
CommerceException

removeAllPaymentGroupsFromOrder

public void removeAllPaymentGroupsFromOrder(Order pOrder,
                                            java.util.List pExclusions)
                                     throws CommerceException
Removes PaymentGroups and their Relationships from an Order, retaining the PaymentGroups passed in via the exclusion list parameter.

Parameters:
pOrder - the Order which contains the PaymentGroups to be removed
pExclusions - the PaymentGroups to be retained (can be null or an empty list)
Throws:
InvalidParameterException - thrown if any required parameter is null
ObjectRemovalException - thrown if a PaymentGroup cannot be removed
CommerceException

removePaymentGroupFromOrder

public void removePaymentGroupFromOrder(Order pOrder,
                                        java.lang.String pPaymentGroupId)
                                 throws CommerceException
Removes the given PaymentGroup from the given order. This method will also remove relationships which reference the PaymentGroup.

Parameters:
pOrder - the Order to remove the PaymentGroup from
pPaymentGroupId - the id of the PaymentGroup to remove from the Order
Throws:
InvalidParameterException - thrown if any of the parameters are null
PaymentGroupNotFoundException - if a PaymentGroup with the given id is not found in the given order
ObjectRemovalException - thrown if the PaymentGroup contains any relationships
CommerceException

removeAllRelationshipsFromPaymentGroup

public void removeAllRelationshipsFromPaymentGroup(Order pOrder,
                                                   java.lang.String pPaymentGroupId)
                                            throws CommerceException
Removes all the relationships from the PaymentGroup with the given id in the given order.

Parameters:
pOrder - the Order which contains the PaymentGroup to remove the relationships from
pPaymentGroupId - the id of the PaymentGroup
Throws:
InvalidParameterException - thrown if any of the parameters are null
PaymentGroupNotFoundException - if a PaymentGroup with the given id is not found in the given order
ObjectRemovalException - thrown if a relationship cannot be removed
CommerceException

getAllPaymentGroupRelationships

public java.util.List getAllPaymentGroupRelationships(Order pOrder)
                                               throws CommerceException
Provides a List of all PaymentGroupRelationships associated with the given Order. This could include PaymentGroupShippingGroupRelationships, PaymentGroupCommerceItemRelationships, or PaymentGroupOrderRelationships.

Parameters:
pOrder - the Order whose relationships are sought
Returns:
a List of PaymentGroupRelationships in the Order
Throws:
InvalidParameterException - thrown if order parameter is null
CommerceException
See Also:
Relationship, PaymentGroupRelationship, PaymentGroupCommerceItemRelationship, PaymentGroupShippingGroupRelationship, PaymentGroupOrderRelationship

recalculatePaymentGroupAmounts

public PipelineResult recalculatePaymentGroupAmounts(Order pOrder)
                                              throws CommerceException
Recalculates the amounts for each PaymentGroup supplied in pPaymentGroupList.

Parameters:
pOrder - the Order to recalculate the PaymentGroups in
Returns:
the PipelineResult object from the execution of the pipeline
Throws:
CommerceException - thrown if an error occurs while recalculating the amounts

removeEmptyPaymentGroups

public void removeEmptyPaymentGroups(Order pOrder)
                              throws CommerceException
Removes all the PaymentGroups which are not being used. Not being used means that the PaymentGroup has no Relationships. If the Order has only one PaymentGroup then it is not removed even though it may not have any Relationships.

Parameters:
pOrder - the Order which contains the PaymentGroups
Throws:
CommerceException - if an exception occurs while removing a PaymentGroup

getPaymentGroupCommerceItemRelationship

public PaymentGroupCommerceItemRelationship getPaymentGroupCommerceItemRelationship(Order pOrder,
                                                                                    java.lang.String pItemId,
                                                                                    java.lang.String pPaymentGroupId)
                                                                             throws CommerceException
Returns the relationship object which exists between the given CommerceItem and PaymentGroup.

Parameters:
pItemId - the id of the CommerceItem which makes up a half of the relationship
pPaymentGroupId - the id of the PaymentGroup which makes up a half of the relationship
Returns:
the PaymentGroupCommerceItemRelationship object that exists between these two objects
Throws:
InvalidParameterException - thrown if any of the parameters are null
RelationshipNotFoundException - if a relationship is not found
CommerceException

getPaymentGroupShippingGroupRelationship

public PaymentGroupShippingGroupRelationship getPaymentGroupShippingGroupRelationship(Order pOrder,
                                                                                      java.lang.String pPaymentGroupId,
                                                                                      java.lang.String pShippingGroupId)
                                                                               throws CommerceException
Returns the relationship object which exists between the given ShippingGroup and PaymentGroup.

Parameters:
pShippingGroupId - the id of the ShippingGroup which makes up a half of the relationship
pPaymentGroupId - the id of the PaymentGroup which makes up a half of the relationship
Returns:
the PaymentGroupShippingGroupRelationship object that exists between these two objects
Throws:
InvalidParameterException - thrown if any of the parameters are null
RelationshipNotFoundException - if a relationship is not found
CommerceException

getPaymentGroupOrderRelationship

public PaymentGroupOrderRelationship getPaymentGroupOrderRelationship(Order pOrder,
                                                                      java.lang.String pPaymentGroupId)
                                                               throws CommerceException
Returns the relationship object which exists between the given Order and PaymentGroup.

Parameters:
pOrder - the Order which makes up half of the relationship
pPaymentGroupId - the id of the PaymentGroup which makes up a half of the relationship
Returns:
the PaymentGroupOrderRelationship object that exists between these two objects
Throws:
InvalidParameterException - thrown if any of the parameters are null
RelationshipNotFoundException - if a relationship is not found
CommerceException

isPaymentGroupUsed

public boolean isPaymentGroupUsed(Order pOrder,
                                  PaymentGroup pPaymentGroup)
This returns true if this is the only payment group in the order, or if this payment group is not empty. Otherwise it returns false.

Parameters:
pOrder - The order containing the payment group
pPaymentGroup - The payment group being checked
Returns:
true if this payment group will be used to pay for the order

paymentGroupIsModifiable

public boolean paymentGroupIsModifiable(PaymentGroup pPaymentGroup)
This method determines whether the payment group is in a condusive to editing state

Parameters:
pPaymentGroup - the shipping group
Returns:
whether the group is editable

getNonModifiablePaymentGroups

public java.util.List getNonModifiablePaymentGroups(Order pOrder)
This method determines whether the payment group is in a condusive to editing state

Parameters:
pPaymentGroup - the payment group
Returns:
whether the group is editable

isPaymentGroupInOrder

public boolean isPaymentGroupInOrder(Order pOrder,
                                     java.lang.String pPaymentGroupId)
isPaymentGroupInOrder is used to determine if the PaymentGroup is already in the Order.

Parameters:
pOrder - an Order value
pPaymentGroupId - a String value
Returns:
a boolean value