Class CartLimitedPriceAvailabilityCheckoutActivity
java.lang.Object
com.broadleafcommerce.cartoperation.service.checkout.workflow.activity.CartLimitedPriceAvailabilityCheckoutActivity
- All Implemented Interfaces:
CheckoutWorkflowActivity
public class CartLimitedPriceAvailabilityCheckoutActivity
extends Object
implements CheckoutWorkflowActivity
This
CheckoutWorkflowActivity
is responsible for recording the quantity usage for prices
that have limited quantity available for pricing events such as a flash sale.
- If the prices are still available for the quantity, the checkout attempt will continue.
- If the quantity is no longer available, the cart would be repriced, and
- If the new cart total is less than the previous the cart will be updated with the new prices,
and the exception
CheckoutWorkflowActivityException
will be thrown with theDefaultCheckoutFailureTypes.STALE_CART_PRICING_LOWER
failure type. - If the new cart total is higher than the previous the cart will be updated with the new
prices and the exception
CheckoutWorkflowActivityException
will be thrown with theDefaultCheckoutFailureTypes.STALE_CART_PRICING_HIGHER
failure type.
- Author:
- Sunny Yu
- See Also:
-
PriceInfo.getAvailableQuantity()
-
Constructor Summary
ConstructorsConstructorDescriptionCartLimitedPriceAvailabilityCheckoutActivity
(org.springframework.context.MessageSource messageSource, PricingProvider pricingProvider, CartOperationService cartOperationService, CartItemPricingUtils cartItemPricingUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.pricing.client.domain.usage.PriceDataUsage
buildPriceDataUsage
(@NonNull CheckoutProcessDto processDto, @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) protected com.broadleafcommerce.pricing.client.domain.usage.RecordPriceDataUsageRequest
buildRecordPriceDataUsageRequest
(@NonNull CheckoutProcessDto processDto, @NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> itemsUsingLimitedPrice) execute
(@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 CartItemPricingUtils
protected CartOperationService
protected org.springframework.context.MessageSource
protected PricingProvider
protected com.broadleafcommerce.common.extension.TypeFactory
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.
-
Constructor Details
-
CartLimitedPriceAvailabilityCheckoutActivity
public CartLimitedPriceAvailabilityCheckoutActivity(org.springframework.context.MessageSource messageSource, PricingProvider pricingProvider, CartOperationService cartOperationService, CartItemPricingUtils cartItemPricingUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
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.
-
buildRecordPriceDataUsageRequest
protected com.broadleafcommerce.pricing.client.domain.usage.RecordPriceDataUsageRequest buildRecordPriceDataUsageRequest(@NonNull @NonNull CheckoutProcessDto processDto, @NonNull @NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> itemsUsingLimitedPrice) -
buildPriceDataUsage
protected com.broadleafcommerce.pricing.client.domain.usage.PriceDataUsage buildPriceDataUsage(@NonNull @NonNull CheckoutProcessDto processDto, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) -
getMessageSource
protected org.springframework.context.MessageSource getMessageSource() -
getPricingProvider
-
getCartOperationService
-
getCartItemPricingUtils
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-