Interface OfferMaxUseStatusManager

All Known Implementing Classes:
DefaultOfferMaxUseStatusManager

public interface OfferMaxUseStatusManager
Responsible for managing offer and offerCode lifecycle in regard to max usage status. When items exceed a max usage threshold (see Offer.getMaxUses(), Offer.getMaxTotalDiscount()), and OfferCode.getMaxUses(), they are filtered from the system. However, this detection process can be expensive. To short circuit the detection process, the Offer.getGeneralMaxUsageStatus() or OfferCode.getGeneralMaxUsageStatus() can be set to an appropriate value (see MaxUsageStatusType) and used by the system to filter out exhausted offers and offerCodes early and avoid the expensive detection logic.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    updateStatusForOffer(Offer offer, String status, boolean invalidateIfApplicable)
    Set the status for an offer in the persistence store.
    void
    updateStatusForOfferCode(OfferCode offerCode, String status, boolean invalidateIfApplicable)
    Set the status for an offerCode in the persistence store.
  • Method Details

    • updateStatusForOffer

      void updateStatusForOffer(Offer offer, String status, boolean invalidateIfApplicable)
      Set the status for an offer in the persistence store. This should also invalidate any active caches containing the offer that feed into max usage detection. This latter step guarantees the latest status is being consumed by the system. Note, this method is called under load (possibly with duplicate update requests), so measures are taken to make sure cache invalidation messages are only sent if the status is actually changed (ignoring duplicates).
      Parameters:
      offer - The target offer
      status - The status for the offer
      invalidateIfApplicable - Send a cache invalidation message for the offer. Is only effective is cache is currently enabled.
    • updateStatusForOfferCode

      void updateStatusForOfferCode(OfferCode offerCode, String status, boolean invalidateIfApplicable)
      Set the status for an offerCode in the persistence store. This should also invalidate any active caches containing the offerCode that feed into max usage detection. This latter step guarantees the latest status is being consumed by the system. Note, this method is called under load (possibly with duplicate update requests), so measures are taken to make sure cache invalidation messages are only sent if the status is actually changed (ignoring duplicates).
      Parameters:
      offerCode - The target offerCode
      status - The status for the offerCode
      invalidateIfApplicable - Send a cache invalidation message for the offerCode. Is only effective is cache is currently enabled.