Interface CheckoutWorkflow
-
- All Known Implementing Classes:
DefaultCheckoutWorkflow
public interface CheckoutWorkflow
Implementations of this class are responsible for coordinating the execution & rollback ofCheckoutWorkflowActivities
. 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 ofDefaultTransactionTypes.AUTHORIZE
transactions instead ofDefaultTransactionTypes.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 Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default com.broadleafcommerce.cart.client.domain.Cart
execute(com.broadleafcommerce.cart.client.domain.Cart cart, String requestId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Method used to coordinate the execution ofCheckoutWorkflowActivities
.com.broadleafcommerce.cart.client.domain.Cart
execute(com.broadleafcommerce.cart.client.domain.Cart cart, String requestId, Map<String,String> paymentLockTokens, Map<String,String> securityCodes, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Method used to coordinate the execution ofCheckoutWorkflowActivities
.com.broadleafcommerce.cart.client.domain.Cart
rollback(com.broadleafcommerce.cart.client.domain.Cart cart, String requestId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Method used to coordinate the rollback of work that has been done by theCheckoutWorkflowActivities
up to that point.
-
-
-
Method Detail
-
execute
default com.broadleafcommerce.cart.client.domain.Cart execute(com.broadleafcommerce.cart.client.domain.Cart cart, String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Method used to coordinate the execution ofCheckoutWorkflowActivities
. If there is an exception/error during the execution of those activities, thenrollback(Cart, String, ContextInfo)
should be called to un-do the work that had been done up to the point of the exception/error.- Parameters:
cart
- TheCart
that 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 workflow.
- Throws:
CheckoutWorkflowException
- If there was an exception thrown within the execution of the workflow.
-
execute
com.broadleafcommerce.cart.client.domain.Cart execute(com.broadleafcommerce.cart.client.domain.Cart cart, String requestId, Map<String,String> paymentLockTokens, Map<String,String> securityCodes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Method used to coordinate the execution ofCheckoutWorkflowActivities
. If there is an exception/error during the execution of those activities, thenrollback(Cart, String, ContextInfo)
should be called to un-do the work that had been done up to the point of the exception/error.- Parameters:
cart
- TheCart
that we're attempting to checkout with.requestId
- The id used to identify changes tied to the specific execution requestpaymentLockTokens
- Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.securityCodes
- The map of card security codes keyed by payment id for processing saved paymentscontextInfo
- Context information around sandbox and multitenant state.- Returns:
- The final state of the cart following the execution of the workflow.
- Throws:
CheckoutWorkflowException
- If there was an exception thrown within the execution of the workflow.
-
rollback
com.broadleafcommerce.cart.client.domain.Cart rollback(com.broadleafcommerce.cart.client.domain.Cart cart, String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Method used to coordinate the rollback of work that has been done by theCheckoutWorkflowActivities
up to that point.- Parameters:
cart
- TheCart
that 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 execution of the workflow rollback.
- Throws:
CheckoutWorkflowRollbackException
- If there was an exception thrown within the execution of the rollback.
-
-