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
| Property | Returns | Description |
|---|---|---|
| errorMessages | List<String> | The reasons this redemption should be refused, accumulated by calls to addErrorMessage. |
| ipAddress | String | The client IP address the redemption request came from. |
| redeemer | Profile | The profile redeeming the voucher. |
| voucher | Voucher | The 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.
| Parameter | Description |
|---|---|
s | the reason, shown to the user. Must not be blank |