Interface FulfillmentOptionRequestService
- All Known Implementing Classes:
DefaultFulfillmentOptionRequestService
-
Method Summary
Modifier and TypeMethodDescriptioncalculateOptionsAndGroups(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.Address address, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Convenience method to get all fulfillment options for an address and assign defaults.com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfigfetchFulfillmentPriceConfig(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetch theFulfillmentPricingConfigfrom theFulfillmentProvider.com.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.voidrefreshOptions(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Refresh the selectedPricedFulfillmentOptionson the cart.submitFulfillmentOption(com.broadleafcommerce.order.common.domain.PricedFulfillmentOption pricedFulfillmentOption, com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Attach the givenPricedFulfillmentOptionto its target and then refresh options.updateFulfillmentGroupAddress(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.
-
Method Details
-
getFulfillmentOptionsForCart
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.- 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.
-
calculateOptionsAndGroups
CartFulfillmentResponse calculateOptionsAndGroups(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.fulfillment.common.domain.Address address, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) 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.- Parameters:
cart- The cart to whose items or groups will be used to fetch fulfillment options.address- 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.
-
submitFulfillmentOption
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) Attach the givenPricedFulfillmentOptionto its target and then refresh options.- Parameters:
pricedFulfillmentOption- ThePricedFulfillmentOptionthat the user has selected.cart- The user's cart being operated on.contextInfo- The context of the request.- Returns:
- A
CartFulfillmentResponsethat includes the availablePricedFulfillmentOptionsand an updated cart with selected fulfillment option assigned.
-
updateFulfillmentGroupAddress
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) Update 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.- 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
com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig fetchFulfillmentPriceConfig(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetch theFulfillmentPricingConfigfrom theFulfillmentProvider.- Parameters:
contextInfo- The context of the request.- Returns:
- The
FulfillmentPricingConfigfor the given context.
-
refreshOptions
void refreshOptions(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Refresh 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.- Parameters:
cart- The cart whose fulfillment options should be refreshed.contextInfo- The context of the request.
-