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 Modifier and Type Method Description CheckoutProcessDto
execute(CheckoutProcessDto checkoutProcessDto, Map<String,String> securityCodes, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Method used to coordinate the execution ofCheckoutWorkflowActivities
.CheckoutProcessDto
rollback(CheckoutProcessDto checkoutProcessDto, 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.void
sendCheckoutRollbackEvent(com.broadleafcommerce.cart.client.domain.Cart cart, String requestId, 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.
-
-
-
Method Detail
-
execute
CheckoutProcessDto execute(CheckoutProcessDto checkoutProcessDto, 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(CheckoutProcessDto, ContextInfo)
should be called to un-do the work that had been done up to the point of the exception/error.- Parameters:
checkoutProcessDto
- TheCheckoutProcessDto
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 theCheckoutWorkflowActivities
up to that point.- Parameters:
checkoutProcessDto
- TheCheckoutProcessDto
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 idcontextInfo
- Context information around sandbox and multitenant state.- Throws:
CheckoutWorkflowRollbackMessageException
- If there was an exception thrown when sending the rollback event
-
-