Class RedeemVoucherResponse

java.lang.Object
xyz.tcheeric.cashu.voucher.app.dto.RedeemVoucherResponse

public class RedeemVoucherResponse extends Object
Response DTO for voucher redemption.

This DTO indicates whether the redemption was successful and provides details about the redeemed voucher.

Usage Example

 RedeemVoucherResponse response = merchantService.redeem(request);

 if (response.isSuccess()) {
     System.out.println("Redeemed: " + response.getAmount() + " " + response.getUnit());
     // Credit customer account, etc.
 } else {
     System.err.println("Redemption failed: " + response.getErrorMessage());
 }
 
  • Constructor Details

    • RedeemVoucherResponse

      public RedeemVoucherResponse()
  • Method Details

    • getAmount

      public Long getAmount()
      The amount redeemed (convenience accessor).
    • getUnit

      public String getUnit()
      The currency unit (convenience accessor).
    • getVoucherId

      public String getVoucherId()
      The voucher ID (convenience accessor).
    • success

      public static RedeemVoucherResponse success(SignedVoucher voucher)
      Creates a successful redemption response.
    • failure

      public static RedeemVoucherResponse failure(String errorMessage)
      Creates a failed redemption response.