Interface DiscountCodeNonApplicableError

All Superinterfaces:
ErrorObject

public interface DiscountCodeNonApplicableError extends ErrorObject

Returned when the Cart contains a Discount Code with a DiscountCodeState other than MatchesCart.

The error is returned as a failed response to:

  • Create Order from Cart and Create Order in Store from Cart requests on Orders.
  • Create Order from Cart and Create Order in Store from Cart requests on My Orders.

Example to create an instance using the builder pattern

     DiscountCodeNonApplicableError discountCodeNonApplicableError = DiscountCodeNonApplicableError.builder()
             .message("{message}")
             .build()
 
  • Field Details

    • DISCOUNT_CODE_NON_APPLICABLE

      static final String DISCOUNT_CODE_NON_APPLICABLE
      discriminator value for DiscountCodeNonApplicableError
      See Also:
  • Method Details

    • getCode

      @NotNull @NotNull String getCode()
      Description copied from interface: ErrorObject

      Error identifier.

      Specified by:
      getCode in interface ErrorObject
      Returns:
      code
    • getMessage

      @NotNull @NotNull String getMessage()

      "The discountCode $discountCodeId cannot be applied to the cart."

      Specified by:
      getMessage in interface ErrorObject
      Returns:
      message
    • getDiscountCode

      String getDiscountCode()

      Discount Code passed to the Cart.

      Returns:
      discountCode
    • getReason

      String getReason()

      "DoesNotExist" or "TimeRangeNonApplicable"

      Returns:
      reason
    • getDiscountCodeId

      String getDiscountCodeId()

      Unique identifier of the Discount Code.

      Returns:
      discountCodeId
    • getValidFrom

      ZonedDateTime getValidFrom()

      Date and time (UTC) from which the Discount Code is valid.

      Returns:
      validFrom
    • getValidUntil

      ZonedDateTime getValidUntil()

      Date and time (UTC) until which the Discount Code is valid.

      Returns:
      validUntil
    • getValidityCheckTime

      ZonedDateTime getValidityCheckTime()

      Date and time (UTC) the Discount Code validity check was last performed.

      Returns:
      validityCheckTime
    • setMessage

      void setMessage(String message)

      "The discountCode $discountCodeId cannot be applied to the cart."

      Specified by:
      setMessage in interface ErrorObject
      Parameters:
      message - value to be set
    • setDiscountCode

      void setDiscountCode(String discountCode)

      Discount Code passed to the Cart.

      Parameters:
      discountCode - value to be set
    • setReason

      void setReason(String reason)

      "DoesNotExist" or "TimeRangeNonApplicable"

      Parameters:
      reason - value to be set
    • setDiscountCodeId

      void setDiscountCodeId(String discountCodeId)

      Unique identifier of the Discount Code.

      Parameters:
      discountCodeId - value to be set
    • setValidFrom

      void setValidFrom(ZonedDateTime validFrom)

      Date and time (UTC) from which the Discount Code is valid.

      Parameters:
      validFrom - value to be set
    • setValidUntil

      void setValidUntil(ZonedDateTime validUntil)

      Date and time (UTC) until which the Discount Code is valid.

      Parameters:
      validUntil - value to be set
    • setValidityCheckTime

      void setValidityCheckTime(ZonedDateTime validityCheckTime)

      Date and time (UTC) the Discount Code validity check was last performed.

      Parameters:
      validityCheckTime - value to be set
    • of

      factory method
      Returns:
      instance of DiscountCodeNonApplicableError
    • of

      factory method to create a shallow copy DiscountCodeNonApplicableError
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      factory method to create a deep copy of DiscountCodeNonApplicableError
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      builder factory method for DiscountCodeNonApplicableError
      Returns:
      builder
    • builder

      create builder for DiscountCodeNonApplicableError instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withDiscountCodeNonApplicableError

      default <T> T withDiscountCodeNonApplicableError(Function<DiscountCodeNonApplicableError,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<DiscountCodeNonApplicableError> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference