All Known Implementing Classes:
DefaultCheckoutWorkflow

public interface CheckoutWorkflow
Implementations of this class are responsible for coordinating the execution & rollback of CheckoutWorkflowActivities. The work done by those activities should represent everything that MUST be done to complete checkout for the cart. Suggestions: 1. If an activity can wait to be handled after checkout, then it should not be included in the checkout workflow. Our primary reasoning for this is to avoid any unnecessary rollbacks of the workflow. For instance, if you were to include a "SendConfirmationEmailActivity", then the workflow could potentially rollback if your email service is unavailable. While sending the confirmation email is important, it's not required to complete the checkout & it should not block you from capturing the order. 2. If your checkout workflow includes an activity that interacts with a payment gateway, we suggest that it makes use of DefaultTransactionTypes.AUTHORIZE transactions instead of DefaultTransactionTypes.AUTHORIZE_AND_CAPTURE transactions. If you wish to immediately capture the payment, we suggest that is done as a post-checkout activity - i.e. after this workflow.
Author:
Chris Kittrell (ckittrell)
  • Method Details

    • execute

      CheckoutProcessDto execute(CheckoutProcessDto checkoutProcessDto, Map<String,String> securityCodes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Method used to coordinate the execution of CheckoutWorkflowActivities. If there is an exception/error during the execution of those activities, then rollback(CheckoutProcessDto, ContextInfo) should be called to un-do the work that had been done up to the point of the exception/error.
      Parameters:
      checkoutProcessDto - The CheckoutProcessDto that we're attempting to checkout with.
      securityCodes - Secure codes that are passed to the gateway for verification during authorization or capture transactions.
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The final state of the CheckoutProcessDto following the execution of the workflow.
      Throws:
      CheckoutWorkflowException - If there was an exception thrown within the execution of the workflow.
    • rollback

      CheckoutProcessDto rollback(CheckoutProcessDto checkoutProcessDto, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Method used to coordinate the rollback of work that has been done by the CheckoutWorkflowActivities up to that point.
      Parameters:
      checkoutProcessDto - The CheckoutProcessDto that we were attempting to checkout with, but ran into an exception/error.
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The final state of the CheckoutProcessDto following the execution of the workflow rollback.
      Throws:
      CheckoutWorkflowRollbackException - If there was an exception thrown within the execution of the rollback.
    • sendCheckoutRollbackEvent

      void sendCheckoutRollbackEvent(com.broadleafcommerce.cart.client.domain.Cart cart, String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Send a message to notify external services (and internal listeners) of the checkout workflow rollback, so that they can react accordingly.
      Parameters:
      cart - The cart that is being rolled back.
      requestId - The checkout request id
      contextInfo - Context information around sandbox and multitenant state.
      Throws:
      CheckoutWorkflowRollbackMessageException - If there was an exception thrown when sending the rollback event