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.Logprivate String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoEstimatedDeliveryDate(Calendar shipDate, Integer deliveryDays) doEstimatedDeliveryDateWithShipDateToday(Integer deliveryDays) protected StringformatDeliveryDate(Calendar shipDate) protected booleanbooleanabstract CollectionloadShippingOptions(Map argument) Load the shipping options related to thisShippingProcessor.mergeRates(Collection mergedRates, Collection rates) booleanabstract intprocessShipping(Map parameters) Assists with processing of shipping charges.protected CalendarpushPastWeekendsAndHolidays(Calendar shipDate) Returns a Collection of Manufacturer objects associated with the order items in the given order, whose "isDropShipper" flag is set to true.voidsetAvailableOptions(Collection availableOptions) voidsetShippingOption(String string) protected voidvoidSets the option the user selected in the user's order, by default in the order delivery's status details field.voidSets the shipping price in the order based on the option the user selected.voidUpdates the totals and statuses of a user's order with a new shipping charge included.voidbooleanVerifies 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, utilsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:ShippingProcessorLoad the shipping options related to thisShippingProcessor.Shipping options might include, for example, ground, 2-day air, bulk, etc.
The
Collectionreturned should be a collection ofMapobjects that must include the following keys:- code: A unique
Stringcode for the shipping option under this shipping processor. E.g., "GROUND". - name: The
Stringname of the shipping option for diplay to users. E.g., "Ground". - price: The formatted price for the shipping option represented as a
Stringand including currency formatting, for display to the user. - priceDouble: The raw price for the shipping option represented as a
Double.
- Specified by:
loadShippingOptionsin interfaceShippingProcessor- Parameters:
argument- A Map containing information from the current request.- Returns:
- A
CollectionofMapobjects 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 incomingMapof parameters to thisBaseShippingProcessorinstance 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:
processShippingin interfaceShippingProcessor- Parameters:
parameters- A Map containing the shipping infofmation submitted by the user. It should contain a key namedshippingOptionthat contains thecodeof 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'sOrderand that order's firstOrderDeliveryare 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
-