org.broadleafcommerce.core.pricing.service
Class FulfillmentPricingServiceImpl

java.lang.Object
  extended by org.broadleafcommerce.core.pricing.service.FulfillmentPricingServiceImpl
All Implemented Interfaces:
FulfillmentPricingService

@Service(value="blFulfillmentPricingService")
public class FulfillmentPricingServiceImpl
extends Object
implements FulfillmentPricingService


Field Summary
protected  FulfillmentGroupService fulfillmentGroupService
           
protected static org.apache.commons.logging.Log LOG
           
protected  List<FulfillmentPricingProvider> providers
           
 
Constructor Summary
FulfillmentPricingServiceImpl()
           
 
Method Summary
 FulfillmentGroup calculateCostForFulfillmentGroup(FulfillmentGroup fulfillmentGroup)
          Called during the Pricing workflow to determine the cost for the FulfillmentGroup.
 FulfillmentEstimationResponse estimateCostForFulfillmentGroup(FulfillmentGroup fulfillmentGroup, Set<FulfillmentOption> options)
          This provides an estimation for a FulfillmentGroup with a FulfillmentOption.
 List<FulfillmentPricingProvider> getProviders()
           
 void setProviders(List<FulfillmentPricingProvider> providers)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG

providers

protected List<FulfillmentPricingProvider> providers

fulfillmentGroupService

protected FulfillmentGroupService fulfillmentGroupService
Constructor Detail

FulfillmentPricingServiceImpl

public FulfillmentPricingServiceImpl()
Method Detail

calculateCostForFulfillmentGroup

public FulfillmentGroup calculateCostForFulfillmentGroup(FulfillmentGroup fulfillmentGroup)
                                                  throws FulfillmentPriceException
Description copied from interface: FulfillmentPricingService
Called during the Pricing workflow to determine the cost for the FulfillmentGroup. This will loop through #getProcessors() and call FulfillmentPricingProvider.calculateCostForFulfillmentGroup(FulfillmentGroup) on the first processor that returns true from FulfillmentPricingProvider#canCalculateCostForFulfillmentGroup(FulfillmentGroup)

Specified by:
calculateCostForFulfillmentGroup in interface FulfillmentPricingService
Returns:
the updated fulfillmentGroup with its shippingPrice set
Throws:
FulfillmentPriceException - if fulfillmentGroup does not have a FulfillmentOption associated to it or if there was no processor found to calculate costs for fulfillmentGroup
See Also:
FulfillmentPricingProvider}

estimateCostForFulfillmentGroup

public FulfillmentEstimationResponse estimateCostForFulfillmentGroup(FulfillmentGroup fulfillmentGroup,
                                                                     Set<FulfillmentOption> options)
                                                              throws FulfillmentPriceException
Description copied from interface: FulfillmentPricingService
This provides an estimation for a FulfillmentGroup with a FulfillmentOption. The main use case for this method is in a view cart controller that wants to provide estimations for different FulfillmentOptions before the user actually selects one. This uses FulfillmentPricingService.getProviders() to allow third-party integrations to respond to estimations, and returns the first processor that returns true from FulfillmentPricingProvider.canCalculateCostForFulfillmentGroup(FulfillmentGroup, FulfillmentOption).

Specified by:
estimateCostForFulfillmentGroup in interface FulfillmentPricingService
Returns:
the price estimation for a particular FulfillmentGroup with a candidate FulfillmentOption
Throws:
FulfillmentPriceException - if no processor was found to estimate costs for fulfillmentGroup with the given option
See Also:
FulfillmentPricingProvider}

getProviders

public List<FulfillmentPricingProvider> getProviders()
Specified by:
getProviders in interface FulfillmentPricingService

setProviders

public void setProviders(List<FulfillmentPricingProvider> providers)


Copyright © 2012. All Rights Reserved.