Class CartOfferValidationActivity
java.lang.Object
com.broadleafcommerce.cartoperation.service.checkout.workflow.activity.CartOfferValidationActivity
- All Implemented Interfaces:
CheckoutWorkflowActivity
This
CheckoutWorkflowActivity
is responsible for validating that the cart's offers, offer
codes, and campaign codes are still valid.- Author:
- Skye Pekerti (SkyePekerti)
-
Constructor Summary
ConstructorDescriptionCartOfferValidationActivity
(ExternalOfferProvider offerProvider, CampaignProvider campaignProvider, org.springframework.context.MessageSource messageSource, CartOperationService cartService) -
Method Summary
Modifier and TypeMethodDescriptionexecute
(@NonNull CheckoutProcessDto processDto, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Method responsible for executing some work against the cart that is required for checkout.protected CampaignProvider
protected CartOperationService
protected org.springframework.context.MessageSource
protected ExternalOfferProvider
getOfferRefIds
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart) Gathers the list of offer ids from the cart & cart item's adjustmentsprotected CartOperationServiceProperties
rollback
(@NonNull CheckoutProcessDto processDto, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Method responsible for rolling back any work that was done during the execution of theCheckoutWorkflowActivity.execute(CheckoutProcessDto, ContextInfo)
method.void
setProperties
(CartOperationServiceProperties properties) protected void
validateCampaignCodeUsages
(@NonNull CheckoutProcessDto processDto, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Deprecated as of 1.8, if using OfferService 2.0, this method is not usedprotected void
validateOfferAndOfferCodeUsages
(@NonNull CheckoutProcessDto processDto, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validate that the offers and offer codes used in the specified cart are still valid upon checkout.
-
Constructor Details
-
CartOfferValidationActivity
public CartOfferValidationActivity(ExternalOfferProvider offerProvider, CampaignProvider campaignProvider, org.springframework.context.MessageSource messageSource, CartOperationService cartService)
-
-
Method Details
-
execute
public CheckoutProcessDto execute(@NonNull @NonNull CheckoutProcessDto processDto, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CheckoutWorkflowActivity
Method responsible for executing some work against the cart that is required for checkout. This may include, but is not limited to, cart validation checks, inventory reservations, or payment authorizations.- Specified by:
execute
in interfaceCheckoutWorkflowActivity
- Parameters:
processDto
- TheCheckoutProcessDto
that we're attempting to checkout with.contextInfo
- Context information around sandbox and multitenant state.- Returns:
- The final state of the
CheckoutProcessDto
following the execution of the activity.
-
rollback
public CheckoutProcessDto rollback(@NonNull @NonNull CheckoutProcessDto processDto, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CheckoutWorkflowActivity
Method responsible for rolling back any work that was done during the execution of theCheckoutWorkflowActivity.execute(CheckoutProcessDto, ContextInfo)
method.- Specified by:
rollback
in interfaceCheckoutWorkflowActivity
- Parameters:
processDto
- 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 rollback of the activity.
-
validateOfferAndOfferCodeUsages
protected void validateOfferAndOfferCodeUsages(@NonNull @NonNull CheckoutProcessDto processDto, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validate that the offers and offer codes used in the specified cart are still valid upon checkout.- Parameters:
processDto
- theCheckoutProcessDto
that we're attempting to checkout with.contextInfo
- context surrounding sandboxing and multitenant state
-
getOfferRefIds
protected List<String> getOfferRefIds(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart) Gathers the list of offer ids from the cart & cart item's adjustments- Parameters:
cart
- the cart that is being validated- Returns:
- the list of offer ids from the cart & cart item's adjustments
-
validateCampaignCodeUsages
@Deprecated protected void validateCampaignCodeUsages(@NonNull @NonNull CheckoutProcessDto processDto, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Deprecated as of 1.8, if using OfferService 2.0, this method is not usedValidate that the campaign codes used in the specified cart are still valid upon checkout.- Parameters:
processDto
- theCheckoutProcessDto
that we're attempting to checkout with.contextInfo
- context surrounding sandboxing and multitenant state
-
getOfferProvider
-
getCampaignProvider
-
getMessageSource
protected org.springframework.context.MessageSource getMessageSource() -
getCartService
-
getProperties
-
setProperties
-