Interface DiscountCodeState

All Superinterfaces:
JsonEnum
All Known Implementing Classes:
DiscountCodeState.DiscountCodeStateEnum

public interface DiscountCodeState extends JsonEnum

Indicates the state of a Discount Code in a Cart.

If an Order is created from a Cart with a state other than MatchesCart, a DiscountCodeNonApplicable error is returned.

  • Field Details

    • NOT_ACTIVE

      static final DiscountCodeState NOT_ACTIVE

      The Discount Code is not active or does not contain any active Cart Discounts.

    • NOT_VALID

      static final DiscountCodeState NOT_VALID

      The Discount Code is not valid or does not contain any valid Cart Discounts. Validity is determined by the CartDiscount validFrom and validUntil dates.

    • DOES_NOT_MATCH_CART

      static final DiscountCodeState DOES_NOT_MATCH_CART

      The Discount Code is active and contains at least one active and valid Cart Discount. The DiscountCode cartPredicate does not match the Cart or the contained active discount's cart predicates do no match the Cart.

    • MATCHES_CART

      static final DiscountCodeState MATCHES_CART

      The Discount Code is active and contains at least one active and valid Cart Discount. The DiscountCode cartPredicate matches the Cart and at least one of the contained active discount's cart predicates matches the Cart.

    • MAX_APPLICATION_REACHED

      static final DiscountCodeState MAX_APPLICATION_REACHED

      The maxApplications or maxApplicationsPerCustomer for a DiscountCode has been reached.

    • APPLICATION_STOPPED_BY_PREVIOUS_DISCOUNT

      static final DiscountCodeState APPLICATION_STOPPED_BY_PREVIOUS_DISCOUNT

      The Discount Code is active and no discounts are applied after a discount with StopAfterThisDiscount StackingMode is defined.

  • Method Details

    • getJsonName

      String getJsonName()
      the JSON value
      Specified by:
      getJsonName in interface JsonEnum
      Returns:
      json value
    • name

      String name()
      the enum value
      Specified by:
      name in interface JsonEnum
      Returns:
      name
    • toString

      String toString()
      convert value to string
      Specified by:
      toString in interface JsonEnum
      Overrides:
      toString in class Object
      Returns:
      string representation
    • findEnum

      static DiscountCodeState findEnum(String value)
      factory method for a enum value of DiscountCodeState if no enum has been found an anonymous instance will be created
      Parameters:
      value - the enum value to be wrapped
      Returns:
      enum instance
    • findEnumViaJsonName

      static Optional<DiscountCodeState> findEnumViaJsonName(String jsonName)
      method to find enum using the JSON value
      Parameters:
      jsonName - the json value to be wrapped
      Returns:
      optional of enum instance
    • values

      static DiscountCodeState[] values()
      possible enum values
      Returns:
      array of possible enum values