Class OrderThresholdFreeVoucherPromotion

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable

    public class OrderThresholdFreeVoucherPromotion
    extends GeneratedOrderThresholdFreeVoucherPromotion
    OrderThresholdFreeVoucherPromotion. Get a voucher free when you spend at least a certain value. For example: Get a free voucher when you spend over €150.00. Get a voucher when your order subtotal is at least the threshold value.

    Notes for implementers:
    The OrderThresholdFreeVoucherPromotion does not actually apply the voucher to the cart. When this promotion fires and returns a PromotionResult, that result can be applied and undone. This has no side-effects, but the applied state of the result is stored. It is up to the site implementer to check for applied promotion results that are for OrderThresholdFreeVoucherPromotions and retrieve the GeneratedOrderThresholdFreeVoucherPromotion.getFreeVoucher() from the promotion and to give this to the user.

    See Also:
    Serialized Form
    • Constructor Detail

      • OrderThresholdFreeVoucherPromotion

        public OrderThresholdFreeVoucherPromotion()
    • Method Detail

      • getResultDescription

        public java.lang.String getResultDescription​(SessionContext ctx,
                                                     PromotionResult result,
                                                     java.util.Locale locale)
        Description copied from class: AbstractPromotion
        Get a localized user presentable description for the result of this promotion.
        Specified by:
        getResultDescription in class AbstractPromotion
        Parameters:
        ctx - The context
        result - The promotion result to be described
        locale - The locale to use to generate the message
        Returns:
        a string description
      • buildDataUniqueKey

        protected void buildDataUniqueKey​(SessionContext ctx,
                                          java.lang.StringBuilder builder)
        Description copied from class: AbstractPromotion
        Build a unique data driven key. Build a unique key that is data driven. This will uniquely identify the rules used in this promotion and will form the immutable key for stored promotions. This method may be overridden in a subclass to customize the identifier.
        Overrides:
        buildDataUniqueKey in class AbstractPromotion
        Parameters:
        ctx - The hybris context
        builder - A StringBuilder used to build up the immutable key
      • deepCloneAttributes

        protected void deepCloneAttributes​(SessionContext ctx,
                                           java.util.Map values)
        Called to deep clone attributes of this instance. The values map contains all the attributes defined on this instance. The map will be used to initialize a new instance of the Action that is a clone of this instance. This method can remove, replace or add to the Map of attributes.
        Overrides:
        deepCloneAttributes in class AbstractPromotion
        Parameters:
        ctx - The hybris context
        values - The map to write into
      • buildPromotionResultDataUnigueKey

        protected void buildPromotionResultDataUnigueKey​(SessionContext ctx,
                                                         PromotionResult promotionResult,
                                                         java.lang.StringBuilder builder)
        Override buildPromotionResultDataUnigueKey. This implementation ignores the consumed products because they are added by applying the action.
        Overrides:
        buildPromotionResultDataUnigueKey in class AbstractPromotion
        Parameters:
        ctx - The hybris context
        promotionResult - the promotion result
        builder - the builder to create the unique key in