com.softslate.commerce.businessobjects.shipping
Class BaseShippingProcessor
java.lang.Object
com.softslate.commerce.businessobjects.core.BaseBusinessObject
com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
com.softslate.commerce.businessobjects.shipping.BaseShippingProcessor
- All Implemented Interfaces:
- BusinessObject, BusinessProcessor, ShippingProcessor
- Direct Known Subclasses:
- BasicShippingProcessor
- public abstract class BaseShippingProcessor
- extends BaseBusinessProcessor
- implements ShippingProcessor
Abstract class that provides methods useful for
ShippingProcessor
implementations.
- Author:
- David Tobey
Field Summary |
(package private) static org.apache.commons.logging.Log |
log
|
private java.lang.String |
shippingOption
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
static org.apache.commons.logging.Log log
shippingOption
private java.lang.String shippingOption
BaseShippingProcessor
public BaseShippingProcessor()
getShippingOption
public java.lang.String getShippingOption()
setShippingOption
public void setShippingOption(java.lang.String string)
loadShippingOptions
public abstract java.util.Collection loadShippingOptions()
throws java.lang.Exception
- Description copied from interface:
ShippingProcessor
- Load the shipping options related to this
ShippingProcessor
.
Shipping options might include, for example, ground, 2-day air, bulk,
etc.
The Collection
returned should be a collection of
Map
objects that must include the following keys:
- code: A unique
String
code for the shipping option
under this shipping processor. E.g., "GROUND".
- name: The
String
name of the shipping option for
diplay to users. E.g., "Ground".
- price: The formatted price for the shipping option represented as a
String
and including currency formatting, for display to
the user.
- Specified by:
loadShippingOptions
in interface ShippingProcessor
- Returns:
- A
Collection
of Map
objects that
contain the code, name, and price for each shipping option
related to this ShippingProcessor
.
- Throws:
java.lang.Exception
processShipping
public abstract int processShipping()
throws java.lang.Exception
- Throws:
java.lang.Exception
processShipping
public java.util.Map processShipping(java.util.Map parameters)
throws java.lang.Exception
- Assists with processing of shipping charges. Copies the incoming
Map
of parameters to this
BaseShippingProcessor
instance and calls
processShipping()
followed by
updateTotalsAndStatuses()
to update the order's totals.
Finally, writes the new totals to the database using
OrderGatewayDAO.updateOrderAndDelivery(boolean, com.softslate.commerce.businessobjects.order.Order, com.softslate.commerce.businessobjects.order.OrderDelivery)
.
- Specified by:
processShipping
in interface ShippingProcessor
- Parameters:
parameters
- A Map containing the shipping infofmation submitted by the
user. It should contain a key named
shippingOption
that contains the
code
of the shipping option selected by the
user.
- Returns:
- A Map containing a least one key named "resultCode", which
contains a String parsable into an integer, representing the
results of the processing. 0 for the resultCode indicates
success, anything else indicates an error and that processing
should stop.
- Throws:
java.lang.Exception
updateTotalsAndStatuses
public void updateTotalsAndStatuses()
throws java.lang.Exception
- Updates the totals and statuses of a user's order with a new shipping
charge included. The user's
Order
and that order's first
OrderDelivery
are updated with new price totals,
subtotals, and taxable subtotals.
- Throws:
java.lang.Exception
Copyright © SoftSlate, Inc. 20032005