Shipping Calculator Implementation
Shipping Calculator Implementation
- ShippingCostCalculationCapability
- ShippingOptionListCapability
- ShippingOptionListAllCapability
- ShippingOptionListPerDestinationCapability
Capability | Methods Defined |
---|---|
ShippingCostCalculationCapability | None, a marker interface to designate which capability interfaces are shipping calculation ones. |
ShippingOptionListCapability | getUnpricedShippingOptions(ShippableItemContainer<?>
unpricedShippableItemContainer); Returns a List<ShippingOption> object that lists all shipping options for an unpriced lookup. |
ShippingOptionListAllCapability | getAllShippingOptions(String storeCode, Locale
locale); Returns a List<ShippingOption> object that lists all shipping options for the specific store. |
ShippingOptionListPerDestinationCapability |
getUnpricedShippingOptions(ShippingAddress destinationAddress, String storeCode, Locale locale); Returns a List<ShippingOption> object that lists all shipping options for the given store and destination address. |
Caching Implementation
- The CachingShippingCalculationServiceImpl class, which implements ShippingCalculationService. The ShippingCalculationService implementation provides cached shipping options to the user through the ShippingOptionService.
- The ShippingCalculationResultCacheKey interface and a default implementation of this interface, ShippingCalculationResultCacheKeyImpl. This implementation defines information as a key to retrieve the cached shipping option.
- The ShippingCalculationResultCacheKeyBuilder interface and default implementation of this interface, ShippingCalculationResultCacheKeyBuilder. Use this class to create cache keys for shipping options.
Selection of a Shipping Calculation Plugin
The selection of a shipping calculation plugin is defined in the PricedShippingCalculationPluginSelector and UnpricedShippingCalculationPluginSelector interfaces in the com.elasticpath.shipping.connectivity.service.selector package. The default implementation of these interfaces returns the default Elastic Path shipping calculator plugin.
A selector might choose different plugins based on the Elastic Path store being serviced for store-specific shipping plugins. A selector can also choose a different plugin depending on what is being shipped. For example, if you want high value goods to be shipped by a particular shipping provider, such as FedEx rather than USPS, you can implement that functionality in the selector class.
- PricedShippingCalculationPluginSelector.getPricedShippingCalculationPlugin()
- UnpricedShippingCalculationPluginSelector.getUnpricedShippingCalculationPlugin()
These implementations must provide logic to select your shipping calculation plugin, however the default setting must be to select Elastic Path's default shipping calculator plugin.