Class BandedFulfillmentPricingProvider
java.lang.Object
com.broadleafcommerce.shipping.banded.provider.BandedFulfillmentPricingProvider
- All Implemented Interfaces:
FulfillmentPricingProvider
@Deprecated
public class BandedFulfillmentPricingProvider
extends Object
implements FulfillmentPricingProvider
Deprecated.
Since 1.7.0. Moved to shipping service.
Banded implementation of
FulfillmentPricingProvider
for implementations that require
banded (or tiered) shipping configuration for its fulfillment options based on minimum price or
weight. For fixed shipping, see FixedFulfillmentPricingProvider
. Alternatively, a
FulfillmentPricingProvider
integrated with a 3rd party, such as ShipEngine, is preferred.
This implementation takes in a BandedFulfillmentPricingConfig
provided by
BandedFulfillmentPricingProperties.getConfigPath()
. This property can be configured with
Spring Config Server, including
Broadleaf's own implementation. This will allow changes to the property value to be reinitialized
by this provider, as long as the declaring bean for this provider is annotated with
@RefreshScope
.
- Author:
- Chad Harchar (charchar)
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionBandedFulfillmentPricingProvider
(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, BandedFulfillmentPricingProperties bandedProps) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprotected FulfillmentOptionPricedResponse
buildFulfillmentOptionPricedResponse
(@NonNull javax.money.MonetaryAmount price, @NonNull Map<FulfillmentPricingItem, javax.money.MonetaryAmount> itemToPriceMap, @NonNull BandedFulfillmentPricingOption fulfillmentOption, boolean isEstimate) Deprecated.Builds aFulfillmentOptionPricedResponse
with the given inputs.protected Map<FulfillmentPricingItem,
javax.money.MonetaryAmount> buildItemToPriceMap
(@NonNull FulfillmentPricingRequest request, @NonNull BandedFulfillmentPricingOption option, @NonNull FulfillmentOptionBand band) Deprecated.Builds a map ofFulfillmentPricingItems
to the calculated prices.calculateCostForFulfillmentGroup
(@NonNull FulfillmentPricingRequest fulfillmentPricingRequest) Deprecated.Calculate shipping for a request that includes a specified fulfillment option.protected FulfillmentOptionPricedResponse
calculateCostForFulfillmentGroupInternal
(@NonNull FulfillmentPricingRequest request, boolean isEstimate) Deprecated.Handles the shared logic ofcalculateCostForFulfillmentGroup(FulfillmentPricingRequest)
andestimateCostForFulfillmentGroup(FulfillmentPricingRequest)
.protected javax.money.MonetaryAmount
calculateFixedPriceForItem
(@NonNull FulfillmentPricingItem item, @NonNull BandedFulfillmentPricingOption option, @NonNull FulfillmentOptionBand band, @NonNull javax.money.CurrencyUnit currency) Deprecated.protected javax.money.MonetaryAmount
calculateFulfillmentGroupPriceBeforeAdjustments
(@NonNull FulfillmentOptionBand band, javax.money.CurrencyUnit expectedCurrency) Deprecated.protected javax.money.MonetaryAmount
calculatePercentageRateForItem
(@NonNull FulfillmentPricingItem item, @NonNull FulfillmentOptionBand band, @NonNull javax.money.CurrencyUnit currency) Deprecated.protected javax.money.MonetaryAmount
calculatePercentageRateForItems
(@NonNull FulfillmentPricingItem item, @NonNull FulfillmentOptionBand band, @NonNull javax.money.CurrencyUnit currency) Deprecated.protected javax.money.MonetaryAmount
calculatePriceForItem
(@NonNull FulfillmentPricingItem item, @NonNull BandedFulfillmentPricingOption option, @NonNull FulfillmentOptionBand band, @NonNull javax.money.CurrencyUnit currency) protected javax.money.MonetaryAmount
calculatePriceForItems
(@NonNull FulfillmentPricingItem item, @NonNull BandedFulfillmentPricingOption option, @NonNull FulfillmentOptionBand band, @NonNull javax.money.CurrencyUnit currency) Deprecated.Calculates the price for a fulfillment items.boolean
canCalculateCostForOption
(@NonNull String option) Deprecated.Whether this provider has knowledge of the provided option and thus can provide cost information for it.protected BigDecimal
convertToStandardWeightUnits
(@NonNull BigDecimal weight, @NonNull String units) Deprecated.Converts the given weight to the application's standard units.estimateCostForFulfillmentGroup
(@NonNull FulfillmentPricingRequest request) Deprecated.Estimate shipping for a request that includes a specified fulfillment option.protected final Optional<FulfillmentOptionBand>
findBand
(@NonNull BandedFulfillmentPricingOption option, @NonNull FulfillmentPricingRequest request) Deprecated.Finds the correctFulfillmentOptionBand
from theBandedFulfillmentPricingOption
for the givenFulfillmentPricingRequest
.protected Optional<FulfillmentOptionBand>
findCustomBand
(@NonNull BandedFulfillmentPricingOption option, @NonNull FulfillmentPricingRequest request) Deprecated.Extension point to handleBandTypes
not inDefaultBandTypes
.protected Optional<FulfillmentOptionBand>
findPriceBand
(@NonNull BandedFulfillmentPricingOption option, @NonNull FulfillmentPricingRequest request) Deprecated.Finds the correctprice-based
band
from theBandedFulfillmentPricingOption
for the givenFulfillmentPricingRequest
.protected Optional<FulfillmentOptionBand>
findWeightBand
(@NonNull BandedFulfillmentPricingOption option, @NonNull FulfillmentPricingRequest request) Deprecated.Finds the correctitem-weight-based
band
from theBandedFulfillmentPricingOption
for the givenFulfillmentPricingRequest
.protected BandedFulfillmentPricingConfig
Deprecated.protected BandedFulfillmentPricingProperties
Deprecated.protected BandedFulfillmentPricingOption
Deprecated.Builds aBandedFulfillmentPricingOption
with fields initialized to typical values.protected javax.money.MonetaryAmount
getMonetaryAmount
(javax.money.CurrencyUnit expectedCurrency, Set<FulfillmentPriceAmount> fulfillmentPriceAmounts) Deprecated.Find the corresponding price for the expected currency, otherwise return zero.protected com.fasterxml.jackson.databind.ObjectMapper
Deprecated.protected com.broadleafcommerce.common.extension.TypeFactory
Deprecated.void
init()
Deprecated.Reads in the configuration file defined byBandedFulfillmentPricingProperties.getConfigPath()
and initializesbandedFulfillmentPricingConfig
to the result.protected void
preRequest
(FulfillmentPricingRequest fulfillmentPricingRequest) Deprecated.providePricedFulfillmentOptions
(@NonNull FulfillmentPricingRequest request) Deprecated.Retrieve all possible priced fulfillment options for the provided request.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.shipping.FulfillmentPricingProvider
canProvidePricedFulfillmentOptions, getFulfillmentOptionPricingResponses
-
Field Details
-
KILOS_TO_LBS_RATIO
Deprecated.
-
-
Constructor Details
-
BandedFulfillmentPricingProvider
public BandedFulfillmentPricingProvider(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, BandedFulfillmentPricingProperties bandedProps) Deprecated.
-
-
Method Details
-
init
@PostConstruct public void init()Deprecated.Reads in the configuration file defined byBandedFulfillmentPricingProperties.getConfigPath()
and initializesbandedFulfillmentPricingConfig
to the result.- Throws:
UncheckedIOException
- Thrown when there is an error while reading the configuration file or converting its contents into aBandedFulfillmentPricingConfig
.IllegalStateException
- Thrown when there is not configuration file defined byBandedFulfillmentPricingProperties.getConfigPath()
.
-
calculateCostForFulfillmentGroup
public FulfillmentOptionPricedResponse calculateCostForFulfillmentGroup(@NonNull @NonNull FulfillmentPricingRequest fulfillmentPricingRequest) Deprecated.Description copied from interface:FulfillmentPricingProvider
Calculate shipping for a request that includes a specified fulfillment option.- Specified by:
calculateCostForFulfillmentGroup
in interfaceFulfillmentPricingProvider
- Parameters:
fulfillmentPricingRequest
- The request for which to calculate shipping.- Returns:
- Response object with calculated shipping cost for the provided request.
-
canCalculateCostForOption
Deprecated.Description copied from interface:FulfillmentPricingProvider
Whether this provider has knowledge of the provided option and thus can provide cost information for it.- Specified by:
canCalculateCostForOption
in interfaceFulfillmentPricingProvider
- Parameters:
option
- The option to consider whether this provider can calculate cost information.- Returns:
- Whether this provider has knowledge of the provided option and thus can provide cost information for it.
-
estimateCostForFulfillmentGroup
public FulfillmentOptionPricedResponse estimateCostForFulfillmentGroup(@NonNull @NonNull FulfillmentPricingRequest request) Deprecated.Description copied from interface:FulfillmentPricingProvider
Estimate shipping for a request that includes a specified fulfillment option.- Specified by:
estimateCostForFulfillmentGroup
in interfaceFulfillmentPricingProvider
- Parameters:
request
- The request for which to estimate shipping.- Returns:
- Response object with estimated shipping cost for the provided request.
-
providePricedFulfillmentOptions
public List<FulfillmentOptionPricedResponse> providePricedFulfillmentOptions(@NonNull @NonNull FulfillmentPricingRequest request) Deprecated.Description copied from interface:FulfillmentPricingProvider
Retrieve all possible priced fulfillment options for the provided request. Intended to be used to display options to the customer for selection.- Specified by:
providePricedFulfillmentOptions
in interfaceFulfillmentPricingProvider
- Parameters:
request
- The request for which to calculate shipping and return options.- Returns:
- All possible priced fulfillment options for the provided request.
-
calculateCostForFulfillmentGroupInternal
protected FulfillmentOptionPricedResponse calculateCostForFulfillmentGroupInternal(@NonNull @NonNull FulfillmentPricingRequest request, boolean isEstimate) Deprecated.Handles the shared logic ofcalculateCostForFulfillmentGroup(FulfillmentPricingRequest)
andestimateCostForFulfillmentGroup(FulfillmentPricingRequest)
. -
findBand
protected final Optional<FulfillmentOptionBand> findBand(@NonNull @NonNull BandedFulfillmentPricingOption option, @NonNull @NonNull FulfillmentPricingRequest request) Deprecated.Finds the correctFulfillmentOptionBand
from theBandedFulfillmentPricingOption
for the givenFulfillmentPricingRequest
.Extend
findCustomBand(BandedFulfillmentPricingOption, FulfillmentPricingRequest)
to handle anyBandTypes
not inDefaultBandTypes
.- Parameters:
option
- The fulfillment option to use to calculate pricing for therequest
request
- The request for which to calculate shipping- Returns:
- the correct
FulfillmentOptionBand
from theBandedFulfillmentPricingOption
for the givenFulfillmentPricingRequest
.
-
findPriceBand
protected Optional<FulfillmentOptionBand> findPriceBand(@NonNull @NonNull BandedFulfillmentPricingOption option, @NonNull @NonNull FulfillmentPricingRequest request) Deprecated.Finds the correctprice-based
band
from theBandedFulfillmentPricingOption
for the givenFulfillmentPricingRequest
.- Parameters:
option
- The fulfillment option to use to calculate pricing for therequest
request
- The request for which to calculate shipping- Returns:
- the correct
price-based
band
from theBandedFulfillmentPricingOption
for the givenFulfillmentPricingRequest
-
findWeightBand
protected Optional<FulfillmentOptionBand> findWeightBand(@NonNull @NonNull BandedFulfillmentPricingOption option, @NonNull @NonNull FulfillmentPricingRequest request) Deprecated.Finds the correctitem-weight-based
band
from theBandedFulfillmentPricingOption
for the givenFulfillmentPricingRequest
.- Parameters:
option
- The fulfillment option to use to calculate pricing for therequest
request
- The request for which to calculate shipping- Returns:
- the correct
item-weight-based
band
from theBandedFulfillmentPricingOption
for the givenFulfillmentPricingRequest
-
findCustomBand
protected Optional<FulfillmentOptionBand> findCustomBand(@NonNull @NonNull BandedFulfillmentPricingOption option, @NonNull @NonNull FulfillmentPricingRequest request) Deprecated.Extension point to handleBandTypes
not inDefaultBandTypes
.- Parameters:
option
- The fulfillment option to use to calculate pricing for therequest
request
- The request for which to calculate shipping- Returns:
- the correct
FulfillmentOptionBand
from theBandedFulfillmentPricingOption
for the givenFulfillmentPricingRequest
.
-
getDefaultBandedFulfillmentPricingOption
Deprecated.Builds aBandedFulfillmentPricingOption
with fields initialized to typical values.- Returns:
- a
BandedFulfillmentPricingOption
with fields initialized to typical values.
-
buildItemToPriceMap
protected Map<FulfillmentPricingItem,javax.money.MonetaryAmount> buildItemToPriceMap(@NonNull @NonNull FulfillmentPricingRequest request, @NonNull @NonNull BandedFulfillmentPricingOption option, @NonNull @NonNull FulfillmentOptionBand band) Deprecated.Builds a map ofFulfillmentPricingItems
to the calculated prices.- Parameters:
request
- The request for which to calculate shippingoption
- The fulfillment option to use to calculate pricing for therequest
band
- The band fromoption
appropriate for the items being priced- Returns:
- a map of
FulfillmentPricingItems
to the calculated prices.
-
buildFulfillmentOptionPricedResponse
protected FulfillmentOptionPricedResponse buildFulfillmentOptionPricedResponse(@NonNull @NonNull javax.money.MonetaryAmount price, @NonNull @NonNull Map<FulfillmentPricingItem, javax.money.MonetaryAmount> itemToPriceMap, @NonNull @NonNull BandedFulfillmentPricingOption fulfillmentOption, boolean isEstimate) Deprecated.Builds aFulfillmentOptionPricedResponse
with the given inputs.- Parameters:
price
- The value to set forFulfillmentOptionPricedResponse.getFulfillmentPriceCalculated()
.itemToPriceMap
- Map ofFulfillmentPricingItems
to their fulfillment pricesfulfillmentOption
- TheFulfillmentOption
that forms the basis of the responseisEstimate
- Whether this is for estimating the fulfillment pricing- Returns:
- a
FulfillmentOptionPricedResponse
for the given inputs.
-
calculateFulfillmentGroupPriceBeforeAdjustments
protected javax.money.MonetaryAmount calculateFulfillmentGroupPriceBeforeAdjustments(@NonNull @NonNull FulfillmentOptionBand band, javax.money.CurrencyUnit expectedCurrency) Deprecated. -
getMonetaryAmount
protected javax.money.MonetaryAmount getMonetaryAmount(javax.money.CurrencyUnit expectedCurrency, @Nullable Set<FulfillmentPriceAmount> fulfillmentPriceAmounts) Deprecated.Find the corresponding price for the expected currency, otherwise return zero.- Parameters:
expectedCurrency
- The expected currency to find a price forfulfillmentPriceAmounts
- The list of prices to search against- Returns:
- the corresponding price for the expected currency, otherwise return zero
-
calculatePriceForItem
@Deprecated protected javax.money.MonetaryAmount calculatePriceForItem(@NonNull @NonNull FulfillmentPricingItem item, @NonNull @NonNull BandedFulfillmentPricingOption option, @NonNull @NonNull FulfillmentOptionBand band, @NonNull @NonNull javax.money.CurrencyUnit currency) Deprecated.Calculates the price for a fulfillment item. By default this means the price for a single unit rather than all like units, i.e.,FulfillmentPricingItem.getUnitPrice()
is used notFulfillmentPricingItem.getSubtotal()
.- Parameters:
item
- TheFulfillmentPriceInfo
item to be pricedoption
- The applicableBandedFulfillmentPricingOption
for theitem
band
- The applicable band from theoption
for theitem
- Returns:
- the price for a fulfillment item.
-
calculatePriceForItems
protected javax.money.MonetaryAmount calculatePriceForItems(@NonNull @NonNull FulfillmentPricingItem item, @NonNull @NonNull BandedFulfillmentPricingOption option, @NonNull @NonNull FulfillmentOptionBand band, @NonNull @NonNull javax.money.CurrencyUnit currency) Deprecated.Calculates the price for a fulfillment items. By default this means the price for all units, i.e.,FulfillmentPricingItem.getMerchandiseTotalAmount()
.- Parameters:
item
- TheFulfillmentPriceInfo
item to be pricedoption
- The applicableBandedFulfillmentPricingOption
for theitem
band
- The applicable band from theoption
for theitem
- Returns:
- the price for a fulfillment items.
-
calculateFixedPriceForItem
protected javax.money.MonetaryAmount calculateFixedPriceForItem(@NonNull @NonNull FulfillmentPricingItem item, @NonNull @NonNull BandedFulfillmentPricingOption option, @NonNull @NonNull FulfillmentOptionBand band, @NonNull @NonNull javax.money.CurrencyUnit currency) Deprecated. -
calculatePercentageRateForItem
@Deprecated protected javax.money.MonetaryAmount calculatePercentageRateForItem(@NonNull @NonNull FulfillmentPricingItem item, @NonNull @NonNull FulfillmentOptionBand band, @NonNull @NonNull javax.money.CurrencyUnit currency) Deprecated. -
calculatePercentageRateForItems
protected javax.money.MonetaryAmount calculatePercentageRateForItems(@NonNull @NonNull FulfillmentPricingItem item, @NonNull @NonNull FulfillmentOptionBand band, @NonNull @NonNull javax.money.CurrencyUnit currency) Deprecated. -
convertToStandardWeightUnits
protected BigDecimal convertToStandardWeightUnits(@NonNull @NonNull BigDecimal weight, @NonNull @NonNull String units) Deprecated.Converts the given weight to the application's standard units. By default this will convert weights to pounds.- Parameters:
weight
- The magnitude of the weightunits
- The unit of the weight- Returns:
- the given weight in the application's standard unit of weight
-
preRequest
Deprecated. -
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()Deprecated. -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()Deprecated. -
getBandedProps
Deprecated. -
getBandedFulfillmentPricingConfig
Deprecated.
-