public class CartStalePricingValidationActivity extends Object implements CheckoutWorkflowActivity
CheckoutWorkflowActivity
is responsible for validating that the Cart
and its
CartItems
have the actual (latest) prices.
shouldRejectLowerPrice
is "true" the exception CheckoutWorkflowActivityException
will be thrown with the
DefaultCheckoutFailureTypes.STALE_CART_PRICING_LOWER
failure type.CheckoutWorkflowActivityException
will be thrown with the
DefaultCheckoutFailureTypes.STALE_CART_PRICING_HIGHER
failure type.Constructor and Description |
---|
CartStalePricingValidationActivity(org.springframework.context.MessageSource messageSource,
CartProvider cartProvider,
CartStalePricingValidationActivityProperties properties,
StaleCartPricingResultHolder staleCartPricingResultHolder) |
Modifier and Type | Method and Description |
---|---|
protected com.broadleafcommerce.cart.client.domain.CartAlert |
createCartAlert(String message) |
protected com.broadleafcommerce.cart.client.domain.Cart |
determineCartWithLatestPrices(com.broadleafcommerce.cart.client.domain.Cart cart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) |
protected javax.money.MonetaryAmount |
determineOldCartPrice(com.broadleafcommerce.cart.client.domain.Cart cart) |
com.broadleafcommerce.cart.client.domain.Cart |
execute(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String requestId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Method responsible for executing some work against the cart that is required for checkout.
|
protected CartOperationService |
getCartOperationService() |
protected CartPricingService |
getCartPricingService()
Deprecated.
since 1.6, use
getCartOperationService() instead. |
protected CartProvider |
getCartProvider() |
protected String |
getFailureMessage(DefaultCheckoutFailureTypes checkoutFailureTypes) |
protected org.springframework.context.MessageSource |
getMessageSource() |
protected String |
getPricingChangeMessage(javax.money.MonetaryAmount oldCartPrice,
javax.money.MonetaryAmount latestCartPrice) |
protected CartStalePricingValidationActivityProperties |
getProperties() |
protected StaleCartPricingResultHolder |
getStaleCartPricingResultHolder() |
protected boolean |
latestPriceIsHigher(javax.money.MonetaryAmount latestCartPrice,
javax.money.MonetaryAmount oldCartPrice) |
protected boolean |
latestPriceIsLower(javax.money.MonetaryAmount latestCartPrice,
javax.money.MonetaryAmount oldCartPrice) |
com.broadleafcommerce.cart.client.domain.Cart |
rollback(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
String requestId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Method responsible for rolling back any work that was done during the execution of the
#execute(Cart, String) method. |
void |
setCartOperationService(CartOperationService cartOperationService) |
protected com.broadleafcommerce.cart.client.domain.Cart |
validateCartHasLatestPricing(com.broadleafcommerce.cart.client.domain.Cart cart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) |
public CartStalePricingValidationActivity(org.springframework.context.MessageSource messageSource, CartProvider cartProvider, CartStalePricingValidationActivityProperties properties, StaleCartPricingResultHolder staleCartPricingResultHolder)
public com.broadleafcommerce.cart.client.domain.Cart execute(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
CheckoutWorkflowActivity
execute
in interface CheckoutWorkflowActivity
cart
- The Cart
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.public com.broadleafcommerce.cart.client.domain.Cart rollback(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
CheckoutWorkflowActivity
#execute(Cart, String)
method.rollback
in interface CheckoutWorkflowActivity
cart
- The Cart
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.protected com.broadleafcommerce.cart.client.domain.Cart validateCartHasLatestPricing(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
protected javax.money.MonetaryAmount determineOldCartPrice(com.broadleafcommerce.cart.client.domain.Cart cart)
@Nullable protected com.broadleafcommerce.cart.client.domain.Cart determineCartWithLatestPrices(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
protected boolean latestPriceIsHigher(javax.money.MonetaryAmount latestCartPrice, javax.money.MonetaryAmount oldCartPrice)
protected boolean latestPriceIsLower(javax.money.MonetaryAmount latestCartPrice, javax.money.MonetaryAmount oldCartPrice)
protected String getFailureMessage(DefaultCheckoutFailureTypes checkoutFailureTypes)
protected String getPricingChangeMessage(javax.money.MonetaryAmount oldCartPrice, javax.money.MonetaryAmount latestCartPrice)
protected com.broadleafcommerce.cart.client.domain.CartAlert createCartAlert(String message)
protected org.springframework.context.MessageSource getMessageSource()
protected CartProvider getCartProvider()
protected CartOperationService getCartOperationService()
@Autowired public void setCartOperationService(CartOperationService cartOperationService)
protected CartStalePricingValidationActivityProperties getProperties()
protected StaleCartPricingResultHolder getStaleCartPricingResultHolder()
@Deprecated protected CartPricingService getCartPricingService()
getCartOperationService()
instead.Copyright © 2021. All rights reserved.