com.softslate.commerce.businessobjects.shipping
Class BaseShippingProcessor

java.lang.Object
  extended bycom.softslate.commerce.businessobjects.core.BaseBusinessObject
      extended bycom.softslate.commerce.businessobjects.core.BaseBusinessProcessor
          extended bycom.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
           
 
Fields inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
 
Constructor Summary
BaseShippingProcessor()
           
 
Method Summary
 java.lang.String getShippingOption()
           
abstract  java.util.Collection loadShippingOptions()
          Load the shipping options related to this ShippingProcessor.
abstract  int processShipping()
           
 java.util.Map processShipping(java.util.Map parameters)
          Assists with processing of shipping charges.
 void setShippingOption(java.lang.String string)
           
 void updateTotalsAndStatuses()
          Updates the totals and statuses of a user's order with a new shipping charge included.
 
Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
formatPrice, getBusinessObjectFactory, getDaoFactory, getSettingsBean, getUser, initialize, setBusinessObjectFactory, setDaoFactory, setSettingsBean, setUser
 
Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessObject
formatDateTime, parseDateTime, prepareRequestData, sendHTTPPost
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.softslate.commerce.businessobjects.core.BusinessObject
initialize
 

Field Detail

log

static org.apache.commons.logging.Log log

shippingOption

private java.lang.String shippingOption
Constructor Detail

BaseShippingProcessor

public BaseShippingProcessor()
Method Detail

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:

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. 2003–2005