Class DefaultFulfillmentGroupService
java.lang.Object
com.broadleafcommerce.cartoperation.service.fulfillment.DefaultFulfillmentGroupService
- All Implemented Interfaces:
FulfillmentGroupService
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultFulfillmentGroupService(FulfillmentPricingConfigHelperService configHelper, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildGroupReferenceNumber(String cartId, String fulfillmentGroupId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds aFulfillmentGroup.getReferenceNumber()for the given cart and group ID.protected voidcheckItemsInGroup(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 givenFulfillmentGroupfor any items with a different Fulfillment Type.protected voidclearFulfillmentPricing(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) com.broadleafcommerce.cart.client.domain.FulfillmentGroupcreateFulfillmentGroup(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 FulfillmentPricingConfigHelperServicegetFulGroupsByFulType(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.TypeFactoryprotected voidmoveItemsToGroup(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 voidremoveEmptyGroups(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected StringresolveTaxAddressSource(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.voidsyncItemGrouping(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig config, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Scan theFulfillmentItemsto 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:
createFulfillmentGroupin 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 theFulfillmentItemsto 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:
syncItemGroupingin 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 givenFulfillmentGroupfor 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()
-