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 TypeMethodDescriptionboolean
canHandle
(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.void
validateStatusIsReadableByUser
(CartStatusValidationRequest statusValidationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if the status is readable by the currently authenticated user.void
validateStatusIsUpdatableByUser
(CartStatusValidationRequest statusValidationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if the status is updatable by the currently authenticated user.void
validateStatusTransition
(ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates that the status that theCart
is 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
- theChangeCartStatusRequest
to 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
- theChangeCartStatusRequest
to facilitate the cart status changecontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- the
ChangeCartStatusRequest
with the updatedCart
and other fields.
-
validateStatusTransition
void validateStatusTransition(ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates that the status that theCart
is transitioning to is a valid next status.- Parameters:
changeStatusRequest
- theChangeCartStatusRequest
to 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.DRAFTING
status.- Parameters:
statusValidationRequest
- theCartStatusValidationRequest
to 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.ASSIGNED
status.- Parameters:
statusValidationRequest
- theCartStatusValidationRequest
to 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
-