Class BaseCandidateOffer

    • Constructor Detail

      • BaseCandidateOffer

        public BaseCandidateOffer()
    • Method Detail

      • populateCombinabilityStructures

        public void populateCombinabilityStructures​(CandidateOffers candidateOffers)
      • populateCombinabilityStructuresUsedBySameTargetType

        protected void populateCombinabilityStructuresUsedBySameTargetType​(CandidateOffers candidateOffers)
      • updateOfferCombinabilityCriteria

        public void updateOfferCombinabilityCriteria​(CandidateOffers candidateOffers)
      • getDiscountTargetType

        public String getDiscountTargetType()
        Convenience method to access this property to improve code readability
      • getDiscountMethodType

        public String getDiscountMethodType()
        Convenience method to access this property to improve code readability
      • getOfferId

        public String getOfferId()
        Convenience method to access this property to improve code readability
      • getOffer

        public Offer getOffer()
        The candidate Offer.
        Returns:
        The candidate Offer.
      • getPotentialSavings

        public javax.money.MonetaryAmount getPotentialSavings()
        The total potential amount saved by applying this offer to its targets.
        Returns:
        The total potential amount saved by applying this offer to its targets.
      • isRoundOfferValues

        public boolean isRoundOfferValues()

        Determines whether to round potentialSavings. Default is false. Note: This is only relevant for adjustments that apply to items. The additional precision is important when multiplying by a "qty". Order and fulfillment group adjustments will always be rounded in the default implementations.

        It is sometimes problematic to use DiscountMethodType.PERCENT_OFF offers with regards to rounding. For example, consider an item that costs $9.99 and has a 50% discount. To be precise, the offer value is 4.995, but this may be a strange value to display to the user depending on the currency being used. Keeping this false produces more accurate results when using quantities > 1. For example, 20% off of $9.99 with a quantity of 5 will produce a savings of exactly $9.99 which would be expected. The savings will always be rounded to the correct precision of the currency, however the S "totalSavings" will always be displays may want to round the value unit adjustment will be up to 5 digits of precision if roundOfferValues is false. Client displays may with to round the adjustment amount if showing per quantity level adjustments.

        Returns:
        whether to round potentialSavings.
      • getOfferCombinabilityCriteriaKey

        public OfferCombinabilityCriteriaKey getOfferCombinabilityCriteriaKey()
        Holds the combinability criteria for this offer. The offer domain contains combinability flags and rules but the criteria will vary with each execution of the offer engine. For example, if "item offer a" can be combined with any "order offer except b" and b is not in the scope of the current offer engine execution, then we can say that "item offer a" can be combined with ANY order offer. Practically, this allows us to reduce the overall complexity of offer engine by getting rid of scenarios that are irrelevant to the current execution.
      • getCombinableOverrides

        public Set<String> getCombinableOverrides()
        Convert offer data into easier structures for combinability algorithms
      • getNonCombinableOverrides

        public Set<String> getNonCombinableOverrides()
      • getStackableOverrides

        public Set<String> getStackableOverrides()
      • setOffer

        public void setOffer​(Offer offer)
        The candidate Offer.
        Parameters:
        offer - The candidate Offer.
      • setPotentialSavings

        public void setPotentialSavings​(javax.money.MonetaryAmount potentialSavings)
        The total potential amount saved by applying this offer to its targets.
        Parameters:
        potentialSavings - The total potential amount saved by applying this offer to its targets.
      • setRoundOfferValues

        public void setRoundOfferValues​(boolean roundOfferValues)

        Determines whether to round potentialSavings. Default is false. Note: This is only relevant for adjustments that apply to items. The additional precision is important when multiplying by a "qty". Order and fulfillment group adjustments will always be rounded in the default implementations.

        It is sometimes problematic to use DiscountMethodType.PERCENT_OFF offers with regards to rounding. For example, consider an item that costs $9.99 and has a 50% discount. To be precise, the offer value is 4.995, but this may be a strange value to display to the user depending on the currency being used. Keeping this false produces more accurate results when using quantities > 1. For example, 20% off of $9.99 with a quantity of 5 will produce a savings of exactly $9.99 which would be expected. The savings will always be rounded to the correct precision of the currency, however the S "totalSavings" will always be displays may want to round the value unit adjustment will be up to 5 digits of precision if roundOfferValues is false. Client displays may with to round the adjustment amount if showing per quantity level adjustments.

        Parameters:
        roundOfferValues - whether to round potentialSavings.
      • setOfferCombinabilityCriteriaKey

        public void setOfferCombinabilityCriteriaKey​(OfferCombinabilityCriteriaKey offerCombinabilityCriteriaKey)
        Holds the combinability criteria for this offer. The offer domain contains combinability flags and rules but the criteria will vary with each execution of the offer engine. For example, if "item offer a" can be combined with any "order offer except b" and b is not in the scope of the current offer engine execution, then we can say that "item offer a" can be combined with ANY order offer. Practically, this allows us to reduce the overall complexity of offer engine by getting rid of scenarios that are irrelevant to the current execution.
      • setCombinableOverrides

        public void setCombinableOverrides​(Set<String> combinableOverrides)
        Convert offer data into easier structures for combinability algorithms
      • setNonCombinableOverrides

        public void setNonCombinableOverrides​(Set<String> nonCombinableOverrides)
      • setStackableOverrides

        public void setStackableOverrides​(Set<String> stackableOverrides)
      • canEqual

        protected boolean canEqual​(Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object