|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.struts.action.Action com.softslate.commerce.customer.core.BaseAction com.softslate.commerce.customer.order.CheckoutAction
Struts action class that corresponds to the store's checkout link. Used for requests to "/Checkout.do" and as a superclass for all of the other action classes in the checkout process.
The execute
method of this class decides what checkout screen
to direct the user to based on the status of the session and the store's
database configuration.
The idea behind CheckoutAction
is to provide a single
superclass that manages nearly all of the forms and processing for the
checkout process. This allows developers to easily create custom checkout
screens by extending CheckoutAction
, using its methods in
different combinations.
Field Summary | |
(package private) static org.apache.commons.logging.Log |
log
|
Fields inherited from class org.apache.struts.action.Action |
defaultLocale, servlet |
Constructor Summary | |
CheckoutAction()
|
Method Summary | |
org.apache.struts.action.ActionForward |
execute(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Forwards the user to the appropriate checkout screen based on the status of the session and the store's database settings. |
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.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 |
prepareLoginForm(BaseForm baseForm)
Initializes an instance of LoginForm and populates it from
request parameters. |
void |
preparePaymentForm(org.apache.struts.action.ActionForm paymentForm,
BaseForm baseForm)
Prepares a given payment form by populating its properties from the request's parameters. |
void |
preparePaymentForms(BaseForm baseForm)
Creates payment form instances and populates them from the request parameters. |
void |
prepareRegisterForm(BaseForm baseForm)
Initializes an instance of RegisterForm and populates it
from request parameters. |
org.apache.struts.action.ActionForward |
processCheckoutAddresses(BaseForm baseForm)
Processes submissions to record addresses and shipping options 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)
Processes a login request during the checkout process. |
org.apache.struts.action.ActionForward |
processCheckoutPayment(BaseForm baseForm)
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 |
processDeclineLogin(BaseForm baseForm)
Processes a request to continue the checkout process without logging in or creating an account. |
void |
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. |
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. |
void |
sendInvoiceEmail(BaseForm baseForm)
Sends a copy of the invoice for an order that was just completed to the user. |
void |
sendNotificationEmail(BaseForm baseForm)
Sends a notification email for an order that was just completed to the store administrator. |
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 org.apache.struts.action.Action |
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet |
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 CheckoutAction()
Method Detail |
public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception
java.lang.Exception
public java.lang.String findCheckoutScreen(BaseForm baseForm) throws java.lang.Exception
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 void prepareCheckoutAddressesForm(CheckoutAddressesForm baseForm) throws java.lang.Exception
CheckoutAddressesForm
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.
baseForm
-
java.lang.Exception
public boolean validateBillingFields(BaseForm baseForm) throws java.lang.Exception
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 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
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 all the required billing fields are
present in the user's cart. false
if not.
java.lang.Exception
public java.util.Collection loadShippingOptions(BaseForm baseForm) throws java.lang.Exception
loadShippingOptions
method in each to get the available
options.
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.
Collection
containing each of the shipping
option available for the user to select.
java.lang.Exception
ShippingProcessor.loadShippingOptions()
public java.util.Map processShipping(BaseForm baseForm) throws java.lang.Exception
Loops 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.
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
ShippingProcessor.processShipping(Map)
public java.util.Map processTax(BaseForm baseForm) throws java.lang.Exception
Loops through the classes in the "activeTaxProcessors" database setting
and invokes the processTax(Map)
method in each to process
the charges.
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 processCheckoutAddresses(BaseForm baseForm) throws java.lang.Exception
Invokes
CartProcessor.processCheckoutAddresses(Map)
to process the submitted address information. Then invokes
processShipping(BaseForm)
to process shipping charges and
processTax(BaseForm)
to process tax charges.
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.
ActionForward
corresponding to the results of
the processing. The ActionForward
will be named
"failureShippingProcess", "failureTaxProcess", "success", or
"successNoPaymentRequired".
java.lang.Exception
public void preparePaymentForms(BaseForm baseForm) throws java.lang.Exception
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 void preparePaymentForm(org.apache.struts.action.ActionForm paymentForm, BaseForm baseForm) throws java.lang.Exception
paymentForm
- 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) throws java.lang.Exception
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 validatePaymentForm(ActionForm, BaseForm)
to validate
the submission, and if valid
processPayment(PaymentProcessor, ActionForm, BaseForm)
to
process it.
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.
ActionForward
corresponding to the results of
the processing. The ActionForward
will be named
"failureFormValidation", "failurePaymentProcess", or "success".
java.lang.Exception
public boolean validatePaymentForm(org.apache.struts.action.ActionForm paymentForm, BaseForm baseForm) throws java.lang.Exception
validate
method of the payment form, saving any validation
errors to the request.
paymentForm
- 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
The method runs the processPayment(Map)
method of the
incoming PaymentProcessor
.
paymentProcessor
- 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 void prepareLoginForm(BaseForm baseForm) throws java.lang.Exception
LoginForm
and populates it from
request parameters. Used on the invite login screen and the force login
screen.
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 void prepareRegisterForm(BaseForm baseForm) throws java.lang.Exception
RegisterForm
and populates it
from request parameters. Used on the checkout register screen.
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 processCheckoutLogin(BaseForm baseForm) throws java.lang.Exception
The method runs
CustomerProcessor.processLogin(Map)
to process the login 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.
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
The method runs
CustomerProcessor.processRegister(Map)
to process the register 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.
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
This method places an attribute in the user's session named "declinedLoginBeforeCheckout".
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.
ActionForward
corresponding to the results of
the processing. Always returns the "success"
ActionForward
.
java.lang.Exception
public org.apache.struts.action.ActionForward processCheckoutConfirm(BaseForm baseForm) throws java.lang.Exception
processOrderComplete
method is run.
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 void processOrderComplete(BaseForm baseForm) throws java.lang.Exception
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 void sendInvoiceEmail(BaseForm baseForm) throws java.lang.Exception
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 void sendNotificationEmail(BaseForm baseForm) throws java.lang.Exception
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |