Fluent builder for creating a new voucher type, or updating an existing one, on the current tenant organisation. Looks up an existing voucher type by name and updates it, or creates a new one if none is found. Obtained from VoucherManager.newVoucherTypeBuilder() and completed with build().
Group: Builders
Methods
name(String name) · title(String title) · template(String template) · notes(String notes) · validForDays(Integer validForDays) · cashValue(BigDecimal cashValue) · staticExpiryDate(Date staticExpiryDate) · redeemingOrg(Organisation redeemingOrg) · voucherIdTemplate(String voucherIdTemplate) · content(String content) · productSku(ProductSku productSku) · extraFields(List<ExtraField> extraFields) · autoCreateVoucher(boolean autoCreateVoucher) · build()
name(String name)
Returns: VoucherTypeBuilder
Sets the name used for the voucher type. If a voucher type with the given name exists, it will be updated Otherwise, a new one will be created.
| Parameter | Description |
|---|---|
name | the name |
title(String title)
Returns: VoucherTypeBuilder
Sets the title of the voucher type.
| Parameter | Description |
|---|---|
title | the title |
template(String template)
Returns: VoucherTypeBuilder
Sets the template used for the voucher type.
| Parameter | Description |
|---|---|
template | the template name |
notes(String notes)
Returns: VoucherTypeBuilder
Sets the notes for the voucher type.
| Parameter | Description |
|---|---|
notes | the notes |
validForDays(Integer validForDays)
Returns: VoucherTypeBuilder
Sets the number of days the voucher is valid for.
| Parameter | Description |
|---|---|
validForDays | the validity period in days |
cashValue(BigDecimal cashValue)
Returns: VoucherTypeBuilder
Sets the cash value of the voucher type.
| Parameter | Description |
|---|---|
cashValue | the value |
staticExpiryDate(Date staticExpiryDate)
Returns: VoucherTypeBuilder
Sets the static expiry date for the voucher type.
| Parameter | Description |
|---|---|
staticExpiryDate | the expiry date |
redeemingOrg(Organisation redeemingOrg)
Returns: VoucherTypeBuilder
Sets the organisation that will be able to redeem the voucher type.
| Parameter | Description |
|---|---|
redeemingOrg | the redeeming organisation |
voucherIdTemplate(String voucherIdTemplate)
Returns: VoucherTypeBuilder
Sets the template ID for the voucher type.
| Parameter | Description |
|---|---|
voucherIdTemplate | the template ID |
content(String content)
Returns: VoucherTypeBuilder
Sets the content for the voucher type.
| Parameter | Description |
|---|---|
content | the content |
productSku(ProductSku productSku)
Returns: VoucherTypeBuilder
Sets the product SKU for the voucher type.
| Parameter | Description |
|---|---|
productSku | the product SKU |
extraFields(List<ExtraField> extraFields)
Returns: VoucherTypeBuilder
Sets the extra fields to be added to the voucher type.
| Parameter | Description |
|---|---|
extraFields | the extra fields to add to the voucher type's fieldset |
autoCreateVoucher(boolean autoCreateVoucher)
Returns: VoucherTypeBuilder
Sets whether the voucher type is allowed to automatically create and allocate vouchers.
| Parameter | Description |
|---|---|
autoCreateVoucher | true to create and allocate a voucher automatically on each allocation request |
build()
Returns: VoucherType
Creates the voucher type, or updates the existing one with the same name on the current tenant organisation, applying every value set on the builder and saving it.