atg.commerce.order.edit
Class PaymentGroupEditHandler

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.order.edit.CloneEditHandler
              extended by atg.commerce.order.edit.CollectionEditHandler
                  extended by atg.commerce.order.edit.ListEditHandler
                      extended by atg.commerce.order.edit.PaymentGroupEditHandler
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class PaymentGroupEditHandler
extends ListEditHandler

This handler updates payment groups between the clone and original order.

See Also:
ListEditHandler

Field Summary
static java.lang.String CLASS_VERSION
           
protected  PaymentGroupManager mPaymentGroupManager
           
protected  PaymentManager mPaymentManager
           
 
Fields inherited from class atg.commerce.order.edit.CollectionEditHandler
mCollectionPropertyName, mSortPropertyName, mSubPropertyHandlers, mThrowExceptionsForCollectionChanges, STATE_CLONETOORIGINAL_MAP, STATE_ORIGINALTOCLONE_MAP
 
Fields inherited from class atg.commerce.order.edit.CloneEditHandler
mFulfillmentMessageSender, mKeyPropertyName, mOrderFulfillmentTools, mPropertiesToCopyOnUpdate, STATE_ADD_ITEMS, STATE_DELETE_ITEMS, STATE_UPDATE_ITEMS
 
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
PaymentGroupEditHandler()
           
 
Method Summary
protected  void addItem(CloneEditState pCloneEditState, AddItem pAddItem)
          Overrides add item to use the payment group container interfaces to add the new item.
 Modification createPaymentGroupAddedModification(PaymentGroup pPaymentGroup, Order pOrder)
          Creates a Modification object that represents a payment group add.
 Modification createPaymentGroupUpdateModification(java.lang.String pId)
          Creates a Modification object that represents a payment group update.
protected  void deleteItem(CloneEditState pCloneEditState, DeleteItem pDeleteItem)
          Overrides delete item to use the payment group container interfaces to remove the item
protected  void detectChangesToCollection(CloneEditState pCloneEditState, java.lang.Object pOriginalCollectionContainer, java.lang.Object pCloneCollectionContainer)
          After applying changes, this method resets all the the payment groups that were flagged as auto recovered in the AddItem object.
 java.util.List generateModifications(CloneEditState pCloneEditState)
          Generates the list of Modification objects for payment groups using the AddItem and UpdateItem objects
 PaymentGroupManager getPaymentGroupManager()
          Gets the PaymentGroupManager component.
 PaymentManager getPaymentManager()
           
protected  java.lang.String getStatusErrorMessage(PaymentGroup pPaymentGroup)
          Returns the error message associated with the last PaymentStatus on the given PaymentGroup
 void processAuthorizations(CloneEditState pCloneEditState)
          Performs payment group authorizations for updated and added payment groups.
 void processAuthorizationsForAddedPaymentGroups(CloneEditState pCloneEditState)
          Performs payment group authorizations for added payment groups.
 void processAuthorizationsForDeletedPaymentGroups(CloneEditState pCloneEditState)
          Decreases the authorization for the original amount of the deleted payment group.
 void processAuthorizationsForUpdatedPaymentGroups(CloneEditState pCloneEditState)
          Performs payment group authorizations for updated payment groups.
 void setPaymentGroupManager(PaymentGroupManager pPaymentGroupManager)
          Sets the PaymentGroupManager component.
 void setPaymentManager(PaymentManager pPaymentManager)
           
 
Methods inherited from class atg.commerce.order.edit.CollectionEditHandler
applyChanges, detectChanges, detectDeletes, executeSubPropertyHandlerInitialization, executeSubPropertyHandlerUpdates, executeSubPropertyHandlerValidation, findCounterpartObject, getCloneToOriginalMap, getCollection, getCollectionPropertyName, getMatchingCloneKey, getMatchingOriginalKey, getOriginalToCloneMap, getSortedCollection, getSortPropertyName, getSubPropertyHandlers, handleMissingOriginalObject, initializeCloneEditState, isSubPropertyHandlers, isThrowExceptionsForCollectionChanges, mapOriginalToClone, mapOriginalToCloneCollection, saveOriginalToCloneObjectMappings, setCollectionPropertyName, setSortPropertyName, setSubPropertyHandlers, setThrowExceptionsForCollectionChanges, sortCollection, validateCloneOrder, validateCollection, validateCollection, validateCollectionSize
 
Methods inherited from class atg.commerce.order.edit.CloneEditHandler
addAddItem, addDeleteItem, addStateData, addUpdateItem, adjustCloneCommerceIdReferences, adjustOriginalCommerceIdReferences, cloneOrder, copyPricingModels, createAddItem, createDeleteItem, createUpdateItem, getAddItems, getCloneEditManager, getDeleteItems, getFulfillmentMessageSender, getKeyForObject, getKeyPropertyName, getObjectType, getOrderFulfillmentTools, getPropertiesToCopy, getPropertiesToCopyOnUpdate, getStateData, getStateMap, getUpdateItems, initializeReconciliationProcess, isAddedItem, parseConfigString, processAddItems, processDeleteItems, processUpdateItems, reconcileObjectProperties, sendFulfillmentNotifications, sendMessage, setCloneEditManager, setFulfillmentMessageSender, setKeyPropertyName, setOrderFulfillmentTools, setPropertiesToCopyOnUpdate, updateItem
 
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
See Also:
Constant Field Values

