Class PromotionOrderResults


  • public class PromotionOrderResults
    extends java.lang.Object
    An object representing the results of evaluating promotions on an AbstractOrder. This object holds details of each promotion that fired, and the OrderEntry objects that it fired on, and details of all other OrderEntry objects, indicating if they could be part of a potential promotion. A PromotionResult object represents the state of any promotion that fired or potentially fired.
    • Constructor Detail

      • PromotionOrderResults

        public PromotionOrderResults​(SessionContext ctx,
                                     AbstractOrder order,
                                     java.util.List<PromotionResult> promotionResults,
                                     double changeFromLastResults)
        Constructor.
        Parameters:
        ctx - The hybris context
        order - The order
        promotionResults - The promotion results
        changeFromLastResults - The change from last results
    • Method Detail

      • invalidateCache

        public void invalidateCache()
        Invalidate all cached data held in this PromotionOrderResults instance. This method should be called if any of the PromotionResults are applied or unapplied.
      • getTotalChangeFromLastResults

        public double getTotalChangeFromLastResults()
        Return the total change since the last evaluation of results.
        Returns:
        A double representing the calculation newTotalValueOfDiscounts - oldTotalValueOfDiscounts
      • getAllResults

        public java.util.List<PromotionResult> getAllResults()
        Returns all PromotionResult objects. This list will include all promotions that either fired or identified themselves as potentially firing.
        Returns:
        The list of promotion results
      • getAllProductPromotions

        public java.util.List<PromotionResult> getAllProductPromotions()
        Return a list of results for promotions that consumed products. This list will include all promotions that consumed products regardless of their firing status.
        Returns:
        The list of promotion results
      • getFiredProductPromotions

        public java.util.List<PromotionResult> getFiredProductPromotions()
        Return a list of results for promotions that fired and consumed products.
        Returns:
        A list of the results of product promotions that fired
      • getAppliedProductPromotions

        public java.util.List<PromotionResult> getAppliedProductPromotions()
        Return a list of results for promotions that fired and consumed products and have been applied.
        Returns:
        A list of the results of product promotions that fired and applied
      • getPotentialProductPromotions

        public java.util.List<PromotionResult> getPotentialProductPromotions()
        Return a list of results for promotions that fired and consumed products and have been applied.
        Returns:
        A list of the results of product promotions that fired and applied
      • getAllOrderPromotions

        public java.util.List<PromotionResult> getAllOrderPromotions()
        Return a list of results for promotions that did not consume products. This list will include all promotions that did not consume products regardless of their firing status
        Returns:
        The list of promotion results
      • getFiredOrderPromotions

        public java.util.List<PromotionResult> getFiredOrderPromotions()
        Return a list of results for promotions that fired and did not consume products.
        Returns:
        A list of the results of promotions that fired
      • getAppliedOrderPromotions

        public java.util.List<PromotionResult> getAppliedOrderPromotions()
        Return a list of results for promotions that fired and did not consume products and have been applied.
        Returns:
        A list of the results of promotions that fired and applied
      • getPotentialOrderPromotions

        public java.util.List<PromotionResult> getPotentialOrderPromotions()
        Return a list of results for promotions that fired and did not consume products and have been applied.
        Returns:
        A list of the results of order promotions that fired and applied
      • getEntriesNotInPromotions

        public java.util.List<WrappedOrderEntry> getEntriesNotInPromotions()
        Return a list of WrappedOrderEntry objects that were not part of any any promotion that fired or could fire.
        Returns:
        a list of WrappedOrderEntry objects
      • getEntriesWithPotentialPromotions

        public java.util.List<WrappedOrderEntry> getEntriesWithPotentialPromotions()
        Return a list of WrappedOrderEntry objects that were part of any any promotion that could fire.
        Returns:
        a list of WrappedOrderEntry objects
      • getEntriesNotInFiredPromotions

        public java.util.List<WrappedOrderEntry> getEntriesNotInFiredPromotions()
        Return a list of WrappedOrderEntry objects that were not part of any any promotion that fired. The WrappedOrderEntry holds the promotions that could fire for the specified products. Note that the results returned from this method are the same as those from combining the results from methods getEntriesWithPotentialPromotions() and getEntriesNotInPromotions() but the WrappedOrderEntry objects may be consolidated together. In general it is preferable to call getEntriesWithPotentialPromotions() and getEntriesNotInPromotions() that than calling this method directly.
        Returns:
        a list of WrappedOrderEntry objects