Class DiscountCodeBuilder
- All Implemented Interfaces:
Builder<DiscountCode>
Example to create an instance using the builder pattern
DiscountCode discountCode = DiscountCode.builder()
.id("{id}")
.version(0.3)
.createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.code("{code}")
.plusCartDiscounts(cartDiscountsBuilder -> cartDiscountsBuilder)
.isActive(true)
.plusReferences(referencesBuilder -> referencesBuilder)
.plusGroups(groupsBuilder -> groupsBuilder)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.applicationVersion
(Long applicationVersion) Used and managed by the API and must not be used in customer logic.build()
builds DiscountCode with checking for non-null required valuesbuilds DiscountCode without checking for non-null required valuescartDiscounts
(CartDiscountReference... cartDiscounts) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.cartDiscounts
(List<CartDiscountReference> cartDiscounts) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.cartPredicate
(String cartPredicate) DiscountCode can only be applied to Carts that match this predicate.User-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts.createdAt
(ZonedDateTime createdAt) Date and time (UTC) the DiscountCode was initially created.IDs and references that created the DiscountCode.createdBy
(Function<CreatedByBuilder, CreatedByBuilder> builder) IDs and references that created the DiscountCode.custom
(CustomFields custom) Custom Fields of the DiscountCode.custom
(Function<CustomFieldsBuilder, CustomFieldsBuilder> builder) Custom Fields of the DiscountCode.description
(LocalizedString description) Description of the DiscountCode.Description of the DiscountCode.Used and managed by the API and must not be used in customer logic.Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.DiscountCode can only be applied to Carts that match this predicate.getCode()
User-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts.Date and time (UTC) the DiscountCode was initially created.IDs and references that created the DiscountCode.Custom Fields of the DiscountCode.Description of the DiscountCode.Groups to which the DiscountCode belongs to.getId()
Unique identifier of the DiscountCode.Indicates if the DiscountCode is active and can be applied to the Cart.getKey()
User-defined unique identifier of the DiscountCode.Date and time (UTC) the DiscountCode was last updated.IDs and references that last modified the DiscountCode.Number of times the DiscountCode can be applied.Number of times the DiscountCode can be applied per Customer (anonymous Carts are not supported).getName()
Name of the DiscountCode.Array generated from the Cart predicate.Date and time (UTC) from which the DiscountCode is effective.Date and time (UTC) until which the DiscountCode is effective.Current version of the DiscountCode.Groups to which the DiscountCode belongs to.Groups to which the DiscountCode belongs to.Unique identifier of the DiscountCode.Indicates if the DiscountCode is active and can be applied to the Cart.User-defined unique identifier of the DiscountCode.lastModifiedAt
(ZonedDateTime lastModifiedAt) Date and time (UTC) the DiscountCode was last updated.lastModifiedBy
(LastModifiedBy lastModifiedBy) IDs and references that last modified the DiscountCode.IDs and references that last modified the DiscountCode.maxApplications
(Long maxApplications) Number of times the DiscountCode can be applied.maxApplicationsPerCustomer
(Long maxApplicationsPerCustomer) Number of times the DiscountCode can be applied per Customer (anonymous Carts are not supported).name
(LocalizedString name) Name of the DiscountCode.Name of the DiscountCode.static DiscountCodeBuilder
of()
factory method for an instance of DiscountCodeBuilderstatic DiscountCodeBuilder
of
(DiscountCode template) create builder for DiscountCode instanceplusCartDiscounts
(CartDiscountReference... cartDiscounts) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.plusGroups
(String... groups) Groups to which the DiscountCode belongs to.plusReferences
(Reference... references) Array generated from the Cart predicate.plusReferences
(Function<ReferenceBuilder, Builder<? extends Reference>> builder) Array generated from the Cart predicate.references
(Reference... references) Array generated from the Cart predicate.references
(List<Reference> references) Array generated from the Cart predicate.Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.validFrom
(ZonedDateTime validFrom) Date and time (UTC) from which the DiscountCode is effective.validUntil
(ZonedDateTime validUntil) Date and time (UTC) until which the DiscountCode is effective.Current version of the DiscountCode.Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.withCreatedBy
(Function<CreatedByBuilder, CreatedBy> builder) IDs and references that created the DiscountCode.withCustom
(Function<CustomFieldsBuilder, CustomFields> builder) Custom Fields of the DiscountCode.Description of the DiscountCode.IDs and references that last modified the DiscountCode.Name of the DiscountCode.withReferences
(Function<ReferenceBuilder, Builder<? extends Reference>> builder) Array generated from the Cart predicate.
-
Constructor Details
-
DiscountCodeBuilder
public DiscountCodeBuilder()
-
-
Method Details
-
id
Unique identifier of the DiscountCode.
- Parameters:
id
- value to be set- Returns:
- Builder
-
version
Current version of the DiscountCode.
- Parameters:
version
- value to be set- Returns:
- Builder
-
createdAt
Date and time (UTC) the DiscountCode was initially created.
- Parameters:
createdAt
- value to be set- Returns:
- Builder
-
lastModifiedAt
Date and time (UTC) the DiscountCode was last updated.
- Parameters:
lastModifiedAt
- value to be set- Returns:
- Builder
-
key
User-defined unique identifier of the DiscountCode.
- Parameters:
key
- value to be set- Returns:
- Builder
-
lastModifiedBy
public DiscountCodeBuilder lastModifiedBy(Function<LastModifiedByBuilder, LastModifiedByBuilder> builder) IDs and references that last modified the DiscountCode.
- Parameters:
builder
- function to build the lastModifiedBy value- Returns:
- Builder
-
withLastModifiedBy
public DiscountCodeBuilder withLastModifiedBy(Function<LastModifiedByBuilder, LastModifiedBy> builder) IDs and references that last modified the DiscountCode.
- Parameters:
builder
- function to build the lastModifiedBy value- Returns:
- Builder
-
lastModifiedBy
IDs and references that last modified the DiscountCode.
- Parameters:
lastModifiedBy
- value to be set- Returns:
- Builder
-
createdBy
IDs and references that created the DiscountCode.
- Parameters:
builder
- function to build the createdBy value- Returns:
- Builder
-
withCreatedBy
IDs and references that created the DiscountCode.
- Parameters:
builder
- function to build the createdBy value- Returns:
- Builder
-
createdBy
IDs and references that created the DiscountCode.
- Parameters:
createdBy
- value to be set- Returns:
- Builder
-
name
Name of the DiscountCode.
- Parameters:
builder
- function to build the name value- Returns:
- Builder
-
withName
Name of the DiscountCode.
- Parameters:
builder
- function to build the name value- Returns:
- Builder
-
name
Name of the DiscountCode.
- Parameters:
name
- value to be set- Returns:
- Builder
-
description
public DiscountCodeBuilder description(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) Description of the DiscountCode.
- Parameters:
builder
- function to build the description value- Returns:
- Builder
-
withDescription
public DiscountCodeBuilder withDescription(Function<LocalizedStringBuilder, LocalizedString> builder) Description of the DiscountCode.
- Parameters:
builder
- function to build the description value- Returns:
- Builder
-
description
Description of the DiscountCode.
- Parameters:
description
- value to be set- Returns:
- Builder
-
code
User-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts.
- Parameters:
code
- value to be set- Returns:
- Builder
-
cartDiscounts
Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
cartDiscounts
- value to be set- Returns:
- Builder
-
cartDiscounts
Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
cartDiscounts
- value to be set- Returns:
- Builder
-
plusCartDiscounts
Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
cartDiscounts
- value to be set- Returns:
- Builder
-
plusCartDiscounts
public DiscountCodeBuilder plusCartDiscounts(Function<CartDiscountReferenceBuilder, CartDiscountReferenceBuilder> builder) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
builder
- function to build the cartDiscounts value- Returns:
- Builder
-
withCartDiscounts
public DiscountCodeBuilder withCartDiscounts(Function<CartDiscountReferenceBuilder, CartDiscountReferenceBuilder> builder) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
builder
- function to build the cartDiscounts value- Returns:
- Builder
-
addCartDiscounts
public DiscountCodeBuilder addCartDiscounts(Function<CartDiscountReferenceBuilder, CartDiscountReference> builder) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
builder
- function to build the cartDiscounts value- Returns:
- Builder
-
setCartDiscounts
public DiscountCodeBuilder setCartDiscounts(Function<CartDiscountReferenceBuilder, CartDiscountReference> builder) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
builder
- function to build the cartDiscounts value- Returns:
- Builder
-
cartPredicate
DiscountCode can only be applied to Carts that match this predicate.
- Parameters:
cartPredicate
- value to be set- Returns:
- Builder
-
isActive
Indicates if the DiscountCode is active and can be applied to the Cart.
- Parameters:
isActive
- value to be set- Returns:
- Builder
-
references
Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.
- Parameters:
references
- value to be set- Returns:
- Builder
-
references
Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.
- Parameters:
references
- value to be set- Returns:
- Builder
-
plusReferences
Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.
- Parameters:
references
- value to be set- Returns:
- Builder
-
plusReferences
public DiscountCodeBuilder plusReferences(Function<ReferenceBuilder, Builder<? extends Reference>> builder) Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.
- Parameters:
builder
- function to build the references value- Returns:
- Builder
-
withReferences
public DiscountCodeBuilder withReferences(Function<ReferenceBuilder, Builder<? extends Reference>> builder) Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.
- Parameters:
builder
- function to build the references value- Returns:
- Builder
-
maxApplications
Number of times the DiscountCode can be applied. DiscountCode application is counted at the time of Order creation or edit. However, Order cancellation or deletion does not decrement the count.
- Parameters:
maxApplications
- value to be set- Returns:
- Builder
-
maxApplicationsPerCustomer
Number of times the DiscountCode can be applied per Customer (anonymous Carts are not supported). DiscountCode application is counted at the time of Order creation or edit. However, Order cancellation or deletion does not decrement the count.
- Parameters:
maxApplicationsPerCustomer
- value to be set- Returns:
- Builder
-
custom
Custom Fields of the DiscountCode.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
withCustom
Custom Fields of the DiscountCode.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
custom
Custom Fields of the DiscountCode.
- Parameters:
custom
- value to be set- Returns:
- Builder
-
groups
Groups to which the DiscountCode belongs to.
- Parameters:
groups
- value to be set- Returns:
- Builder
-
groups
Groups to which the DiscountCode belongs to.
- Parameters:
groups
- value to be set- Returns:
- Builder
-
plusGroups
Groups to which the DiscountCode belongs to.
- Parameters:
groups
- value to be set- Returns:
- Builder
-
validFrom
Date and time (UTC) from which the DiscountCode is effective.
- Parameters:
validFrom
- value to be set- Returns:
- Builder
-
validUntil
Date and time (UTC) until which the DiscountCode is effective.
- Parameters:
validUntil
- value to be set- Returns:
- Builder
-
applicationVersion
Used and managed by the API and must not be used in customer logic. The value can change at any time due to internal and external factors.
- Parameters:
applicationVersion
- value to be set- Returns:
- Builder
-
getId
Unique identifier of the DiscountCode.
- Returns:
- id
-
getVersion
Current version of the DiscountCode.
- Returns:
- version
-
getCreatedAt
Date and time (UTC) the DiscountCode was initially created.
- Returns:
- createdAt
-
getLastModifiedAt
Date and time (UTC) the DiscountCode was last updated.
- Returns:
- lastModifiedAt
-
getKey
User-defined unique identifier of the DiscountCode.
- Returns:
- key
-
getLastModifiedBy
IDs and references that last modified the DiscountCode.
- Returns:
- lastModifiedBy
-
getCreatedBy
IDs and references that created the DiscountCode.
- Returns:
- createdBy
-
getName
Name of the DiscountCode.
- Returns:
- name
-
getDescription
Description of the DiscountCode.
- Returns:
- description
-
getCode
User-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts.
- Returns:
- code
-
getCartDiscounts
Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Returns:
- cartDiscounts
-
getCartPredicate
DiscountCode can only be applied to Carts that match this predicate.
- Returns:
- cartPredicate
-
getIsActive
Indicates if the DiscountCode is active and can be applied to the Cart.
- Returns:
- isActive
-
getReferences
Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.
- Returns:
- references
-
getMaxApplications
Number of times the DiscountCode can be applied. DiscountCode application is counted at the time of Order creation or edit. However, Order cancellation or deletion does not decrement the count.
- Returns:
- maxApplications
-
getMaxApplicationsPerCustomer
Number of times the DiscountCode can be applied per Customer (anonymous Carts are not supported). DiscountCode application is counted at the time of Order creation or edit. However, Order cancellation or deletion does not decrement the count.
- Returns:
- maxApplicationsPerCustomer
-
getCustom
Custom Fields of the DiscountCode.
- Returns:
- custom
-
getGroups
Groups to which the DiscountCode belongs to.
- Returns:
- groups
-
getValidFrom
Date and time (UTC) from which the DiscountCode is effective.
- Returns:
- validFrom
-
getValidUntil
Date and time (UTC) until which the DiscountCode is effective.
- Returns:
- validUntil
-
getApplicationVersion
Used and managed by the API and must not be used in customer logic. The value can change at any time due to internal and external factors.
- Returns:
- applicationVersion
-
build
builds DiscountCode with checking for non-null required values- Specified by:
build
in interfaceBuilder<DiscountCode>
- Returns:
- DiscountCode
-
buildUnchecked
builds DiscountCode without checking for non-null required values- Returns:
- DiscountCode
-
of
factory method for an instance of DiscountCodeBuilder- Returns:
- builder
-
of
create builder for DiscountCode instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-