mPaymentManager

protected PaymentManager mPaymentManager

mPaymentGroupManager

protected PaymentGroupManager mPaymentGroupManager
Constructor Detail

PaymentGroupEditHandler

public PaymentGroupEditHandler()
Method Detail

getPaymentManager

public PaymentManager getPaymentManager()
Returns:
the PaymentManager

setPaymentManager

public void setPaymentManager(PaymentManager pPaymentManager)

setPaymentGroupManager

public void setPaymentGroupManager(PaymentGroupManager pPaymentGroupManager)
Sets the PaymentGroupManager component.


getPaymentGroupManager

public PaymentGroupManager getPaymentGroupManager()
Gets the PaymentGroupManager component.


detectChangesToCollection

protected void detectChangesToCollection(CloneEditState pCloneEditState,
                                         java.lang.Object pOriginalCollectionContainer,
                                         java.lang.Object pCloneCollectionContainer)
                                  throws CommerceException
After applying changes, this method resets all the the payment groups that were flagged as auto recovered in the AddItem object.

The amountAuhtorized, amountCredited, amountDebited are reset back to zero.

Overrides:
detectChangesToCollection in class CollectionEditHandler
Parameters:
pCloneEditState - the CloneEditState that was created at the beginning of the clone process.
pOriginalCollectionContainer - the object that has the original collection in the property defined by collectionPropertyName
pCloneCollectionContainer - the object that has the clone collection in the property defined by collectionPropertyName
Throws:
CommerceException

addItem

protected void addItem(CloneEditState pCloneEditState,
                       AddItem pAddItem)
                throws CommerceException
Overrides add item to use the payment group container interfaces to add the new item.

Overrides:
addItem in class ListEditHandler
Parameters:
pCloneEditState -
pAddItem -
Throws:
CommerceException
See Also:
PaymentGroupContainer.addPaymentGroup(PaymentGroup, int)

deleteItem

protected void deleteItem(CloneEditState pCloneEditState,
                          DeleteItem pDeleteItem)
                   throws CommerceException
Overrides delete item to use the payment group container interfaces to remove the item

Overrides:
deleteItem in class CollectionEditHandler
Parameters:
pCloneEditState -
pDeleteItem - the DeleteItem object
Throws:
CommerceException
See Also:
PaymentGroupManager.removePaymentGroupFromOrder(Order, String), PaymentGroupContainer.removePaymentGroup(String)

processAuthorizations

public void processAuthorizations(CloneEditState pCloneEditState)
                           throws CommerceException
Performs payment group authorizations for updated and added payment groups.

Parameters:
pCloneEditState -
Throws:
CommerceException
See Also:
processAuthorizationsForUpdatedPaymentGroups(CloneEditState), processAuthorizationsForAddedPaymentGroups(CloneEditState), processAuthorizationsForAddedPaymentGroups(CloneEditState)

processAuthorizationsForUpdatedPaymentGroups

public void processAuthorizationsForUpdatedPaymentGroups(CloneEditState pCloneEditState)
                                                  throws CommerceException
Performs payment group authorizations for updated payment groups.

Each one is authorized for the difference between the pg.amount and pg.amountAuthorized

Parameters:
pCloneEditState -
Throws:
CommerceException,
AuthorizationUpdateException
CommerceException
See Also:
PaymentManager.authorize(Order, PaymentGroup, double)

getStatusErrorMessage

protected java.lang.String getStatusErrorMessage(PaymentGroup pPaymentGroup)
Returns the error message associated with the last PaymentStatus on the given PaymentGroup

Parameters:
pPaymentGroup -
Returns:
error message

processAuthorizationsForAddedPaymentGroups

public void processAuthorizationsForAddedPaymentGroups(CloneEditState pCloneEditState)
                                                throws CommerceException
Performs payment group authorizations for added payment groups.

Added payment groups are either brand new or a recovery of a pg that was removed from the original after cloning it.

Each one is authorized for the difference between the pg.amount and pg.amountAuthorized

Parameters:
pCloneEditState -
Throws:
CommerceException
AuthorizationUpdateException
See Also:
PaymentManager.authorize(Order, PaymentGroup, double)

processAuthorizationsForDeletedPaymentGroups

public void processAuthorizationsForDeletedPaymentGroups(CloneEditState pCloneEditState)
                                                  throws CommerceException
Decreases the authorization for the original amount of the deleted payment group.

Parameters:
pCloneEditState -
Throws:
CommerceException
AuthorizationUpdateException

generateModifications

public java.util.List generateModifications(CloneEditState pCloneEditState)
Generates the list of Modification objects for payment groups using the AddItem and UpdateItem objects

Overrides:
generateModifications in class CloneEditHandler
Parameters:
pCloneEditState -
Returns:
List of Modification objects

createPaymentGroupAddedModification

public Modification createPaymentGroupAddedModification(PaymentGroup pPaymentGroup,
                                                        Order pOrder)
Creates a Modification object that represents a payment group add.

Parameters:
pPaymentGroup -
pOrder -
Returns:
Modification object

createPaymentGroupUpdateModification

public Modification createPaymentGroupUpdateModification(java.lang.String pId)
Creates a Modification object that represents a payment group update.

Parameters:
pId -
Returns:
Modification object