Fluent builder for allocating a single voucher, either a specific voucher passed via voucher(Voucher) or, if none is given, the first available unallocated voucher of the builder's voucher type. Obtained from VoucherManager.newVoucherAllocationBuilder(VoucherType) and completed with build().
Group: Builders
Methods
allocatedTo(Profile p)
Returns: VoucherAllocationBuilder
Sets the profile to allocate the voucher to.
| Parameter | Description |
|---|---|
p | the recipient profile |
allocatedToId(String p)
Returns: VoucherAllocationBuilder
Sets the identifier of the recipient to record on the allocated voucher.
| Parameter | Description |
|---|---|
p | a user identifier string |
notes(String p)
Returns: VoucherAllocationBuilder
Sets notes to record against the allocation.
| Parameter | Description |
|---|---|
p | notes to store on the voucher |
voucher(Voucher p)
Returns: VoucherAllocationBuilder
Sets a specific voucher to allocate. If not set, the first available unallocated voucher of the builder's voucher type is allocated instead.
| Parameter | Description |
|---|---|
p | the specific voucher to allocate |
redeemerOrg(Organisation p)
Returns: VoucherAllocationBuilder
Sets the organisation the voucher is being allocated for redemption at (e.g. a specific hotel or restaurant).
| Parameter | Description |
|---|---|
p | the redeeming organisation |
excludedVoucherIds(List<Long> ids)
Returns: VoucherAllocationBuilder
Sets voucher IDs to exclude when automatically finding an available voucher to allocate.
| Parameter | Description |
|---|---|
ids | internal IDs of vouchers to exclude from the search |
build()
Returns: Voucher
Executes the allocation request: allocates the specific voucher if one was set, otherwise finds and allocates an available voucher of the builder's voucher type.