Class PromoCodeContent


  • public final class PromoCodeContent
    extends java.lang.Object
    • Method Detail

      • createRandomCode

        public static PromoCodeContent createRandomCode()
        Create a Promo Code with a random code.
        Returns:
        new builder instance.
      • createWithCode

        public static PromoCodeContent createWithCode​(java.lang.String code)
        Create a Promo Code with defined code.
        Parameters:
        code - code to be used as promo code.
        Returns:
        new builder instance.
      • withMaxClaimCount

        public PromoCodeContent withMaxClaimCount​(int maxClaimCount)
        The maximum number of times this code can be claimed. All the next attempts will receive an error. If `0` then no limits.
        Parameters:
        maxClaimCount - maximum claim times.
        Returns:
        instance of PromoCodeContent for method chaining.
      • withTimeLimit

        public PromoCodeContent withTimeLimit​(java.util.Date startDate,
                                              java.util.Date endDate)
        Set the time range when this Promo Code is available. If not set - will be available from the creation moment and until manually disabled on the Dashboard.
        Parameters:
        startDate - date when the Promo Code should become available.
        endDate - date when the Promo Code should not be available anymore.
        Returns:
        instance of PromoCodeContent for method chaining.
      • addProperty

        public PromoCodeContent addProperty​(java.lang.String key,
                                            java.lang.String value)
        Attach some custom data to the promo code.
        Parameters:
        key - data key.
        value - data value.
        Returns:
        instance of PromoCodeContent for method chaining.
      • addProperties

        public PromoCodeContent addProperties​(java.util.Map<java.lang.String,​java.lang.String> data)
        Attach some custom data to the promo code.
        Parameters:
        data - custom data.
        Returns:
        instance of PromoCodeContent for method chaining.
      • getCode

        public java.lang.String getCode()
      • getProperties

        public java.util.Map<java.lang.String,​java.lang.String> getProperties()
      • getMaxClaimCount

        public int getMaxClaimCount()
      • getStartDate

        public java.util.Date getStartDate()
      • getEndDate

        public java.util.Date getEndDate()