Class DefaultFulfillmentOptionRequestService
- All Implemented Interfaces:
FulfillmentOptionRequestService
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultFulfillmentOptionRequestService
(FulfillmentGroupService fulfillmentGroupService, FulfillmentPricingConfigHelperService configHelper, CartOperationServiceProviders providers, CartPricingService cartPricingService, com.fasterxml.jackson.databind.ObjectMapper mapper, org.springframework.context.MessageSource messageSource, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAddressToGroups
(com.broadleafcommerce.order.common.domain.Address orderAddress, boolean overwrite, com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Set the given address on any fulfillment group that does not have an address set.protected void
addFulfillmentOptionToTarget
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.order.common.domain.PricedFulfillmentOption pricedFulfillmentOption, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Add thePricedFulfillmentOption
selected by the user to the correspondingFulfillmentGroup
orFulfillmentItem
.protected void
applySelectionErrors
(Map<String, Object> selectionErrors, com.broadleafcommerce.cart.client.domain.Cart updatedCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected CartFulfillmentResponse
buildCartFulfillmentResponse
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse pricingFulfillmentOptions, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequest
buildFulfillmentOptionRequest
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, boolean onlySelectedOptions, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Create pricing groups from the cart and build theFulfillmentOptionRequest
.protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequest
buildFulfillmentOptionRequest
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.In favor of the version that takes the onlySelectedOptions parameter: buildFulfillmentOptionRequest(Cart, FulfillmentPricingConfig, boolean onlySelectedOptions, ContextInfo)protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingGroup
buildFulfillmentPricingGroup
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Map<String, com.broadleafcommerce.cart.client.domain.CartItem> cartItemMap, com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingItem
buildFulfillmentPricingItem
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Map<String, com.broadleafcommerce.cart.client.domain.CartItem> cartItemMap, com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, String type) calculateOptionsAndGroups
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.Address defaultAddress, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Convenience method to get all fulfillment options for an address and assign defaults.collectSelectionErrors
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.fulfillment.common.domain.Address
convertToFulfillmentAddress
(com.broadleafcommerce.order.common.domain.Address orderAddress, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.order.common.domain.Address
convertToOrderAddress
(com.broadleafcommerce.fulfillment.common.domain.Address fulfillmentAddress, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequest
createRequest
(com.broadleafcommerce.cart.client.domain.Cart cart, Collection<com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingGroup> fulfillmentPricingGroups, boolean onlySelectedOptions, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Create a newFulfillmentOptionRequest
and populate with the given data.protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequest
createRequest
(com.broadleafcommerce.cart.client.domain.Cart cart, Collection<com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingGroup> fulfillmentPricingGroups, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.In favor of the version that takes the onlySelectedOptions parameter: createRequest(Cart, Collection, boolean onlySelectedOptions, FulfillmentPricingConfig, ContextInfo) protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse
fetchFulfillmentOptions
(com.broadleafcommerce.cart.client.domain.Cart cart, boolean onlySelectedOptions, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetch fulfillment options from theFulfillmentProvider
.com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig
fetchFulfillmentPriceConfig
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetch theFulfillmentPricingConfig
from theFulfillmentProvider
.protected Optional<com.broadleafcommerce.order.common.domain.PricedFulfillmentOption>
findLeastExpensiveOptionForFulType
(String fulfillmentType, List<com.broadleafcommerce.order.common.domain.PricedFulfillmentOption> pricedFulfillmentOptions) getCartItemMap
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Get Map of CartItem ID to CartItemprotected CartPricingService
protected FulfillmentPricingConfigHelperService
protected String
protected com.broadleafcommerce.fulfillment.common.domain.Dimensions
getDimension
(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) getFlatRates
(com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, com.broadleafcommerce.cart.client.domain.CartItem cartItem, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected FulfillmentGroupService
com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse
getFulfillmentOptionsForCart
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetch all available fulfillment options for the given cart.protected Collection<? extends com.broadleafcommerce.fulfillment.common.domain.FulfillmentOriginInfo>
getFulfillmentOriginInfos
(com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, com.broadleafcommerce.cart.client.domain.CartItem cartItem, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.fulfillment.common.domain.Weight
getFulfillmentWeight
(com.broadleafcommerce.cart.client.domain.CartItem cartItem) protected com.fasterxml.jackson.databind.ObjectMapper
protected org.springframework.context.MessageSource
protected CartOperationServiceProviders
protected com.broadleafcommerce.common.extension.TypeFactory
protected com.broadleafcommerce.order.common.domain.PricedFulfillmentOption
getUpdatedPFO
(com.broadleafcommerce.order.common.domain.PricedFulfillmentOption selectedOption, List<com.broadleafcommerce.order.common.domain.PricedFulfillmentOption> pricedFulfillmentOptions, Runnable configErrorCallback, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Get the up-to-datePricedFulfillmentOption
that corresponds to the selectedOption.protected Weight
getWeight
(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) protected boolean
matchesByServiceLevel
(com.broadleafcommerce.order.common.domain.PricedFulfillmentOption selectedPricedFulfillmentOption, com.broadleafcommerce.order.common.domain.PricedFulfillmentOption candidateOption, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determine if twoPricedFulfillmentOptions
have the same Fulfillment Type and Service Level.protected boolean
matchesSelectedOption
(com.broadleafcommerce.order.common.domain.PricedFulfillmentOption selectedPricedFulfillmentOption, com.broadleafcommerce.order.common.domain.PricedFulfillmentOption candidateOption, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determine if twoPricedFulfillmentOptions
have the same Fulfillment Type, Service Level, and Provider IDvoid
refreshOptions
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Refresh the selectedPricedFulfillmentOptions
on the cart.protected CartFulfillmentResponse
refreshOptionsAndGroups
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Refresh the selected fulfillment options, save the cart, and return the cart with all fulfillment options.protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse
refreshOptionsAndSyncGroups
(com.broadleafcommerce.cart.client.domain.Cart cart, boolean onlySelectedOptions, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetch up-to-datePricedFulfillmentOptions
and replace the corresponding options selected on the Cart with the updated version.protected void
refreshOptionsForGroups
(com.broadleafcommerce.cart.client.domain.Cart cart, Map<String, List<com.broadleafcommerce.order.common.domain.PricedFulfillmentOption>> fulRefToOpts, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected void
refreshOptionsForItems
(com.broadleafcommerce.cart.client.domain.Cart cart, Map<String, List<com.broadleafcommerce.order.common.domain.PricedFulfillmentOption>> fulRefToOpts, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected void
refreshSelectedOptions
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse fulfillmentOptionResponse, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update thePricedFulfillmentOption
selections on the cart to the latest versions from the FulfillmentOptionResponse.protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse
refreshSelectedOptionsAndGrouping
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.In favor of the refreshOptionsAndSyncGroups that takes the onlySelectedOptions parameter: refreshOptionsAndSyncGroups(Cart, boolean onlySelectedOptions, FulfillmentPricingConfig, ContextInfo)protected com.broadleafcommerce.cart.client.domain.Cart
saveCart
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected void
setConfigWarning
(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) protected void
setConfigWarning
(com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem) submitFulfillmentOption
(com.broadleafcommerce.order.common.domain.PricedFulfillmentOption pricedFulfillmentOption, com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Attaches givenPricedFulfillmentOptions
to their corresponding fulfillment item or group, then sorts the items into new fulfillment groupsupdateFulfillmentGroupAddress
(String referenceId, com.broadleafcommerce.fulfillment.common.domain.Address address, com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update theAddress
of aFulfillmentGroup
and refresh fulfillment options.
-
Field Details
-
FUL_ADDR_POBOX
- See Also:
-
FUL_ADDR_LAT
- See Also:
-
FUL_ADDR_LONG
- See Also:
-
-
Constructor Details
-
DefaultFulfillmentOptionRequestService
public DefaultFulfillmentOptionRequestService(FulfillmentGroupService fulfillmentGroupService, FulfillmentPricingConfigHelperService configHelper, CartOperationServiceProviders providers, CartPricingService cartPricingService, com.fasterxml.jackson.databind.ObjectMapper mapper, org.springframework.context.MessageSource messageSource, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
getFulfillmentOptionsForCart
public com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse getFulfillmentOptionsForCart(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:FulfillmentOptionRequestService
Fetch all available fulfillment options for the given cart.- Specified by:
getFulfillmentOptionsForCart
in interfaceFulfillmentOptionRequestService
- Parameters:
cart
- The cart to retrieve fulfillment options for.contextInfo
- The context of the request.- Returns:
- A
FulfillmentOptionResponse
withPricedFulfillmentOption
for either each item or each group, depending on configuration.
-
submitFulfillmentOption
public CartFulfillmentResponse submitFulfillmentOption(com.broadleafcommerce.order.common.domain.PricedFulfillmentOption pricedFulfillmentOption, com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Attaches givenPricedFulfillmentOptions
to their corresponding fulfillment item or group, then sorts the items into new fulfillment groups- Specified by:
submitFulfillmentOption
in interfaceFulfillmentOptionRequestService
- Parameters:
pricedFulfillmentOption
-cart
-contextInfo
-- Returns:
-
calculateOptionsAndGroups
public CartFulfillmentResponse calculateOptionsAndGroups(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.fulfillment.common.domain.Address defaultAddress, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:FulfillmentOptionRequestService
Convenience method to get all fulfillment options for an address and assign defaults. The address argument is optional and will be applied to any FulfillmentGroups that do not already have an address.- Specified by:
calculateOptionsAndGroups
in interfaceFulfillmentOptionRequestService
- Parameters:
cart
- The cart to whose items or groups will be used to fetch fulfillment options.defaultAddress
- An optionalAddress
to assign to any FulfillmentGroup that does not have an address already.contextInfo
- The context of the request.- Returns:
- A
CartFulfillmentResponse
that includes the availablePricedFulfillmentOptions
and an updated cart with default fulfillment options assigned to the targets.
-
updateFulfillmentGroupAddress
public CartFulfillmentResponse updateFulfillmentGroupAddress(String referenceId, com.broadleafcommerce.fulfillment.common.domain.Address address, com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:FulfillmentOptionRequestService
Update the
Address
of aFulfillmentGroup
and refresh fulfillment options.This method is intended for updating an Address outside the checkout flow, in order to get updated fulfillment options on a non-checkout page. Within a checkout flow, use
CheckoutCartEndpoint#updateFulfillmentGroupInCart
to ensure all the fields required for checkout are populated.- Specified by:
updateFulfillmentGroupAddress
in interfaceFulfillmentOptionRequestService
- Parameters:
referenceId
- The reference id of theFulfillmentGroup
to update.address
- TheAddress
to assign to the indicated FulfillmentGroup.cart
- The cart that contains the indicated FulfillmentGroup.contextInfo
- The context of the request.- Returns:
- A
CartFulfillmentResponse
that includes the availablePricedFulfillmentOptions
for the given address and an updated cart with valid fulfillment options assigned to the targets.
-
fetchFulfillmentPriceConfig
public com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig fetchFulfillmentPriceConfig(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:FulfillmentOptionRequestService
Fetch theFulfillmentPricingConfig
from theFulfillmentProvider
.- Specified by:
fetchFulfillmentPriceConfig
in interfaceFulfillmentOptionRequestService
- Parameters:
contextInfo
- The context of the request.- Returns:
- The
FulfillmentPricingConfig
for the given context.
-
refreshOptions
public void refreshOptions(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:FulfillmentOptionRequestService
Refresh the selected
PricedFulfillmentOptions
on the cart. Up-to-date options will be retrieved from theFulfillmentProvider
for the selected options on the cart.The selected
PricedFulfillmentOptions
on items and groups will be updated with an option that matches Fulfillment Type, Service Level, and Provider ID. If for any reason an exact match is not found, fallback logic will be used to determine an appropriate replacement.- Specified by:
refreshOptions
in interfaceFulfillmentOptionRequestService
- Parameters:
cart
- The cart whose fulfillment options should be refreshed.contextInfo
- The context of the request.
-
fetchFulfillmentOptions
protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse fetchFulfillmentOptions(com.broadleafcommerce.cart.client.domain.Cart cart, boolean onlySelectedOptions, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetch fulfillment options from theFulfillmentProvider
.- Parameters:
cart
- The cart being priced.onlySelectedOptions
- Indicate if all available fulfillment service levels should be fetched, or only the service level(s) that are selected on the cart.contextInfo
- The contextInfo of the request.- Returns:
- The
FulfillmentOptionResponse
that contains thePricedFulfillmentOptions
for the given cart.
-
buildFulfillmentOptionRequest
@Deprecated protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequest buildFulfillmentOptionRequest(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.In favor of the version that takes the onlySelectedOptions parameter: buildFulfillmentOptionRequest(Cart, FulfillmentPricingConfig, boolean onlySelectedOptions, ContextInfo)Create pricing groups from the cart and build theFulfillmentOptionRequest
.- Parameters:
cart
- The cart being priced.config
- TheFulfillmentPricingConfig
associated with the given contextInfo.contextInfo
- The contextInfo of the request.- Returns:
- The
FulfillmentOptionRequest
to send to the FulfillmentProvider.
-
buildFulfillmentOptionRequest
protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequest buildFulfillmentOptionRequest(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, boolean onlySelectedOptions, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Create pricing groups from the cart and build theFulfillmentOptionRequest
.- Parameters:
cart
- The cart being priced.config
- TheFulfillmentPricingConfig
associated with the given contextInfo.onlySelectedOptions
- Indicate if all available fulfillment service levels should be fetched, or only the service level(s) that are selected on the cart.contextInfo
- The contextInfo of the request.- Returns:
- The
FulfillmentOptionRequest
to send to the FulfillmentProvider.
-
buildFulfillmentPricingGroup
protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingGroup buildFulfillmentPricingGroup(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Map<String, com.broadleafcommerce.cart.client.domain.CartItem> cartItemMap, com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) -
buildFulfillmentPricingItem
protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingItem buildFulfillmentPricingItem(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Map<String, com.broadleafcommerce.cart.client.domain.CartItem> cartItemMap, com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, String type) -
getFulfillmentOriginInfos
protected Collection<? extends com.broadleafcommerce.fulfillment.common.domain.FulfillmentOriginInfo> getFulfillmentOriginInfos(com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, com.broadleafcommerce.cart.client.domain.CartItem cartItem, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getFlatRates
-
getFulfillmentWeight
protected com.broadleafcommerce.fulfillment.common.domain.Weight getFulfillmentWeight(com.broadleafcommerce.cart.client.domain.CartItem cartItem) -
getWeight
@Nullable protected Weight getWeight(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) -
getDimension
@Nullable protected com.broadleafcommerce.fulfillment.common.domain.Dimensions getDimension(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) -
createRequest
@Deprecated protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequest createRequest(com.broadleafcommerce.cart.client.domain.Cart cart, Collection<com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingGroup> fulfillmentPricingGroups, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.In favor of the version that takes the onlySelectedOptions parameter: createRequest(Cart, Collection, boolean onlySelectedOptions, FulfillmentPricingConfig, ContextInfo) Create a newFulfillmentOptionRequest
and populate with the given data.- Parameters:
cart
- The cart being priced.fulfillmentPricingGroups
- TheFulfillmentPricingGroups
to be added to the new request.config
- TheFulfillmentPricingConfig
associated with the given contextInfo.contextInfo
- The contextInfo of the request.- Returns:
- The
FulfillmentOptionRequest
to send to the FulfillmentProvider.
-
createRequest
protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequest createRequest(com.broadleafcommerce.cart.client.domain.Cart cart, Collection<com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingGroup> fulfillmentPricingGroups, boolean onlySelectedOptions, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Create a newFulfillmentOptionRequest
and populate with the given data.- Parameters:
cart
- The cart being priced.fulfillmentPricingGroups
- TheFulfillmentPricingGroups
to be added to the new request.onlySelectedOptions
- Indicate if all available fulfillment service levels should be fetched, or only the service level(s) that are selected on the cart.config
- TheFulfillmentPricingConfig
associated with the given contextInfo.contextInfo
- The contextInfo of the request.- Returns:
- The
FulfillmentOptionRequest
to send to the FulfillmentProvider.
-
addAddressToGroups
protected void addAddressToGroups(com.broadleafcommerce.order.common.domain.Address orderAddress, boolean overwrite, com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Set the given address on any fulfillment group that does not have an address set. If the override flag is true, then update the address on all groups, even if the group already has an address.- Parameters:
orderAddress
-cart
- The cart whose FulfillmentGroups will be checked.contextInfo
-
-
refreshOptionsAndGroups
protected CartFulfillmentResponse refreshOptionsAndGroups(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Refresh the selected fulfillment options, save the cart, and return the cart with all fulfillment options.- Parameters:
cart
- The cart being priced.config
- TheFulfillmentPricingConfig
associated with the given contextInfo.contextInfo
- The contextInfo of the request.- Returns:
- A
CartFulfillmentResponse
containing the updated cart and aFulfillmentOptionResponse
with up-to-date fulfillment options.
-
refreshSelectedOptionsAndGrouping
@Deprecated protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse refreshSelectedOptionsAndGrouping(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.In favor of the refreshOptionsAndSyncGroups that takes the onlySelectedOptions parameter: refreshOptionsAndSyncGroups(Cart, boolean onlySelectedOptions, FulfillmentPricingConfig, ContextInfo)Fetch up-to-datePricedFulfillmentOptions
and replace the corresponding options selected on the Cart with the updated version.- Parameters:
cart
- The cart being priced.config
- TheFulfillmentPricingConfig
associated with the given contextInfo.contextInfo
- The contextInfo of the request.- Returns:
- The
FulfillmentOptionResponse
that was fetched during the refresh. Depending on the value of the onlySelectedOptions parameter, it may contain all available fulfillment options, or only the updated versions of selected options.
-
refreshOptionsAndSyncGroups
protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse refreshOptionsAndSyncGroups(com.broadleafcommerce.cart.client.domain.Cart cart, boolean onlySelectedOptions, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetch up-to-datePricedFulfillmentOptions
and replace the corresponding options selected on the Cart with the updated version.- Parameters:
cart
- The cart being priced.onlySelectedOptions
- Indicate if the fetch operation should fetch updatedPricedFulfillmentOptions
for only the service levels selected in the Cart, or for all available service levels.config
- TheFulfillmentPricingConfig
associated with the given contextInfo.contextInfo
- The contextInfo of the request.- Returns:
- The
FulfillmentOptionResponse
that was fetched during the refresh. Depending on the value of the onlySelectedOptions parameter, it may contain all available fulfillment options, or only the updated versions of selected options.
-
refreshSelectedOptions
protected void refreshSelectedOptions(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse fulfillmentOptionResponse, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update thePricedFulfillmentOption
selections on the cart to the latest versions from the FulfillmentOptionResponse.- Parameters:
cart
- The cart being priced.fulfillmentOptionResponse
- Contains thePricedFulfillmentOptions
for the cart.config
- TheFulfillmentPricingConfig
associated with the given contextInfo.contextInfo
- The contextInfo of the request.
-
refreshOptionsForGroups
-
refreshOptionsForItems
-
getUpdatedPFO
@Nullable protected com.broadleafcommerce.order.common.domain.PricedFulfillmentOption getUpdatedPFO(com.broadleafcommerce.order.common.domain.PricedFulfillmentOption selectedOption, List<com.broadleafcommerce.order.common.domain.PricedFulfillmentOption> pricedFulfillmentOptions, Runnable configErrorCallback, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Get the up-to-datePricedFulfillmentOption
that corresponds to the selectedOption. If an exact match is not found, fall back to the least expensive option that matches the selected option'sFulfillmentType
. If there is still no match, fall back to the default FulfillmentType. Returns null if no suitable fallback is found.- Parameters:
selectedOption
- The stalePricedFulfillmentOption
that is attached to a group or item.pricedFulfillmentOptions
- The availablePricedFulfillmentOptions
for this group or item.configErrorCallback
- ARunnable
to execute if an exact match is not found. This is intended to call out to the appropriatesetConfigWarning
method to set a warning message for the user.contextInfo
- The contextInfo of the request.- Returns:
- The up-to-date
PricedFulfillmentOption
that corresponds to the given selectedOption.
-
findLeastExpensiveOptionForFulType
-
saveCart
protected com.broadleafcommerce.cart.client.domain.Cart saveCart(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
collectSelectionErrors
-
applySelectionErrors
-
buildCartFulfillmentResponse
protected CartFulfillmentResponse buildCartFulfillmentResponse(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse pricingFulfillmentOptions, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
setConfigWarning
protected void setConfigWarning(com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem) -
setConfigWarning
protected void setConfigWarning(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) -
addFulfillmentOptionToTarget
protected void addFulfillmentOptionToTarget(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.order.common.domain.PricedFulfillmentOption pricedFulfillmentOption, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Add thePricedFulfillmentOption
selected by the user to the correspondingFulfillmentGroup
orFulfillmentItem
.- Parameters:
cart
- The cart whose FulfillmentGroups or FulfillmentItems are being targeted for fulfillment.pricedFulfillmentOption
- ThePricedFulfillmentOption
selected by the user.
-
matchesSelectedOption
protected boolean matchesSelectedOption(com.broadleafcommerce.order.common.domain.PricedFulfillmentOption selectedPricedFulfillmentOption, com.broadleafcommerce.order.common.domain.PricedFulfillmentOption candidateOption, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determine if twoPricedFulfillmentOptions
have the same Fulfillment Type, Service Level, and Provider ID- Parameters:
selectedPricedFulfillmentOption
-candidateOption
-contextInfo
-- Returns:
-
matchesByServiceLevel
protected boolean matchesByServiceLevel(com.broadleafcommerce.order.common.domain.PricedFulfillmentOption selectedPricedFulfillmentOption, com.broadleafcommerce.order.common.domain.PricedFulfillmentOption candidateOption, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determine if twoPricedFulfillmentOptions
have the same Fulfillment Type and Service Level.- Parameters:
selectedPricedFulfillmentOption
-candidateOption
-contextInfo
-- Returns:
-
getCartItemMap
protected Map<String,com.broadleafcommerce.cart.client.domain.CartItem> getCartItemMap(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Get Map of CartItem ID to CartItem- Parameters:
cart
- The cart whose items should be put into the mapcontextInfo
- Request and user context- Returns:
- Map of CartItem ID to CartItem for the given cart.
-
convertToOrderAddress
protected com.broadleafcommerce.order.common.domain.Address convertToOrderAddress(com.broadleafcommerce.fulfillment.common.domain.Address fulfillmentAddress, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
convertToFulfillmentAddress
protected com.broadleafcommerce.fulfillment.common.domain.Address convertToFulfillmentAddress(com.broadleafcommerce.order.common.domain.Address orderAddress, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getDefaultFulfillmentType
-
getFulfillmentGroupService
-
getConfigHelper
-
getProviders
-
getCartPricingService
-
getMapper
protected com.fasterxml.jackson.databind.ObjectMapper getMapper() -
getMessageSource
protected org.springframework.context.MessageSource getMessageSource() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-