Enum Class VoucherStatus
- All Implemented Interfaces:
Serializable,Comparable<VoucherStatus>,Constable
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if this status allows the voucher to be redeemed.Returns a human-readable description of this status.booleanChecks if this status represents a terminal state.static VoucherStatusReturns the enum constant of this class with the specified name.static VoucherStatus[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ISSUED
Voucher has been issued and published to the Nostr ledger. It is ready for redemption by the holder at the issuing merchant. -
REDEEMED
Voucher has been successfully redeemed by the merchant. This is a terminal state - the voucher cannot be reused. -
REVOKED
Voucher has been revoked by the issuer before redemption. This is a terminal state - the voucher can no longer be redeemed. -
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
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
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 nameNullPointerException- 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
Returns a human-readable description of this status.- Returns:
- status description
-