Fired while a voucher is being redeemed, before the status changes, so that an app can refuse it. Mirrors the contract ShoppingCartEvent.createBeforeCheckoutEvent already uses for checkout: a listener that objects adds an error message, and a non-empty list aborts the redemption. Redemption had no equivalent, which is why this exists. Always dispatched synchronously within the request doing the redeeming, and never queued - the caller is waiting for the answer. That is why it carries the voucher itself rather than an id: a rule that wants to know the voucher's type or value should not have to load it again.

Implements: CommonAppEvent


Properties

PropertyReturnsDescription
errorMessagesList<String>The reasons this redemption should be refused, accumulated by calls to addErrorMessage.
ipAddressStringThe client IP address the redemption request came from.
redeemerProfileThe profile redeeming the voucher.
voucherVoucherThe voucher being redeemed.

Methods

getVoucher()

Returns: Voucher

The voucher being redeemed.

getRedeemer()

Returns: Profile

The profile redeeming the voucher.

getIpAddress()

Returns: String

The client IP address the redemption request came from.

getErrorMessages()

Returns: List<String>

The reasons this redemption should be refused, accumulated by calls to addErrorMessage.

addErrorMessage(String s)

Returns: void

Refuse this redemption. Any message added here aborts the redemption and is shown to the user, so it must be safe to show them.

ParameterDescription
sthe reason, shown to the user. Must not be blank
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.