Fluent builder for allocating one or more vouchers of a given voucher type. If the voucher type auto-creates vouchers, a new voucher is created and allocated; otherwise it allocates from the pool of already-created, unallocated vouchers, either a single available one or a specific count via numberOfVouchers. Obtained from VoucherManager.newVoucherTypeBuilder(VoucherType) and completed with build().
Group: Builders
Methods
allocatedTo(Profile allocatedTo)
Returns: VoucherTypeAllocationBuilder
Sets the profile to whom the voucher(s) will be allocated.
| Parameter | Description |
|---|---|
allocatedTo | the recipient profile |
allocatedToId(String allocatedToId)
Returns: VoucherTypeAllocationBuilder
Sets the identifier of the profile to whom the voucher(s) will be allocated.
| Parameter | Description |
|---|---|
allocatedToId | the recipient profile ID |
notes(String notes)
Returns: VoucherTypeAllocationBuilder
Sets the notes associated with the voucher allocation.
| Parameter | Description |
|---|---|
notes | the allocation notes |
redeemerOrg(Organisation redeemerOrg)
Returns: VoucherTypeAllocationBuilder
Sets the organisation that will be able to redeem the voucher type.
| Parameter | Description |
|---|---|
redeemerOrg | the redeeming organisation |
numberOfVouchers(Integer numberOfVouchers)
Returns: VoucherTypeAllocationBuilder
Sets the number of vouchers to be allocated. If null, a single available pre-generated voucher will be allocated instead.
| Parameter | Description |
|---|---|
numberOfVouchers | the number of vouchers to allocate, or null to allocate one pre-generated voucher |
allocatedByProfile(Profile allocatedByProfile)
Returns: VoucherTypeAllocationBuilder
Sets the profile of the user who is performing the voucher allocation.
| Parameter | Description |
|---|---|
allocatedByProfile | the allocating profile |
allocatedDate(Date allocatedDate)
Returns: VoucherTypeAllocationBuilder
Sets the date when the voucher allocation was performed.
| Parameter | Description |
|---|---|
allocatedDate | the allocation date |
build()
Returns: List<Voucher>
Executes the allocation request, creating and/or allocating vouchers of the builder's voucher type as configured.