Class DefaultFulfillmentOptionRequestService
- All Implemented Interfaces:
FulfillmentOptionRequestService
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultFulfillmentOptionRequestService(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 voidaddAddressToGroups(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 voidaddFulfillmentOptionToTarget(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 thePricedFulfillmentOptionselected by the user to the correspondingFulfillmentGrouporFulfillmentItem.protected voidapplySelectionErrors(Map<String, Object> selectionErrors, com.broadleafcommerce.cart.client.domain.Cart updatedCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected CartFulfillmentResponsebuildCartFulfillmentResponse(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.FulfillmentOptionRequestbuildFulfillmentOptionRequest(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.FulfillmentOptionRequestbuildFulfillmentOptionRequest(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.FulfillmentPricingGroupbuildFulfillmentPricingGroup(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.FulfillmentPricingItembuildFulfillmentPricingItem(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.AddressconvertToFulfillmentAddress(com.broadleafcommerce.order.common.domain.Address orderAddress, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.order.common.domain.AddressconvertToOrderAddress(com.broadleafcommerce.fulfillment.common.domain.Address fulfillmentAddress, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequestcreateRequest(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 newFulfillmentOptionRequestand populate with the given data.protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequestcreateRequest(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.FulfillmentOptionResponsefetchFulfillmentOptions(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.FulfillmentPricingConfigfetchFulfillmentPriceConfig(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetch theFulfillmentPricingConfigfrom 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 CartPricingServiceprotected FulfillmentPricingConfigHelperServiceprotected Stringprotected com.broadleafcommerce.fulfillment.common.domain.DimensionsgetDimension(@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 FulfillmentGroupServicecom.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponsegetFulfillmentOptionsForCart(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.WeightgetFulfillmentWeight(com.broadleafcommerce.cart.client.domain.CartItem cartItem) protected com.fasterxml.jackson.databind.ObjectMapperprotected org.springframework.context.MessageSourceprotected CartOperationServiceProvidersprotected com.broadleafcommerce.common.extension.TypeFactoryprotected com.broadleafcommerce.order.common.domain.PricedFulfillmentOptiongetUpdatedPFO(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-datePricedFulfillmentOptionthat corresponds to the selectedOption.protected WeightgetWeight(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) protected booleanmatchesByServiceLevel(com.broadleafcommerce.order.common.domain.PricedFulfillmentOption selectedPricedFulfillmentOption, com.broadleafcommerce.order.common.domain.PricedFulfillmentOption candidateOption, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determine if twoPricedFulfillmentOptionshave the same Fulfillment Type and Service Level.protected booleanmatchesSelectedOption(com.broadleafcommerce.order.common.domain.PricedFulfillmentOption selectedPricedFulfillmentOption, com.broadleafcommerce.order.common.domain.PricedFulfillmentOption candidateOption, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determine if twoPricedFulfillmentOptionshave the same Fulfillment Type, Service Level, and Provider IDvoidrefreshOptions(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Refresh the selectedPricedFulfillmentOptionson the cart.protected CartFulfillmentResponserefreshOptionsAndGroups(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.FulfillmentOptionResponserefreshOptionsAndSyncGroups(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-datePricedFulfillmentOptionsand replace the corresponding options selected on the Cart with the updated version.protected voidrefreshOptionsForGroups(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 voidrefreshOptionsForItems(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 voidrefreshSelectedOptions(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 thePricedFulfillmentOptionselections on the cart to the latest versions from the FulfillmentOptionResponse.protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponserefreshSelectedOptionsAndGrouping(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.CartsaveCart(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidsetConfigWarning(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) protected voidsetConfigWarning(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 givenPricedFulfillmentOptionsto 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 theAddressof aFulfillmentGroupand 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:FulfillmentOptionRequestServiceFetch all available fulfillment options for the given cart.- Specified by:
getFulfillmentOptionsForCartin interfaceFulfillmentOptionRequestService- Parameters:
cart- The cart to retrieve fulfillment options for.contextInfo- The context of the request.- Returns:
- A
FulfillmentOptionResponsewithPricedFulfillmentOptionfor 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 givenPricedFulfillmentOptionsto their corresponding fulfillment item or group, then sorts the items into new fulfillment groups- Specified by:
submitFulfillmentOptionin 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:FulfillmentOptionRequestServiceConvenience 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:
calculateOptionsAndGroupsin interfaceFulfillmentOptionRequestService- Parameters:
cart- The cart to whose items or groups will be used to fetch fulfillment options.defaultAddress- An optionalAddressto assign to any FulfillmentGroup that does not have an address already.contextInfo- The context of the request.- Returns:
- A
CartFulfillmentResponsethat includes the availablePricedFulfillmentOptionsand 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:FulfillmentOptionRequestServiceUpdate the
Addressof aFulfillmentGroupand 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#updateFulfillmentGroupInCartto ensure all the fields required for checkout are populated.- Specified by:
updateFulfillmentGroupAddressin interfaceFulfillmentOptionRequestService- Parameters:
referenceId- The reference id of theFulfillmentGroupto update.address- TheAddressto assign to the indicated FulfillmentGroup.cart- The cart that contains the indicated FulfillmentGroup.contextInfo- The context of the request.- Returns:
- A
CartFulfillmentResponsethat includes the availablePricedFulfillmentOptionsfor 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:FulfillmentOptionRequestServiceFetch theFulfillmentPricingConfigfrom theFulfillmentProvider.- Specified by:
fetchFulfillmentPriceConfigin interfaceFulfillmentOptionRequestService- Parameters:
contextInfo- The context of the request.- Returns:
- The
FulfillmentPricingConfigfor 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:FulfillmentOptionRequestServiceRefresh the selected
PricedFulfillmentOptionson the cart. Up-to-date options will be retrieved from theFulfillmentProviderfor the selected options on the cart.The selected
PricedFulfillmentOptionson 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:
refreshOptionsin 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
FulfillmentOptionResponsethat contains thePricedFulfillmentOptionsfor 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- TheFulfillmentPricingConfigassociated with the given contextInfo.contextInfo- The contextInfo of the request.- Returns:
- The
FulfillmentOptionRequestto 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- TheFulfillmentPricingConfigassociated 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
FulfillmentOptionRequestto 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 newFulfillmentOptionRequestand populate with the given data.- Parameters:
cart- The cart being priced.fulfillmentPricingGroups- TheFulfillmentPricingGroupsto be added to the new request.config- TheFulfillmentPricingConfigassociated with the given contextInfo.contextInfo- The contextInfo of the request.- Returns:
- The
FulfillmentOptionRequestto 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 newFulfillmentOptionRequestand populate with the given data.- Parameters:
cart- The cart being priced.fulfillmentPricingGroups- TheFulfillmentPricingGroupsto 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- TheFulfillmentPricingConfigassociated with the given contextInfo.contextInfo- The contextInfo of the request.- Returns:
- The
FulfillmentOptionRequestto 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- TheFulfillmentPricingConfigassociated with the given contextInfo.contextInfo- The contextInfo of the request.- Returns:
- A
CartFulfillmentResponsecontaining the updated cart and aFulfillmentOptionResponsewith 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-datePricedFulfillmentOptionsand replace the corresponding options selected on the Cart with the updated version.- Parameters:
cart- The cart being priced.config- TheFulfillmentPricingConfigassociated with the given contextInfo.contextInfo- The contextInfo of the request.- Returns:
- The
FulfillmentOptionResponsethat 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-datePricedFulfillmentOptionsand 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 updatedPricedFulfillmentOptionsfor only the service levels selected in the Cart, or for all available service levels.config- TheFulfillmentPricingConfigassociated with the given contextInfo.contextInfo- The contextInfo of the request.- Returns:
- The
FulfillmentOptionResponsethat 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 thePricedFulfillmentOptionselections on the cart to the latest versions from the FulfillmentOptionResponse.- Parameters:
cart- The cart being priced.fulfillmentOptionResponse- Contains thePricedFulfillmentOptionsfor the cart.config- TheFulfillmentPricingConfigassociated 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-datePricedFulfillmentOptionthat 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 stalePricedFulfillmentOptionthat is attached to a group or item.pricedFulfillmentOptions- The availablePricedFulfillmentOptionsfor this group or item.configErrorCallback- ARunnableto execute if an exact match is not found. This is intended to call out to the appropriatesetConfigWarningmethod to set a warning message for the user.contextInfo- The contextInfo of the request.- Returns:
- The up-to-date
PricedFulfillmentOptionthat 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 thePricedFulfillmentOptionselected by the user to the correspondingFulfillmentGrouporFulfillmentItem.- Parameters:
cart- The cart whose FulfillmentGroups or FulfillmentItems are being targeted for fulfillment.pricedFulfillmentOption- ThePricedFulfillmentOptionselected 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 twoPricedFulfillmentOptionshave 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 twoPricedFulfillmentOptionshave 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()
-