Enum Class VoucherStatus

java.lang.Object
java.lang.Enum<VoucherStatus>
xyz.tcheeric.cashu.voucher.domain.VoucherStatus
All Implemented Interfaces:
Serializable, Comparable<VoucherStatus>, Constable

public enum VoucherStatus extends Enum<VoucherStatus>
Represents the lifecycle status of a voucher.

Voucher status transitions follow this typical flow:

     ISSUED → REDEEMED
     ISSUED → REVOKED
     ISSUED → EXPIRED (time-based transition)
 

Status Descriptions

  • ISSUED: Voucher has been created and published to Nostr ledger, ready for redemption
  • REDEEMED: Voucher has been successfully redeemed by the merchant (terminal state)
  • REVOKED: Voucher has been revoked by the issuer before redemption (terminal state)
  • EXPIRED: Voucher's expiry time has passed without redemption (terminal state)

Model B Constraints

In Model B, vouchers can only be redeemed at the issuing merchant. The mint will reject any swap/melt operations with voucher secrets.

See Also:
  • Enum Constant Details

    • ISSUED

      public static final VoucherStatus ISSUED
      Voucher has been issued and published to the Nostr ledger. It is ready for redemption by the holder at the issuing merchant.
    • REDEEMED

      public static final VoucherStatus REDEEMED
      Voucher has been successfully redeemed by the merchant. This is a terminal state - the voucher cannot be reused.
    • REVOKED

      public static final VoucherStatus REVOKED
      Voucher has been revoked by the issuer before redemption. This is a terminal state - the voucher can no longer be redeemed.
    • EXPIRED

      public static final VoucherStatus EXPIRED
      Voucher's expiry time has passed without being redeemed. This is a terminal state - the voucher can no longer be redeemed.
  • Method Details

    • values

      public static VoucherStatus[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static VoucherStatus valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isTerminal

      public boolean isTerminal()
      Checks if this status represents a terminal state.

      Terminal states are: REDEEMED, REVOKED, EXPIRED

      Returns:
      true if this is a terminal state, false otherwise
    • canBeRedeemed

      public boolean canBeRedeemed()
      Checks if this status allows the voucher to be redeemed.

      Only vouchers in ISSUED status can be redeemed.

      Returns:
      true if redemption is allowed, false otherwise
    • getDescription

      public String getDescription()
      Returns a human-readable description of this status.
      Returns:
      status description