The CartStalePricingValidationActivity
activity is responsible for validating that the cart and its items have the actual (latest) prices.
Important
|
As of 1.8.1-GA, this activity is skipped if the property
CartStalePricingActivityProperties#useRealTimeCartPricing is false and the cart’s last catalog reprice is within the defined time-to-live in CartOperationServiceProperties#cartPricingTimeToLive
|
Firstly, we check if we already updated the cart pricing on this request during cart resolution. If we have already updated the pricing on this request, we use the cart on this request. If we have not already updated the pricing on this request, we will fetch the cart and evaluate the latest prices, including the latest prices from the catalog. If the pricing is different from the current cart, we update the cart with the latest pricing and add a cart alert for the changed pricing.
If the new cart total is less than the previous cart total, the cart will be updated with the new prices and, if the property
CartStalePricingActivityProperties#shouldRejectLowerPrice
is true
, the exception CheckoutWorkflowActivityException
is thrown with the failure type STALE_CART_PRICING_LOWER
.
If the new cart total is higher than the previous cart total, the cart will be updated with the new prices
and the exception CheckoutWorkflowActivityException
will be thrown with the failure type STALE_CART_PRICING_HIGHER
.
Otherwise, if the cart total is the same as the previous cart total, we continue on with the checkout workflow.