Class CartFulfillmentValidationActivity
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.service.checkout.workflow.activity.CartFulfillmentValidationActivity
-
- All Implemented Interfaces:
CheckoutWorkflowActivity
public class CartFulfillmentValidationActivity extends Object implements CheckoutWorkflowActivity
Validates the fulfillment information on the cart. Delegates most validation to aFulfillmentGroupSubmitValidator.
-
-
Constructor Summary
Constructors Constructor Description CartFulfillmentValidationActivity(CartOperationServiceAutoConfiguration.ValidationConfiguration.FulfillmentCheckoutValidationConfig validationConfig, FulfillmentGroupSubmitValidator fulfillmentGroupSubmitValidator, org.springframework.context.MessageSource messageSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,String>convertErrors(@NonNull org.springframework.validation.Errors errors)Converts any errors in the errors container into a map using the field path and error code.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 FulfillmentGroupSubmitValidatorgetFulfillmentGroupSubmitValidator()protected StringgetMessage(@NonNull String errorMessage, Object... args)protected org.springframework.context.MessageSourcegetMessageSource()protected CartOperationServiceAutoConfiguration.ValidationConfiguration.FulfillmentCheckoutValidationConfiggetValidationConfig()protected CheckoutWorkflowActivityExceptioninvalid(@NonNull String message, @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)Creates a checkout workflow activity exception relevant for this validation activity.protected CheckoutWorkflowActivityExceptioninvalid(@NonNull String message, org.springframework.validation.Errors errors, @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)Creates a checkout workflow activity exception relevant for this validation activity.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.
-
-
-
Constructor Detail
-
CartFulfillmentValidationActivity
public CartFulfillmentValidationActivity(CartOperationServiceAutoConfiguration.ValidationConfiguration.FulfillmentCheckoutValidationConfig validationConfig, FulfillmentGroupSubmitValidator fulfillmentGroupSubmitValidator, 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.
-
invalid
protected CheckoutWorkflowActivityException invalid(@NonNull @NonNull String message, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
Creates a checkout workflow activity exception relevant for this validation activity.- Parameters:
message- the message to create the exception withcart- the most current version of the cart- Returns:
- the prepared exception
-
invalid
protected CheckoutWorkflowActivityException invalid(@NonNull @NonNull String message, @Nullable org.springframework.validation.Errors errors, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
Creates a checkout workflow activity exception relevant for this validation activity.- Parameters:
message- the message to create the exception witherrors- the errors to include in the exceptioncart- the most current version of the cart- Returns:
- the prepared exception
-
convertErrors
protected Map<String,String> convertErrors(@NonNull @NonNull org.springframework.validation.Errors errors)
Converts any errors in the errors container into a map using the field path and error code.- Parameters:
errors- the errors to convert- Returns:
- a map representing the individual validation errors that occurred
-
getMessage
protected String getMessage(@NonNull @NonNull String errorMessage, @Nullable Object... args)
-
getValidationConfig
protected CartOperationServiceAutoConfiguration.ValidationConfiguration.FulfillmentCheckoutValidationConfig getValidationConfig()
-
getFulfillmentGroupSubmitValidator
protected FulfillmentGroupSubmitValidator getFulfillmentGroupSubmitValidator()
-
getMessageSource
protected org.springframework.context.MessageSource getMessageSource()
-
-