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.FulfillmentPricingConfig
fetchFulfillmentPriceConfig
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetch theFulfillmentPricingConfig
from theFulfillmentProvider
.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.void
refreshOptions
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Refresh the selectedPricedFulfillmentOptions
on 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 givenPricedFulfillmentOption
to 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 theAddress
of aFulfillmentGroup
and 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
FulfillmentOptionResponse
withPricedFulfillmentOption
for 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 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.
-
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 givenPricedFulfillmentOption
to its target and then refresh options.- Parameters:
pricedFulfillmentOption
- ThePricedFulfillmentOption
that the user has selected.cart
- The user's cart being operated on.contextInfo
- The context of the request.- Returns:
- A
CartFulfillmentResponse
that includes the availablePricedFulfillmentOptions
and 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
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.- 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
com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig fetchFulfillmentPriceConfig(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetch theFulfillmentPricingConfig
from theFulfillmentProvider
.- Parameters:
contextInfo
- The context of the request.- Returns:
- The
FulfillmentPricingConfig
for 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
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.- Parameters:
cart
- The cart whose fulfillment options should be refreshed.contextInfo
- The context of the request.
-