|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.softslate.commerce.customer.order.CheckoutUtilsImpl
public class CheckoutUtilsImpl
CheckoutUtilsImpl is the default implementation of the
CheckoutUtils interface for the application.
CheckoutUtils| Field Summary | |
|---|---|
(package private) static org.apache.commons.logging.Log |
log
|
| Constructor Summary | |
|---|---|
CheckoutUtilsImpl()
|
|
| Method Summary | |
|---|---|
void |
addInventoryMessages(java.util.Map results,
BaseForm baseForm)
|
java.lang.String |
findCheckoutScreen(BaseForm baseForm)
Determines what checkout screen to direct the user to based on the status of the session and the store's database configuration. |
java.util.Map |
findShippingOptionFromOrder(java.util.Collection options,
Order order,
BaseForm baseForm)
|
java.util.Collection |
loadShippingOptions(BaseForm baseForm)
Loads the active shipping options for display to the user. |
void |
prepareCheckoutAddressesForm(CheckoutAddressesForm baseForm)
Initializes an instance of CheckoutAddressesForm with
address and shipping option information. |
void |
prepareCheckoutShippingForm(BaseForm baseForm)
Initializes an instance of CheckoutAddressesForm with
address and shipping option information. |
void |
prepareLoginForm(BaseForm baseForm,
org.apache.struts.action.ActionServlet servlet)
Initializes an instance of LoginForm and populates it from
request parameters. |
void |
preparePaymentForm(org.apache.struts.action.ActionForm paymentForm,
BaseForm baseForm,
org.apache.struts.action.ActionServlet servlet)
Prepares a given payment form by populating its properties from the request's parameters. |
void |
preparePaymentForms(BaseForm baseForm,
org.apache.struts.action.ActionServlet servlet)
Creates payment form instances and populates them from the request parameters. |
void |
prepareRegisterForm(BaseForm baseForm,
org.apache.struts.action.ActionServlet servlet)
Initializes an instance of RegisterForm and populates it
from request parameters. |
java.lang.String |
processCartAddResults(java.util.Map results,
BaseForm baseForm)
|
org.apache.struts.action.ActionForward |
processCheckoutAddresses(BaseForm baseForm)
Processes submissions to record addresses in the current user's cart. |
org.apache.struts.action.ActionForward |
processCheckoutAddresses(BaseForm baseForm,
javax.servlet.http.HttpServletResponse response)
Processes submissions to record addresses in the current user's cart. |
org.apache.struts.action.ActionForward |
processCheckoutConfirm(BaseForm baseForm)
Processes a request to confirm an order. |
org.apache.struts.action.ActionForward |
processCheckoutLogin(BaseForm baseForm,
javax.servlet.http.HttpServletResponse response)
Processes a login request during the checkout process. |
org.apache.struts.action.ActionForward |
processCheckoutPayment(BaseForm baseForm,
org.apache.struts.action.ActionServlet servlet)
Processes submissions of payment information by the current user. |
org.apache.struts.action.ActionForward |
processCheckoutRegister(BaseForm baseForm)
Processes a request to register a new customer account during the checkout process. |
org.apache.struts.action.ActionForward |
processCheckoutShipping(BaseForm baseForm)
Processes submissions to record shipping options in the current user's cart. |
org.apache.struts.action.ActionForward |
processDeclineLogin(BaseForm baseForm)
Processes a request to continue the checkout process without logging in or creating an account. |
java.util.Map |
processInventoryDiscountCheck(BaseForm baseForm)
Performs a check on the inventory and processes discounting for the current user's cart. |
java.util.Map |
processOrderComplete(BaseForm baseForm)
Invoked when a order has just been completed. |
int |
processPayment(PaymentProcessor paymentProcessor,
org.apache.struts.action.ActionForm paymentForm,
BaseForm baseForm)
Processes payment information for a request with a given payment processor. |
void |
processSavedCartCookie(BaseForm baseForm,
java.util.Map parameters,
javax.servlet.http.HttpServletResponse response)
|
java.util.Map |
processShipping(BaseForm baseForm)
Processes shipping charges for the current user's cart. |
java.util.Map |
processTax(BaseForm baseForm)
Processes tax charges for the current user's cart. |
protected void |
saveErrors(javax.servlet.http.HttpServletRequest request,
org.apache.struts.action.ActionMessages errors)
|
protected void |
saveMessages(javax.servlet.http.HttpServletRequest request,
org.apache.struts.action.ActionMessages messages)
|
void |
sendLowStockEmails(java.util.Collection lowStockEmails,
BaseForm baseForm)
|
boolean |
validateBillingFields(BaseForm baseForm)
Validates the required billing address fields in the user's cart. |
boolean |
validateDeliveryFields(BaseForm baseForm)
Validates the required delivery address fields in the user's cart. |
boolean |
validatePaymentForm(org.apache.struts.action.ActionForm paymentForm,
BaseForm baseForm)
Validates a given payment form for a given request. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static org.apache.commons.logging.Log log
| Constructor Detail |
|---|
public CheckoutUtilsImpl()
| Method Detail |
|---|
public java.lang.String findCheckoutScreen(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtils
The above screen names correspond to
ActionForwards defined in the
"/WEB-INF/conf/order/struts-config-order.xml" file.
findCheckoutScreen in interface CheckoutUtils
baseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
java.lang.Exception
public boolean validateBillingFields(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtils
validateBillingFields in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
true if all the required billing fields are
present in the user's cart. false if not.
java.lang.Exception
public boolean validateDeliveryFields(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtils
validateDeliveryFields in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
true if all the required billing fields are
present in the user's cart. false if not.
java.lang.Exception
public void prepareLoginForm(BaseForm baseForm,
org.apache.struts.action.ActionServlet servlet)
throws java.lang.Exception
CheckoutUtilsLoginForm and populates it from
request parameters. Used on the invite login screen and the force login
screen.
prepareLoginForm in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
java.lang.Exception
public void prepareRegisterForm(BaseForm baseForm,
org.apache.struts.action.ActionServlet servlet)
throws java.lang.Exception
CheckoutUtilsRegisterForm and populates it
from request parameters. Used on the checkout register screen.
prepareRegisterForm in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
java.lang.Exception
public org.apache.struts.action.ActionForward processCheckoutLogin(BaseForm baseForm,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception
CheckoutUtils
The method runs
CustomerProcessor.processLogin(Map)
to process the login request.
processCheckoutLogin in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
ActionForward corresponding to the results of
the processing. The ActionForward will be named
"failureInvalidLogin" or "success".
java.lang.Exception
public org.apache.struts.action.ActionForward processCheckoutRegister(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtils
This method runs
CustomerProcessor.processRegister(Map)
to process the register request.
processCheckoutRegister in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
ActionForward corresponding to the results of
the processing. The ActionForward will be named
"failureUserName" if the user name is already taken, or
"success".
java.lang.Exception
public org.apache.struts.action.ActionForward processDeclineLogin(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtilsThis method places an attribute in the user's session named "declinedLoginBeforeCheckout".
processDeclineLogin in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
ActionForward corresponding to the results of
the processing. Always returns the "success"
ActionForward.
java.lang.Exception
public java.util.Collection loadShippingOptions(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtilsloadShippingOptions method in each to get the available
options.
loadShippingOptions in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
Collection containing each of the shipping
option available for the user to select.
java.lang.ExceptionShippingProcessor.loadShippingOptions(Map)
public java.util.Map findShippingOptionFromOrder(java.util.Collection options,
Order order,
BaseForm baseForm)
public void prepareCheckoutAddressesForm(CheckoutAddressesForm baseForm)
throws java.lang.Exception
CheckoutUtilsCheckoutAddressesForm with
address and shipping option information. Used on the checkout addresses
screen. If the current user is a logged in customer, populates the form
with the account's address information.
prepareCheckoutAddressesForm in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
java.lang.Exception
public void prepareCheckoutShippingForm(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtilsCheckoutAddressesForm with
address and shipping option information. Used on the checkout addresses
screen. If the current user is a logged in customer, populates the form
with the account's address information.
prepareCheckoutShippingForm in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
java.lang.Exception
public org.apache.struts.action.ActionForward processCheckoutAddresses(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtils
Invokes
CartProcessor.processCheckoutAddresses(Map)
to process the submitted address information. Then invokes
CheckoutUtils.processInventoryDiscountCheck(BaseForm) to perform a check on
inventory and discounts for items in the cart.
processCheckoutAddresses in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
ActionForward corresponding to the results of
the processing. The ActionForward will be named
"failureItemsAdjusted", "failureAllItemsRemoved", or "success".
java.lang.Exception
public org.apache.struts.action.ActionForward processCheckoutAddresses(BaseForm baseForm,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception
CheckoutUtils
Invokes
CartProcessor.processCheckoutAddresses(Map)
to process the submitted address information. Then invokes
CheckoutUtils.processInventoryDiscountCheck(BaseForm) to perform a check on
inventory and discounts for items in the cart.
processCheckoutAddresses in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.response - The HttpServletResponse object associated with the request. If
present and the "autoSavedCartToken" cookie is present, that
cookie will be removed so no personal information is
retrievable through the cookie.
ActionForward corresponding to the results of
the processing. The ActionForward will be named
"failureItemsAdjusted", "failureAllItemsRemoved", or "success".
java.lang.Exception
public java.util.Map processInventoryDiscountCheck(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtils
processInventoryDiscountCheck in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
java.lang.Exception
public org.apache.struts.action.ActionForward processCheckoutShipping(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtils
Invokes CheckoutUtils.processShipping(BaseForm) to process shipping charges
and CheckoutUtils.processTax(BaseForm) to process tax charges.
processCheckoutShipping in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
ActionForward corresponding to the results of
the processing. The ActionForward will be named
"failureShippingProcess", "failureTaxProcess", "success",
"successNoPaymentRequired", or "successNoPaymentRequiredConfirm".
java.lang.Exception
public java.util.Map processShipping(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtils
Goes through the classes in the "activeShippingProcessors" database
setting and invokes the processShipping(Map) method in
each to process the charges. The incoming baseForm should
have a property named shippingOption containing the
shipping option selected by the user.
processShipping in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
java.lang.ExceptionShippingProcessor.processShipping(Map)
public java.util.Map processTax(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtils
Goes through the classes in the "activeTaxProcessors" database setting
and invokes the processTax(Map) method in each to process
the charges.
processTax in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
java.lang.Exception
public void preparePaymentForms(BaseForm baseForm,
org.apache.struts.action.ActionServlet servlet)
throws java.lang.Exception
CheckoutUtils
preparePaymentForms in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
java.lang.Exception
public void preparePaymentForm(org.apache.struts.action.ActionForm paymentForm,
BaseForm baseForm,
org.apache.struts.action.ActionServlet servlet)
throws java.lang.Exception
CheckoutUtils
preparePaymentForm in interface CheckoutUtilspaymentForm - The payment form being populated from the request.baseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
java.lang.Exception
public org.apache.struts.action.ActionForward processCheckoutPayment(BaseForm baseForm,
org.apache.struts.action.ActionServlet servlet)
throws java.lang.Exception
CheckoutUtils
Loops through each of the classes in the "activePaymentForms" and
"activePaymentProcessors" database settings to find the payment form that
was used to submit payment information, and its corresponding
PaymentProcessor.
Uses the "paymentFormCount" request parameter to determine which form was
submitted.
Invokes CheckoutUtils.validatePaymentForm(ActionForm, BaseForm) to validate
the submission, and if valid,
CheckoutUtils.processPayment(PaymentProcessor, ActionForm, BaseForm) to
process it.
If a confirmation screen must be displayed, this method places the
payment form and the name of the payment processor in the customer's
session, so that the processCheckoutConfirm method can
retrieve them.
processCheckoutPayment in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
ActionForward corresponding to the results of
the processing. The ActionForward will be named
"failureFormValidation", "failurePaymentProcess", "success", or
"successCheckoutConfirm".
java.lang.Exception
public boolean validatePaymentForm(org.apache.struts.action.ActionForm paymentForm,
BaseForm baseForm)
throws java.lang.Exception
CheckoutUtilsvalidate method of the payment form, saving any validation
errors to the request.
validatePaymentForm in interface CheckoutUtilspaymentForm - The payment form that was used by the user to submit payment
information.baseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
true if the submission passes validation.
false if not.
java.lang.Exception
public int processPayment(PaymentProcessor paymentProcessor,
org.apache.struts.action.ActionForm paymentForm,
BaseForm baseForm)
throws java.lang.Exception
CheckoutUtils
This method runs the processPayment(Map) method of the
incoming PaymentProcessor, which returns a Map that
includes a key named resultCode. This method returns the int value of
that resultCode.
If the resultCode is not equal to zero, it indicates an error in the
processing of the payment. This method will look up an error message in
the "/WEB-INF/classes/resources/payment/application.properties" file
corresponding to the resultCode and the name of the payment processor.
For example, the error message for the message key
payment.errorPayflowProProcessor10000 will be placed in
the request, if the payment processor was PayflowProProcessor and the
resultCode was 10000. Additional error messages that follow the same
naming pattern can be placed in the
"/WEB-INF/classes/resources/payment/application.properties" file.
processPayment in interface CheckoutUtilspaymentProcessor - The PaymentProcessor corresponding to the
payment form used by the user to submit payment information.baseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
true if the submission passes validation.
false if not.
java.lang.Exception
public org.apache.struts.action.ActionForward processCheckoutConfirm(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtilsprocessOrderComplete method is run.
processCheckoutConfirm in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
java.lang.Exception
public java.util.Map processOrderComplete(BaseForm baseForm)
throws java.lang.Exception
CheckoutUtilsUser object, as well as
the baseForm object in the request scope, for use by the
JSP templates that display the invoice and send out the notification and
confirmation emails.
processOrderComplete in interface CheckoutUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
java.lang.Exception
public void processSavedCartCookie(BaseForm baseForm,
java.util.Map parameters,
javax.servlet.http.HttpServletResponse response)
public java.lang.String processCartAddResults(java.util.Map results,
BaseForm baseForm)
public void addInventoryMessages(java.util.Map results,
BaseForm baseForm)
public void sendLowStockEmails(java.util.Collection lowStockEmails,
BaseForm baseForm)
protected void saveErrors(javax.servlet.http.HttpServletRequest request,
org.apache.struts.action.ActionMessages errors)
protected void saveMessages(javax.servlet.http.HttpServletRequest request,
org.apache.struts.action.ActionMessages messages)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||