Class DefaultFulfillmentGroupService
java.lang.Object
com.broadleafcommerce.cartoperation.service.fulfillment.DefaultFulfillmentGroupService
- All Implemented Interfaces:
FulfillmentGroupService
-
Constructor Summary
ConstructorDescriptionDefaultFulfillmentGroupService
(FulfillmentPricingConfigHelperService configHelper, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
buildGroupReferenceNumber
(String cartId, String fulfillmentGroupId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds aFulfillmentGroup.getReferenceNumber()
for the given cart and group ID.protected void
checkItemsInGroup
(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Check the givenFulfillmentGroup
for any items with a different Fulfillment Type.protected void
clearFulfillmentPricing
(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) com.broadleafcommerce.cart.client.domain.FulfillmentGroup
createFulfillmentGroup
(String fulfillmentType, com.broadleafcommerce.order.common.domain.Address address, List<com.broadleafcommerce.cart.client.domain.FulfillmentItem> fulfillmentItems, String cartId, int groupIndex, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected FulfillmentPricingConfigHelperService
getFulGroupsByFulType
(com.broadleafcommerce.cart.client.domain.Cart cart) getItemsByFulfillmentTypeMap
(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) Should have either: empty if pricing by group for group, only changed items if pricing by item for group, mix of methods if pricing by item for item.protected com.broadleafcommerce.common.extension.TypeFactory
protected void
moveItemsToGroup
(List<com.broadleafcommerce.cart.client.domain.FulfillmentItem> itemsToMove, com.broadleafcommerce.cart.client.domain.FulfillmentGroup sourceGroup, com.broadleafcommerce.cart.client.domain.FulfillmentGroup destinationGroup, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, boolean priceByGroup) protected void
removeEmptyGroups
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected String
resolveTaxAddressSource
(String fulfillmentType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines the tax address source that should be used forFulfillmentGroup.getTaxAddressSource()
for the given fulfillment type.void
syncItemGrouping
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Scan theFulfillmentItems
to check if any need to move to a different fulfillment group.
-
Constructor Details
-
DefaultFulfillmentGroupService
public DefaultFulfillmentGroupService(FulfillmentPricingConfigHelperService configHelper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
createFulfillmentGroup
public com.broadleafcommerce.cart.client.domain.FulfillmentGroup createFulfillmentGroup(String fulfillmentType, com.broadleafcommerce.order.common.domain.Address address, List<com.broadleafcommerce.cart.client.domain.FulfillmentItem> fulfillmentItems, String cartId, int groupIndex, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) - Specified by:
createFulfillmentGroup
in interfaceFulfillmentGroupService
-
syncItemGrouping
public void syncItemGrouping(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Scan theFulfillmentItems
to check if any need to move to a different fulfillment group. If so, move them to an existing group or create a new group.- Specified by:
syncItemGrouping
in interfaceFulfillmentGroupService
- Parameters:
cart
-
-
checkItemsInGroup
protected void checkItemsInGroup(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Check the givenFulfillmentGroup
for any items with a different Fulfillment Type. Move items into new fulfillment groups if necessary- Parameters:
fulfillmentGroup
-cart
-config
-contextInfo
-
-
removeEmptyGroups
protected void removeEmptyGroups(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getFulGroupsByFulType
-
getItemsByFulfillmentTypeMap
protected Map<String,List<com.broadleafcommerce.cart.client.domain.FulfillmentItem>> getItemsByFulfillmentTypeMap(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) Should have either: empty if pricing by group for group, only changed items if pricing by item for group, mix of methods if pricing by item for item.- Parameters:
fulfillmentGroup
-- Returns:
-
moveItemsToGroup
protected void moveItemsToGroup(List<com.broadleafcommerce.cart.client.domain.FulfillmentItem> itemsToMove, com.broadleafcommerce.cart.client.domain.FulfillmentGroup sourceGroup, com.broadleafcommerce.cart.client.domain.FulfillmentGroup destinationGroup, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, boolean priceByGroup) -
buildGroupReferenceNumber
protected String buildGroupReferenceNumber(String cartId, String fulfillmentGroupId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds aFulfillmentGroup.getReferenceNumber()
for the given cart and group ID.- Parameters:
cartId
-fulfillmentGroupId
- ID of the fulfillment group for which to build a reference number. Usually defaults to the index of the group inCart.getFulfillmentGroups()
.- Returns:
- The new reference number
-
resolveTaxAddressSource
protected String resolveTaxAddressSource(String fulfillmentType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines the tax address source that should be used forFulfillmentGroup.getTaxAddressSource()
for the given fulfillment type.- Parameters:
fulfillmentType
- the fulfillment type from which to determine the tax address source- Returns:
- the tax address source that should be used
-
clearFulfillmentPricing
protected void clearFulfillmentPricing(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) -
getConfigHelper
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-