@Service(value="blFulfillmentPricingService") public class FulfillmentPricingServiceImpl extends Object implements FulfillmentPricingService
Modifier and Type | Field and Description |
---|---|
protected FulfillmentGroupService |
fulfillmentGroupService |
protected static org.apache.commons.logging.Log |
LOG |
protected List<FulfillmentPricingProvider> |
providers |
Constructor and Description |
---|
FulfillmentPricingServiceImpl() |
Modifier and Type | Method and Description |
---|---|
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) |
protected static final org.apache.commons.logging.Log LOG
protected List<FulfillmentPricingProvider> providers
protected FulfillmentGroupService fulfillmentGroupService
public FulfillmentGroup calculateCostForFulfillmentGroup(FulfillmentGroup fulfillmentGroup) throws FulfillmentPriceException
FulfillmentPricingService
FulfillmentGroup
. This will loop through
#getProcessors()
and call FulfillmentPricingProvider.calculateCostForFulfillmentGroup(FulfillmentGroup)
on the first processor that returns true from FulfillmentPricingProvider#canCalculateCostForFulfillmentGroup(FulfillmentGroup)
calculateCostForFulfillmentGroup
in interface FulfillmentPricingService
FulfillmentPriceException
- if fulfillmentGroup does not have a FulfillmentOption associated to it or
if there was no processor found to calculate costs for fulfillmentGroupFulfillmentPricingProvider}
public FulfillmentEstimationResponse estimateCostForFulfillmentGroup(FulfillmentGroup fulfillmentGroup, Set<FulfillmentOption> options) throws FulfillmentPriceException
FulfillmentPricingService
FulfillmentGroup
with a FulfillmentOption
. The main use case for this method
is in a view cart controller that wants to provide estimations for different FulfillmentOption
s 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)
.estimateCostForFulfillmentGroup
in interface FulfillmentPricingService
FulfillmentGroup
with a candidate FulfillmentOption
FulfillmentPriceException
- if no processor was found to estimate costs for fulfillmentGroup with the given optionFulfillmentPricingProvider}
public List<FulfillmentPricingProvider> getProviders()
getProviders
in interface FulfillmentPricingService
public void setProviders(List<FulfillmentPricingProvider> providers)
Copyright © 2020. All rights reserved.