public class DefaultCheckoutService extends Object implements CheckoutService
CheckoutService that is responsible for processing checkout
requests| Constructor and Description |
|---|
DefaultCheckoutService(CheckoutWorkflow checkoutWorkflow,
CartProvider cartProvider,
com.broadleafcommerce.common.extension.TypeFactory typeFactory,
com.broadleafcommerce.common.messaging.checkout.CheckoutCompletionProducer checkoutCompletionProducer,
CartStatusValidationHelper cartStatusValidationHelper,
ExternalCartProperties externalCartProperties) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addCartLinks(com.broadleafcommerce.cart.client.domain.CheckoutCart checkoutCart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) |
protected String |
createOrderNumber(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
Creates a new order number for a submitted cart.
|
protected com.broadleafcommerce.cart.client.domain.Cart |
finalizeCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Following a successful checkout, this method is responsible for recording the finalized state
of the cart.
|
protected com.broadleafcommerce.cart.client.domain.CartLink |
getCartItemLink(com.broadleafcommerce.cart.client.domain.CheckoutCart checkoutCart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) |
protected CartProvider |
getCartProvider() |
protected CartStatusValidationHelper |
getCartStatusValidationHelper() |
protected com.broadleafcommerce.common.messaging.checkout.CheckoutCompletionProducer |
getCheckoutCompletionProducer() |
protected CheckoutWorkflow |
getCheckoutWorkflow() |
protected ExternalCartProperties |
getExternalCartProperties() |
protected com.broadleafcommerce.cart.client.domain.CartLink |
getFulfillmentGroupLink(com.broadleafcommerce.cart.client.domain.CheckoutCart checkoutCart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) |
protected com.broadleafcommerce.common.extension.TypeFactory |
getTypeFactory() |
protected com.broadleafcommerce.cart.client.domain.Cart |
prepareCartForCheckout(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String requestId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Updates the cart with the checkout request ID and status for checkout
|
CheckoutResponse |
processCheckout(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String requestId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Process checkout against the provided cart
|
CheckoutResponse |
processCheckout(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String requestId,
@NonNull Map<String,String> securityCodes,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Process checkout against the provided cart
|
protected void |
sendCheckoutCompletionMessage(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String requestId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Send a message to notify external services (and internal listeners) of the completed checkout
so that they can react accordingly.
|
protected boolean |
shouldResetCartStatus(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String originalCartStatus,
@NonNull CheckoutWorkflowException e)
Determines whether or not the cart's status should be reset after encountering an unexpected
exception during checkout.
|
protected com.broadleafcommerce.cart.client.domain.Cart |
updateCartStatus(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String cartStatus,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) |
protected void |
validateCheckoutRequest(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String requestId)
Validates the cart for checkout
|
protected void |
validateRequestId(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String requestId)
Validates that the current requestId is not already associated to the cart
|
public DefaultCheckoutService(CheckoutWorkflow checkoutWorkflow, CartProvider cartProvider, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.common.messaging.checkout.CheckoutCompletionProducer checkoutCompletionProducer, CartStatusValidationHelper cartStatusValidationHelper, ExternalCartProperties externalCartProperties)
public CheckoutResponse processCheckout(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
CheckoutServiceprocessCheckout in interface CheckoutServicecart - The cart with which to process checkout.requestId - The id representing this request to checkoutcontextInfo - Context information around sandbox and multitenant state.public CheckoutResponse processCheckout(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String requestId, @NonNull @NonNull Map<String,String> securityCodes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
CheckoutServiceprocessCheckout in interface CheckoutServicecart - The cart with which to process checkout.requestId - The id representing this request to checkoutsecurityCodes - The map of card security codes keyed by payment id for processing saved
paymentscontextInfo - Context information around sandbox and multitenant state.protected void validateCheckoutRequest(@NonNull
@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull
@NonNull String requestId)
cart - The cart to validaterequestId - The checkout request idprotected void validateRequestId(@NonNull
@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull
@NonNull String requestId)
cart - The cart to validaterequestId - The checkout request idCheckoutWorkflowException - Thrown if the current requestId is already present in the
cart's past checkout submissionsprotected com.broadleafcommerce.cart.client.domain.Cart prepareCartForCheckout(@NonNull
@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull
@NonNull String requestId,
@Nullable
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
cart - The cart to be updatedrequestId - The checkout request idcontextInfo - Context information around sandbox and multitenant stateprotected com.broadleafcommerce.cart.client.domain.Cart updateCartStatus(@NonNull
@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull
@NonNull String cartStatus,
@Nullable
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
protected boolean shouldResetCartStatus(@NonNull
@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull
@NonNull String originalCartStatus,
@NonNull
@NonNull CheckoutWorkflowException e)
cart - The cart related to the checkout requestoriginalCartStatus - The status of the cart prior to attempting checkoute - The CheckoutWorkflowException that caused the checkout to failprotected com.broadleafcommerce.cart.client.domain.Cart finalizeCart(@NonNull
@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@Nullable
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
cart - The cart that has completed checkout, but needs to be marked as finalizedprotected String createOrderNumber(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
protected void sendCheckoutCompletionMessage(@NonNull
@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull
@NonNull String requestId,
@Nullable
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
cart - The cart that has completed checkout. This should be the primary content of the
out-going message.requestId - The checkout request idcontextInfo - Context information around sandbox and multitenant state.protected void addCartLinks(com.broadleafcommerce.cart.client.domain.CheckoutCart checkoutCart,
@Nullable
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
protected com.broadleafcommerce.cart.client.domain.CartLink getFulfillmentGroupLink(com.broadleafcommerce.cart.client.domain.CheckoutCart checkoutCart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
protected com.broadleafcommerce.cart.client.domain.CartLink getCartItemLink(com.broadleafcommerce.cart.client.domain.CheckoutCart checkoutCart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
protected CheckoutWorkflow getCheckoutWorkflow()
protected CartProvider getCartProvider()
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
protected com.broadleafcommerce.common.messaging.checkout.CheckoutCompletionProducer getCheckoutCompletionProducer()
protected CartStatusValidationHelper getCartStatusValidationHelper()
protected ExternalCartProperties getExternalCartProperties()
Copyright © 2021. All rights reserved.