Class CartItemValidationActivity
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.service.checkout.workflow.activity.CartItemValidationActivity
-
- All Implemented Interfaces:
CheckoutWorkflowActivity
public class CartItemValidationActivity extends Object implements CheckoutWorkflowActivity
ThisCheckoutWorkflowActivityis responsible for validating that the cart'sCartItemsinclude all necessary selections and data so that we can clearly understand what is being purchased and must later be fulfilled.- Author:
- Chad Harchar (charchar), Chris Kittrell (ckittrell)
-
-
Constructor Summary
Constructors Constructor Description CartItemValidationActivity(CatalogProvider catalogProvider, CartItemConfigurationService cartItemConfigurationService, org.springframework.context.MessageSource messageSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.broadleafcommerce.cart.client.domain.Cartexecute(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String requestId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Method responsible for executing some work against the cart that is required for checkout.protected Map<String,String>gatherCartItemConfigErrors(com.broadleafcommerce.cart.client.domain.CartItem cartItem)Gathers all of the config error messages for theCartIteminto a map.protected CartItemConfigurationServicegetCartItemConfigurationService()protected CatalogProvidergetCatalogProvider()protected org.springframework.context.MessageSourcegetMessageSource()protected StaleCartItemsServicegetStaleCartItemsService()com.broadleafcommerce.cart.client.domain.Cartrollback(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String requestId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Method responsible for rolling back any work that was done during the execution of the#execute(Cart, String)method.voidsetStaleCartItemsService(StaleCartItemsService staleCartItemsService)protected voidvalidateCartItems(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Validates that each of the cart'sCartItemsinclude all necessary selections and data
-
-
-
Constructor Detail
-
CartItemValidationActivity
public CartItemValidationActivity(CatalogProvider catalogProvider, CartItemConfigurationService cartItemConfigurationService, org.springframework.context.MessageSource messageSource)
-
-
Method Detail
-
execute
public com.broadleafcommerce.cart.client.domain.Cart execute(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:CheckoutWorkflowActivityMethod responsible for executing some work against the cart that is required for checkout. This may include, but is not limited to, cart validation checks, inventory reservations, or payment authorizations.- Specified by:
executein interfaceCheckoutWorkflowActivity- Parameters:
cart- TheCartthat we're attempting to checkout with.requestId- The id used to identify changes tied to the specific execution requestcontextInfo- Context information around sandbox and multitenant state.- Returns:
- The final state of the cart following the execution of the activity.
-
rollback
public com.broadleafcommerce.cart.client.domain.Cart rollback(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:CheckoutWorkflowActivityMethod responsible for rolling back any work that was done during the execution of the#execute(Cart, String)method.- Specified by:
rollbackin interfaceCheckoutWorkflowActivity- Parameters:
cart- TheCartthat we were attempting to checkout with, but ran into an exception/error.requestId- The id used to identify changes tied to the specific execution requestcontextInfo- Context information around sandbox and multitenant state.- Returns:
- The final state of the cart following the rollback of the activity.
-
validateCartItems
protected void validateCartItems(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Validates that each of the cart'sCartItemsinclude all necessary selections and data- Parameters:
cart-contextInfo- Context information around sandbox and multitenant state.
-
gatherCartItemConfigErrors
protected Map<String,String> gatherCartItemConfigErrors(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
Gathers all of the config error messages for theCartIteminto a map.- Parameters:
cartItem-- Returns:
- the map of CartItem config error messages
-
getCatalogProvider
protected CatalogProvider getCatalogProvider()
-
getCartItemConfigurationService
protected CartItemConfigurationService getCartItemConfigurationService()
-
getMessageSource
protected org.springframework.context.MessageSource getMessageSource()
-
setStaleCartItemsService
@Autowired public void setStaleCartItemsService(StaleCartItemsService staleCartItemsService)
-
getStaleCartItemsService
protected StaleCartItemsService getStaleCartItemsService()
-
-