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 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 - the ChangeCartStatusRequest to facilitate the cart status change
      contextInfo - 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 - the ChangeCartStatusRequest to facilitate the cart status change
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      the ChangeCartStatusRequest with the updated Cart and other fields.
    • validateStatusTransition

      void validateStatusTransition(ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Validates that the status that the Cart is transitioning to is a valid next status.
      Parameters:
      changeStatusRequest - the ChangeCartStatusRequest to facilitate the cart status change
      contextInfo - 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 - the CartStatusValidationRequest to facilitate the cart status validation
      contextInfo - 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 - the CartStatusValidationRequest to facilitate the cart status validation
      contextInfo - 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