public class PaymentGroupDroplet extends DynamoServlet
PaymentGroupDroplet is a DynamoServlet that is used to initialize
payment methods and CommerceIdentifierPaymentInfo objects for use by the PaymentGroupFormHandler.
The PaymentGroupDroplet is composed of the following containers:
PaymentGroupMapContainer - container for the user's named PaymentGroups
CommerceIdentifierPaymentInfoContainer - container for the user's CommerceIdentifierPaymentInfo objects for a particular Order's CommerceIdentifiers
The service method ensures the following:
PaymentGroup initialization - the user's authorized payment methods are added by type to the PaymentGroupMapContainer. Once this is done the user can begin to select from these during the billing checkout process. The PaymentGroupInitializers ServiceMap is a registry of PaymentGroup types to components that implement the PaymentGroupInitializer interface. PaymentGroupInitializer components are ultimately responsible for creating the appropriate PaymentGroups, initializing them as appropriate for the user, and adding them to the PaymentGroupMapContainer.
CommerceIdentifierPaymentInfo initialization - the Order CommerceIdentifiers of interest are used to instantiate CommerceIdentifierPaymentInfo objects, and these are added to the CommerceIdentifierPaymentInfoContainer.
A complete description of the parameters to the PaymentGroupDroplet are:
Example Usage with initBasedOnOrder, createAllPaymentInfos and initOrderPayment
<dsp:droplet name="PaymentGroupDroplet">
<dsp:param name="clear" param="init" />
<dsp:param name="paymentGroupTypes" value="creditCard,storeCredit" />
<dsp:param name="initPaymentGroups" param="init" />
<dsp:param name="initBasedOnOrder" param="init" />
<dsp:param name="initOrderPayment" param="init" />
<dsp:param name="createAllPaymentInfos" value="true" />
<dsp:oparam name="output">
</dsp:oparam>
</dsp:droplet>
The above example initializes Credit Card and Store Credit payment groups and initializes CommerceIdentifierPaymentInfos
based on the order relationships. If there are no relationships or payment groups exists in the order, a CommerceIdentifierPaymentInfo is added
based on the Profile's default payment group. Also note that the createAllPaymentInfos is true. During the initial page rendering, the
PaymentGroupMapContainer and CommerceIdentifierPaymentInfoContainer are initialized and CommerceIdentifierPaymentInfos are created. After the initial rendering
if there is any new PaymentGroup is added to the container, then the CommerceIdentifierPaymentInfo is created for the newly created PaymentGroup.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CIPI_MAP |
static java.lang.String |
CLASS_VERSION |
static ParameterName |
CLEAR_ALL |
static ParameterName |
CLEAR_PAYMENT_GROUPS |
static ParameterName |
CLEAR_PAYMENT_INFOS |
static ParameterName |
CREATE_ALL_PAYMENT_INFOS |
static ParameterName |
INIT_BASED_ON_ORDER |
static ParameterName |
INIT_ITEM_PAYMENT |
static ParameterName |
INIT_ORDER_PAYMENT |
static ParameterName |
INIT_PAYMENT_GROUPS |
static ParameterName |
INIT_SHIPPING_PAYMENT |
static ParameterName |
INIT_TAX_PAYMENT |
static java.lang.String |
ORDER |
static java.lang.String |
OUTPUT |
static ParameterName |
PAYMENT_GROUP_TYPES |
static java.lang.String |
PAYMENT_GROUPS |
mAllowCleanupRequest, mParametersSERVLET_INFO_KEYSERVICE_INFO_KEYDEFAULT_LOG_TRACE_STATUSDEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS| Constructor and Description |
|---|
PaymentGroupDroplet()
Creates a new
PaymentGroupDroplet instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
addMissingCommerceIdentifierPaymentInfos(java.util.List pCommerceIdentifierPaymentInfos)
This method checks for CommerceIdentifierPaymentInfo entry for each payment group.
|
protected void |
consolidatePaymentInfos(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
consolidatePaymentInfos consolidates CommerceIdentifierPaymentInfos
by ensuring there is no redundant data. |
protected void |
copyConfiguration()
Copy property settings from the optional
PurchaseProcessConfiguration component. |
void |
createAllCommerceIdentifierPaymentInfos()
This method checks to see if there is any existance of CommerceIdentifierPaymentInfo for each CommerceIdentifier ( Order, CommerceItem,
Shipping Group and Tax) and if there is any CommerceIdentifierPaymentInfo exists for a CommerceIdentifier, then this method
creates all possible combination of CommerceIdentifierPaymentInfo for each CommerceIdentifier.
|
void |
doStartService()
Perform one-time startup operations, including copying property
settings from the optional
PurchaseProcessConfiguration
component. |
CommerceIdentifierPaymentInfoContainer |
getCommerceIdentifierPaymentInfoContainer()
Return the CommerceIdentifierPaymentInfoContainer property.
|
PurchaseProcessConfiguration |
getConfiguration()
Returns property Configuration
|
PaymentGroup |
getDefaultPaymentGroup()
The
getDefaultPaymentGroupName method returns the default
PaymentGroup based on the PaymentGroupMapContainer's default PaymentGroup
name. |
java.lang.String |
getNewPaymentGroupName(PaymentGroup pPaymentGroup)
This utility method gets the payment group name or nickname for the payment group that is passed in.
|
Order |
getOrder()
Return the Order property.
|
ServiceMap |
getPaymentGroupInitializers()
Return the PaymentGroupInitializers property.
|
PaymentGroupManager |
getPaymentGroupManager()
Return the PaymentGroupManager property.
|
PaymentGroupMapContainer |
getPaymentGroupMapContainer()
Return the PaymentGroupMapContainer property.
|
java.lang.String |
getPaymentGroupName(PaymentGroup pPaymentGroup)
This method iterates throug the payment groups and finds the matching payment group and its name.
|
java.lang.String |
getPaymentGroupTypes()
Return the PaymentGroupTypes property.
|
Profile |
getProfile()
Return the Profile property.
|
protected void |
initializeBasedOnOrder(Order pOrder)
The
initializeBasedOnOrder method creates
CommerceIdentifierPaymentInfo objects that reflect the current payment
information in the order. |
void |
initializeCommerceIdentifierPayment(Order pOrder)
This method initializes payment infos for preferred commerce identifies such as Order, CommerceItem,ShippingGroup or
Tax.
|
void |
initializeCommerceIdentifierPaymentInfos(PaymentGroupRelationshipContainer pContainer)
This method initializes CommerceIdentifierPaymentInfo with the information available from order's relationship
objects.
|
protected void |
initializeItemPayment(Order pOrder)
The
initializeItemPayment method creates a CommerceItemPaymentInfo
for each CommerceItem in the Order. |
protected void |
initializeOrderPayment(Order pOrder)
The
initializeOrderPayment method creates an OrderPaymentInfo, which
is a CommerceIdentifierPaymentInfo used for Order payment information. |
protected void |
initializePaymentInfos(DynamoHttpServletRequest pRequest,
Order pOrder)
initializePaymentInfos creates CommerceIdentifierPaymentInfo objects
for the Order, the Order's CommerceItems, the Order's ShippingGroups, and the tax. |
protected void |
initializeRequestParameters(DynamoHttpServletRequest pRequest)
The
initializeRequestParameters method gathers the necessary
input parameters and uses them to adjust initialization requirements. |
protected void |
initializeShippingPayment(Order pOrder)
The
initializeShippingPayment method creates a ShippingGroupPaymentInfo
for each ShippingGroup in the Order. |
protected void |
initializeTaxPayment(Order pOrder)
The
initializeTaxPayment method creates a TaxPaymentInfo, which
is a CommerceIdentifierPaymentInfo used for tax payment information. |
protected void |
initializeUserPaymentMethods(DynamoHttpServletRequest pRequest,
Profile pProfile)
initializeUserPaymentMethods is used to add the user's
payment methods to the PaymentGroupMapContainer. |
boolean |
isAnyPaymentInfoExistsInContainter()
This method checks to see if there is any payment infos.
|
boolean |
isClearAll()
Return the ClearAll property.
|
boolean |
isClearPaymentGroups()
Return the ClearPaymentGroups property.
|
boolean |
isClearPaymentInfos()
Return the ClearPaymentInfos property.
|
boolean |
isCreateAllPaymentInfos() |
boolean |
isInitBasedOnOrder()
Return the InitBasedOnOrder property.
|
boolean |
isInitItemPayment()
Return the InitItemPayment property.
|
boolean |
isInitOrderPayment()
Return the InitOrderPayment property.
|
boolean |
isInitPaymentGroups()
Return the InitPaymentGroups property.
|
boolean |
isInitShippingPayment()
Return the InitShippingPayment property.
|
boolean |
isInitTaxPayment()
Return the InitTaxPayment property.
|
protected CommerceIdentifierPaymentInfo |
mergeCommerceIdentifierPaymentInfos(CommerceIdentifierPaymentInfo cipi1,
CommerceIdentifierPaymentInfo cipi2)
mergeCommerceIdentifierPaymentInfos merges 2 CommerceIdentifierPaymentInfos
into one by combining their amounts and quantities. |
void |
service(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This
service method is used to initialize PaymentGroups and
CommerceIdentifierPaymentInfo objects. |
void |
setClearAll(boolean pClearAll)
Set the ClearAll property.
|
void |
setClearPaymentGroups(boolean pClearPaymentGroups)
Set the ClearPaymentGroups property.
|
void |
setClearPaymentInfos(boolean pClearPaymentInfos)
Set the ClearPaymentInfos property.
|
void |
setCommerceIdentifierPaymentInfoContainer(CommerceIdentifierPaymentInfoContainer pCommerceIdentifierPaymentInfoContainer)
Set the CommerceIdentifierPaymentInfoContainer property.
|
void |
setConfiguration(PurchaseProcessConfiguration pConfiguration)
Sets property Configuration
|
void |
setCreateAllPaymentInfos(boolean pCreateAllPaymentInfos) |
void |
setInitBasedOnOrder(boolean pInitBasedOnOrder)
Set the InitBasedOnOrder property.
|
void |
setInitItemPayment(boolean pInitItemPayment)
Set the InitItemPayment property.
|
void |
setInitOrderPayment(boolean pInitOrderPayment)
Set the InitOrderPayment property.
|
void |
setInitPaymentGroups(boolean pInitPaymentGroups)
Set the InitPaymentGroups property.
|
void |
setInitShippingPayment(boolean pInitShippingPayment)
Set the InitShippingPayment property.
|
void |
setInitTaxPayment(boolean pInitTaxPayment)
Set the InitTaxPayment property.
|
void |
setOrder(Order pOrder)
Set the Order property.
|
void |
setPaymentGroupInitializers(ServiceMap pPaymentGroupInitializers)
Set the PaymentGroupInitializers property.
|
void |
setPaymentGroupManager(PaymentGroupManager pPaymentGroupManager)
Set the PaymentGroupManager property.
|
void |
setPaymentGroupMapContainer(PaymentGroupMapContainer pPaymentGroupMapContainer)
Set the PaymentGroupMapContainer property.
|
void |
setPaymentGroupTypes(java.lang.String pPaymentGroupTypes)
Set the PaymentGroupTypes property.
|
void |
setProfile(Profile pProfile)
Set the Profile property.
|
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, init, service, service, setParameterdestroy, getServletConfig, getServletInfo, setServletInfogetAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatisticsaddLogListener, createAdminServlet, 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, stopServicevlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningpublic static java.lang.String CLASS_VERSION
public static final ParameterName INIT_PAYMENT_GROUPS
public static final ParameterName PAYMENT_GROUP_TYPES
public static final ParameterName INIT_ITEM_PAYMENT
public static final ParameterName INIT_SHIPPING_PAYMENT
public static final ParameterName INIT_ORDER_PAYMENT
public static final ParameterName INIT_TAX_PAYMENT
public static final ParameterName INIT_BASED_ON_ORDER
public static final ParameterName CLEAR_ALL
public static final ParameterName CLEAR_PAYMENT_INFOS
public static final ParameterName CLEAR_PAYMENT_GROUPS
public static final ParameterName CREATE_ALL_PAYMENT_INFOS
public static final java.lang.String PAYMENT_GROUPS
public static final java.lang.String CIPI_MAP
public static final java.lang.String ORDER
public static final java.lang.String OUTPUT
public PaymentGroupDroplet()
PaymentGroupDroplet instance.public void setConfiguration(PurchaseProcessConfiguration pConfiguration)
pConfiguration - a PurchaseProcessConfiguration valuepublic PurchaseProcessConfiguration getConfiguration()
PurchaseProcessConfiguration valuepublic void setPaymentGroupManager(PaymentGroupManager pPaymentGroupManager)
pPaymentGroupManager - a PaymentGroupManager valuepublic PaymentGroupManager getPaymentGroupManager()
PaymentGroupManager valuepublic void setPaymentGroupTypes(java.lang.String pPaymentGroupTypes)
pPaymentGroupTypes - a String valuepublic java.lang.String getPaymentGroupTypes()
String valuepublic void setPaymentGroupInitializers(ServiceMap pPaymentGroupInitializers)
pPaymentGroupInitializers - a ServiceMap valuepublic ServiceMap getPaymentGroupInitializers()
ServiceMap valuepublic void setInitPaymentGroups(boolean pInitPaymentGroups)
pInitPaymentGroups - a boolean valuepublic boolean isInitPaymentGroups()
boolean valuepublic void setOrder(Order pOrder)
pOrder - an Order valuepublic Order getOrder()
Order valuepublic void setProfile(Profile pProfile)
pProfile - a Profile valuepublic Profile getProfile()
Profile valuepublic void setClearPaymentInfos(boolean pClearPaymentInfos)
pClearPaymentInfos - a boolean valuepublic boolean isClearPaymentInfos()
boolean valuepublic void setClearPaymentGroups(boolean pClearPaymentGroups)
pClearPaymentGroups - a boolean valuepublic boolean isClearPaymentGroups()
boolean valuepublic void setClearAll(boolean pClearAll)
pClearAll - a boolean valuepublic boolean isClearAll()
boolean valuepublic void setInitItemPayment(boolean pInitItemPayment)
pInitItemPayment - a boolean valuepublic boolean isInitItemPayment()
boolean valuepublic void setInitShippingPayment(boolean pInitShippingPayment)
pInitShippingPayment - a boolean valuepublic boolean isInitShippingPayment()
boolean valuepublic void setInitOrderPayment(boolean pInitOrderPayment)
pInitOrderPayment - a boolean valuepublic boolean isInitOrderPayment()
boolean valuepublic void setInitTaxPayment(boolean pInitTaxPayment)
pInitTaxPayment - a boolean valuepublic boolean isInitTaxPayment()
boolean valuepublic void setInitBasedOnOrder(boolean pInitBasedOnOrder)
pInitBasedOnOrder - a boolean valuepublic boolean isInitBasedOnOrder()
boolean valuepublic void setCommerceIdentifierPaymentInfoContainer(CommerceIdentifierPaymentInfoContainer pCommerceIdentifierPaymentInfoContainer)
pCommerceIdentifierPaymentInfoContainer - a CommerceIdentifierPaymentInfoContainer valuepublic CommerceIdentifierPaymentInfoContainer getCommerceIdentifierPaymentInfoContainer()
CommerceIdentifierPaymentInfoContainer valuepublic void setPaymentGroupMapContainer(PaymentGroupMapContainer pPaymentGroupMapContainer)
pPaymentGroupMapContainer - a PaymentGroupMapContainer valuepublic PaymentGroupMapContainer getPaymentGroupMapContainer()
PaymentGroupMapContainer valuepublic boolean isCreateAllPaymentInfos()
public void setCreateAllPaymentInfos(boolean pCreateAllPaymentInfos)
pCreateAllPaymentInfos - The createAllPaymentInfos to set.protected void initializeUserPaymentMethods(DynamoHttpServletRequest pRequest, Profile pProfile)
initializeUserPaymentMethods is used to add the user's
payment methods to the PaymentGroupMapContainer. For each entry in the
PaymentGroupTypes, its corresponding PaymentGroupInitializer is obtained
from the PaymentGroupInitializers ServiceMap and its initializePaymentGroups
method executed.pRequest - a DynamoHttpServletRequest valuepProfile - a Profile valueprotected void initializePaymentInfos(DynamoHttpServletRequest pRequest, Order pOrder)
initializePaymentInfos creates CommerceIdentifierPaymentInfo objects
for the Order, the Order's CommerceItems, the Order's ShippingGroups, and the tax.
These objects are added to the CommerceIdentifierPaymentInfoContainer.pRequest - a DynamoHttpServletRequest valuepOrder - an Order valuepublic void initializeCommerceIdentifierPayment(Order pOrder)
pOrder - public void createAllCommerceIdentifierPaymentInfos()
public void addMissingCommerceIdentifierPaymentInfos(java.util.List pCommerceIdentifierPaymentInfos)
pCommerceIdentifierPaymentInfos - protected void initializeItemPayment(Order pOrder)
initializeItemPayment method creates a CommerceItemPaymentInfo
for each CommerceItem in the Order. A CommerceItemPaymentInfo is a
CommerceIdentifierPaymentInfo used for CommerceItem payment information.
This also removes any CommerceIdentifierPaymentInfo objects previously associated
with each CommerceItem.pOrder - an Order valueprotected void initializeShippingPayment(Order pOrder)
initializeShippingPayment method creates a ShippingGroupPaymentInfo
for each ShippingGroup in the Order. A ShippingGroupPaymentInfo is a
CommerceIdentifierPaymentInfo used for ShippingGroup payment information.
This also removes any CommerceIdentifierPaymentInfo objects previously associated
with each ShippingGroup.pOrder - an Order valueprotected void initializeOrderPayment(Order pOrder)
initializeOrderPayment method creates an OrderPaymentInfo, which
is a CommerceIdentifierPaymentInfo used for Order payment information.
This also removes any CommerceIdentifierPaymentInfo objects previously associated
with the Order.pOrder - an Order valueprotected void initializeTaxPayment(Order pOrder)
initializeTaxPayment method creates a TaxPaymentInfo, which
is a CommerceIdentifierPaymentInfo used for tax payment information.
This also removes any CommerceIdentifierPaymentInfo objects previously associated
with the Order.pOrder - an Order valueprotected void initializeBasedOnOrder(Order pOrder)
initializeBasedOnOrder method creates
CommerceIdentifierPaymentInfo objects that reflect the current payment
information in the order.pOrder - an Order valuepublic void initializeCommerceIdentifierPaymentInfos(PaymentGroupRelationshipContainer pContainer)
pContainer - public java.lang.String getPaymentGroupName(PaymentGroup pPaymentGroup)
pPaymentGroup - public java.lang.String getNewPaymentGroupName(PaymentGroup pPaymentGroup)
pPaymentGroup - protected void initializeRequestParameters(DynamoHttpServletRequest pRequest)
initializeRequestParameters method gathers the necessary
input parameters and uses them to adjust initialization requirements.pRequest - a DynamoHttpServletRequest valuepublic PaymentGroup getDefaultPaymentGroup()
getDefaultPaymentGroupName method returns the default
PaymentGroup based on the PaymentGroupMapContainer's default PaymentGroup
name. Any .jhtml form can manipulate this property directly.String valueprotected void copyConfiguration()
PurchaseProcessConfiguration component. Property
values that were configured locally are preserved.
Configures the following properties (if not already set):
public void doStartService()
throws ServiceException
PurchaseProcessConfiguration
component.doStartService in class GenericServiceServiceException - if the Service had a problem starting uppublic void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
service method is used to initialize PaymentGroups and
CommerceIdentifierPaymentInfo objects. Initialization is based on input
parameters describing which PaymentGroups and CommerceIdentifierPaymentInfo
objects, if any, should be created and added to the appropriate container.
The resulting Collections of PaymentGroups and CommerceIdentifierPaymentInfos
are exposed via output parameters.service in class DynamoServletpRequest - a DynamoHttpServletRequest valuepResponse - a DynamoHttpServletResponse valuejavax.servlet.ServletException - if an error occursjava.io.IOException - if an error occursprotected void consolidatePaymentInfos(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
consolidatePaymentInfos consolidates CommerceIdentifierPaymentInfos
by ensuring there is no redundant data.pRequest - a DynamoHttpServletRequest valuepResponse - a DynamoHttpServletResponse valuejavax.servlet.ServletException - if an error occursjava.io.IOException - if an error occursprotected CommerceIdentifierPaymentInfo mergeCommerceIdentifierPaymentInfos(CommerceIdentifierPaymentInfo cipi1, CommerceIdentifierPaymentInfo cipi2)
mergeCommerceIdentifierPaymentInfos merges 2 CommerceIdentifierPaymentInfos
into one by combining their amounts and quantities.cipi1 - a CommerceIdentifierPaymentInfo valuecipi2 - a CommerceIdentifierPaymentInfo valueCommerceIdentifierPaymentInfo valuepublic boolean isAnyPaymentInfoExistsInContainter()