com.softslate.commerce.businessobjects.shipping
Class BaseShippingProcessor

java.lang.Object
  extended by com.softslate.commerce.businessobjects.core.BaseBusinessObject
      extended by com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
          extended by com.softslate.commerce.businessobjects.shipping.BaseShippingProcessor
All Implemented Interfaces:
BusinessObject, BusinessProcessor, ShippingProcessor
Direct Known Subclasses:
BasicShippingProcessor, UPSShippingProcessor, USPSShippingProcessor

public abstract class BaseShippingProcessor
extends BaseBusinessProcessor
implements ShippingProcessor

Abstract class that provides methods useful for ShippingProcessor implementations.

Author:
David Tobey

Field Summary
private  java.util.Collection availableOptions
           
(package private) static org.apache.commons.logging.Log log
           
private  java.lang.String shippingOption
           
 
Constructor Summary
BaseShippingProcessor()
           
 
Method Summary
 java.util.Collection getAvailableOptions()
           
 java.lang.String getShippingOption()
           
abstract  java.util.Collection loadShippingOptions()
           
 java.util.Collection loadShippingOptions(java.util.Map argument)
          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 setAvailableOptions(java.util.Collection availableOptions)
           
 void setShippingOption(java.lang.String string)
           
 void updateOrderWithOption()
          Sets the option the user selected in the user's order, by default in the order delivery's status details field.
 void updateOrderWithOptionPrice()
          Sets the shipping price in the order based on the option the user selected.
 void updateTotalsAndStatuses()
          Updates the totals and statuses of a user's order with a new shipping charge included.
 void updateTotalsAndStatusesInDatabase()
           
 boolean verifyOption()
          Verifies that the option the user selected is allowed by checking it against the Collection of avialable options.
 
Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
formatDateTime, formatPrice, getAppComponents, getAppSettings, getAttributeIDs, getBusinessObjectFactory, getDaoFactory, getProductIDs, getSettings, getUser, initialize, loadMatchingSkus, parseDateTime, parseResponseData, prepareRequestData, sendHTTPPost, setAppComponents, setAppSettings, setBusinessObjectFactory, setDaoFactory, setSettings, setUser, utils
 
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

availableOptions

private java.util.Collection availableOptions
Constructor Detail

BaseShippingProcessor

public BaseShippingProcessor()
Method Detail

getShippingOption

public java.lang.String getShippingOption()

setShippingOption

public void setShippingOption(java.lang.String string)

getAvailableOptions

public java.util.Collection getAvailableOptions()

setAvailableOptions

public void setAvailableOptions(java.util.Collection availableOptions)

loadShippingOptions

public java.util.Collection loadShippingOptions(java.util.Map argument)
                                         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
Parameters:
argument - A Map containing information from the current request.
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

loadShippingOptions

public abstract java.util.Collection loadShippingOptions()
                                                  throws java.lang.Exception
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

verifyOption

public boolean verifyOption()
Verifies that the option the user selected is allowed by checking it against the Collection of avialable options.

Returns:
true, if the option the user selected is allowed.

updateOrderWithOption

public void updateOrderWithOption()
Sets the option the user selected in the user's order, by default in the order delivery's status details field.


updateOrderWithOptionPrice

public void updateOrderWithOptionPrice()
Sets the shipping price in the order based on the option the user selected.


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, and subtotals.

Throws:
java.lang.Exception

updateTotalsAndStatusesInDatabase

public void updateTotalsAndStatusesInDatabase()
                                       throws java.lang.Exception
Throws:
java.lang.Exception


Copyright ? SoftSlate, LLC 2003?2005