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
,FedExShippingProcessor
,UPSShippingProcessor
,USPSShippingProcessor
public abstract class BaseShippingProcessor
extends BaseBusinessProcessor
implements ShippingProcessor
Abstract class that provides methods useful for
ShippingProcessor
implementations.- Author:
- David Tobey
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Collection
(package private) static org.apache.commons.logging.Log
private String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoEstimatedDeliveryDate
(Calendar shipDate, Integer deliveryDays) doEstimatedDeliveryDateWithShipDateToday
(Integer deliveryDays) protected String
formatDeliveryDate
(Calendar shipDate) protected boolean
boolean
abstract Collection
loadShippingOptions
(Map argument) Load the shipping options related to thisShippingProcessor
.mergeRates
(Collection mergedRates, Collection rates) boolean
abstract int
processShipping
(Map parameters) Assists with processing of shipping charges.protected Calendar
pushPastWeekendsAndHolidays
(Calendar shipDate) Returns a Collection of Manufacturer objects associated with the order items in the given order, whose "isDropShipper" flag is set to true.void
setAvailableOptions
(Collection availableOptions) void
setShippingOption
(String string) protected void
void
Sets the option the user selected in the user's order, by default in the order delivery's status details field.void
Sets the shipping price in the order based on the option the user selected.void
Updates the totals and statuses of a user's order with a new shipping charge included.void
boolean
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, getEventBus, getInjector, getProductIDs, getSettings, getUser, initialize, isProcessorClassActive, loadMatchingSkus, parseDateTime, parseResponseData, prepareRequestData, sendHTTPGet, sendHTTPPost, sendHTTPPost, setAppComponents, setAppSettings, setBusinessObjectFactory, setDaoFactory, setEventBus, setInjector, setSettings, setUser, updateOrderTotals, updateOrderTotals, updateOrderTotals, 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 Details
-
log
static org.apache.commons.logging.Log log -
shippingOption
-
availableOptions
-
dropShipperIDs
-
dropShippers
-
currentDropShipperID
-
-
Constructor Details
-
BaseShippingProcessor
public BaseShippingProcessor()
-
-
Method Details
-
getShippingOption
-
setShippingOption
-
getAvailableOptions
-
setAvailableOptions
-
loadShippingOptions
Description copied from interface:ShippingProcessor
Load the shipping options related to thisShippingProcessor
.Shipping options might include, for example, ground, 2-day air, bulk, etc.
The
Collection
returned should be a collection ofMap
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. - priceDouble: The raw price for the shipping option represented as a
Double
.
- Specified by:
loadShippingOptions
in interfaceShippingProcessor
- Parameters:
argument
- A Map containing information from the current request.- Returns:
- A
Collection
ofMap
objects that contain the code, name, and price for each shipping option related to thisShippingProcessor
. - Throws:
Exception
- code: A unique
-
loadShippingOptions
- Throws:
Exception
-
processShipping
- Throws:
Exception
-
processShipping
Assists with processing of shipping charges. Copies the incomingMap
of parameters to thisBaseShippingProcessor
instance and callsprocessShipping()
followed byupdateTotalsAndStatuses()
to update the order's totals. Finally, writes the new totals to the database usingOrderGatewayDAO.updateOrderAndDelivery(boolean, com.softslate.commerce.businessobjects.order.Order, com.softslate.commerce.businessobjects.order.OrderDelivery)
.- Specified by:
processShipping
in interfaceShippingProcessor
- Parameters:
parameters
- A Map containing the shipping infofmation submitted by the user. It should contain a key namedshippingOption
that contains thecode
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:
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. -
updateOrderDeliveryAddressIfPickUp
protected void updateOrderDeliveryAddressIfPickUp() -
updateTotalsAndStatuses
Updates the totals and statuses of a user's order with a new shipping charge included. The user'sOrder
and that order's firstOrderDelivery
are updated with new price totals, and subtotals.- Throws:
Exception
-
updateTotalsAndStatusesInDatabase
- Throws:
Exception
-
retrieveDropShippersFromOrder
Returns a Collection of Manufacturer objects associated with the order items in the given order, whose "isDropShipper" flag is set to true. Used by shipping processors such as the UPS processor to query for rates separately for each drop shipper.- Parameters:
order
-- Returns:
- A Collection of Manufacturer objects associated with the order items in the given order, whose "isDropShipper" flag is set to true
- Throws:
Exception
-
isPackageOkToCreate
-
findPackageWeight
-
mergeRates
-
doEstimatedDeliveryDateWithShipDateToday
-
doEstimatedDeliveryDate
-
formatDeliveryDate
-
pushPastWeekendsAndHolidays
-
isBlackedOutHoliday
-
orderHasGiftCertificatesOnly
-