Interface CartStatusHandler
- All Known Implementing Classes:
AbstractAccountCartStatusHandler,AbstractCartStatusChangeHandler,AbstractQuoteCartStatusHandler,QuoteAssignedStatusHandler,QuoteCanceledStatusHandler,QuoteDraftingStatusHandler,QuoteEditingStatusHandler,QuoteExpiredStatusHandler,QuotePublishedStatusHandler,QuoteQuoteRequestedStatusHandler,QuoteRejectedStatusHandler,QuoteSubmittedStatusHandler,ReclaimAccountCartStatusChangeHandler,RejectedAccountCartStatusChangeHandler,RequiresApprovalAccountCartStatusChangeHandler
public interface CartStatusHandler
A handler that handles a {@link Cart's} status change, e.g. validates if the
Cart can be
transitioned into the specified status before changing it.- Author:
- Sunny Yu
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanHandle(ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if this handler can handle the status change.process(ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Processes the cart status change if it is valid.voidvalidateStatusIsReadableByUser(CartStatusValidationRequest statusValidationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if the status is readable by the currently authenticated user.voidvalidateStatusIsUpdatableByUser(CartStatusValidationRequest statusValidationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if the status is updatable by the currently authenticated user.voidvalidateStatusTransition(ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates that the status that theCartis transitioning to is a valid next status.
-
Method Details
-
canHandle
boolean canHandle(ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if this handler can handle the status change.- Parameters:
changeStatusRequest- theChangeCartStatusRequestto facilitate the cart status changecontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- true if this handler can handle the status change, otherwise false
-
process
ChangeCartStatusRequest process(ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Processes the cart status change if it is valid.- Parameters:
changeStatusRequest- theChangeCartStatusRequestto facilitate the cart status changecontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- the
ChangeCartStatusRequestwith the updatedCartand other fields.
-
validateStatusTransition
void validateStatusTransition(ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates that the status that theCartis transitioning to is a valid next status.- Parameters:
changeStatusRequest- theChangeCartStatusRequestto facilitate the cart status changecontextInfo- context information surrounding sandboxing and multitenant state
-
validateStatusIsReadableByUser
void validateStatusIsReadableByUser(CartStatusValidationRequest statusValidationRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if the status is readable by the currently authenticated user.For example, a sales rep should not be able to read quotes in the
DefaultQuoteStatuses.DRAFTINGstatus.- Parameters:
statusValidationRequest- theCartStatusValidationRequestto facilitate the cart status validationcontextInfo- context information surrounding sandboxing and multitenant state- Throws:
CartAccessException- if the current cart status is not accessible by the currently authenticated user
-
validateStatusIsUpdatableByUser
void validateStatusIsUpdatableByUser(CartStatusValidationRequest statusValidationRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if the status is updatable by the currently authenticated user.For example, a customer should not be able to update quotes in the
DefaultQuoteStatuses.ASSIGNEDstatus.- Parameters:
statusValidationRequest- theCartStatusValidationRequestto facilitate the cart status validationcontextInfo- context information surrounding sandboxing and multitenant state- Throws:
CartAccessException- if the current cart status is not updatable by the currently authenticated user and the given workflow
-