Class CartDiscountBuilder
- All Implemented Interfaces:
Builder<CartDiscount>
Example to create an instance using the builder pattern
CartDiscount cartDiscount = CartDiscount.builder()
.id("{id}")
.version(0.3)
.createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.name(nameBuilder -> nameBuilder)
.value(valueBuilder -> valueBuilder)
.cartPredicate("{cartPredicate}")
.sortOrder("{sortOrder}")
.plusStores(storesBuilder -> storesBuilder)
.isActive(true)
.requiresDiscountCode(true)
.plusReferences(referencesBuilder -> referencesBuilder)
.stackingMode(StackingMode.STACKING)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionIf a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If empty, the Cart Discount applies on all Carts, irrespective of a Store.build()
builds CartDiscount with checking for non-null required valuesbuilds CartDiscount without checking for non-null required valuescartPredicate
(String cartPredicate) Valid Cart Predicate.createdAt
(ZonedDateTime createdAt) Date and time (UTC) the CartDiscount was initially created.IDs and references that created the CartDiscount.createdBy
(Function<CreatedByBuilder, CreatedByBuilder> builder) IDs and references that created the CartDiscount.custom
(CustomFields custom) Custom Fields of the CartDiscount.custom
(Function<CustomFieldsBuilder, CustomFieldsBuilder> builder) Custom Fields of the CartDiscount.description
(LocalizedString description) Description of the CartDiscount.Description of the CartDiscount.Valid Cart Predicate.Date and time (UTC) the CartDiscount was initially created.IDs and references that created the CartDiscount.Custom Fields of the CartDiscount.Description of the CartDiscount.getId()
Unique identifier of the CartDiscount.Indicates if the CartDiscount is active and can be applied to the Cart.getKey()
User-defined unique identifier of the CartDiscount.Date and time (UTC) the CartDiscount was last updated.IDs and references that last modified the CartDiscount.getName()
Name of the CartDiscount.References of all resources that are addressed in the predicate.Indicates if the Discount is used in connection with a DiscountCode.Value between0
and1
.Indicates whether the application of the CartDiscount causes other discounts to be ignored.If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If empty, the Cart Discount applies on all Carts, irrespective of a Store.Segment of the Cart that is discounted.Date and time (UTC) from which the Discount is effective.Date and time (UTC) until which the Discount is effective.getValue()
Effect of the CartDiscount on thetarget
.Current version of the CartDiscount.Unique identifier of the CartDiscount.Indicates if the CartDiscount is active and can be applied to the Cart.User-defined unique identifier of the CartDiscount.lastModifiedAt
(ZonedDateTime lastModifiedAt) Date and time (UTC) the CartDiscount was last updated.lastModifiedBy
(LastModifiedBy lastModifiedBy) IDs and references that last modified the CartDiscount.IDs and references that last modified the CartDiscount.name
(LocalizedString name) Name of the CartDiscount.Name of the CartDiscount.static CartDiscountBuilder
of()
factory method for an instance of CartDiscountBuilderstatic CartDiscountBuilder
of
(CartDiscount template) create builder for CartDiscount instanceplusReferences
(Reference... references) References of all resources that are addressed in the predicate.plusReferences
(Function<ReferenceBuilder, Builder<? extends Reference>> builder) References of all resources that are addressed in the predicate.plusStores
(StoreKeyReference... stores) If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If empty, the Cart Discount applies on all Carts, irrespective of a Store.If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If empty, the Cart Discount applies on all Carts, irrespective of a Store.references
(Reference... references) References of all resources that are addressed in the predicate.references
(List<Reference> references) References of all resources that are addressed in the predicate.requiresDiscountCode
(Boolean requiresDiscountCode) Indicates if the Discount is used in connection with a DiscountCode.If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If empty, the Cart Discount applies on all Carts, irrespective of a Store.Value between0
and1
.stackingMode
(StackingMode stackingMode) Indicates whether the application of the CartDiscount causes other discounts to be ignored.stores
(StoreKeyReference... stores) If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If empty, the Cart Discount applies on all Carts, irrespective of a Store.stores
(List<StoreKeyReference> stores) If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If empty, the Cart Discount applies on all Carts, irrespective of a Store.target
(CartDiscountTarget target) Segment of the Cart that is discounted.target
(Function<CartDiscountTargetBuilder, Builder<? extends CartDiscountTarget>> builder) Segment of the Cart that is discounted.validFrom
(ZonedDateTime validFrom) Date and time (UTC) from which the Discount is effective.validUntil
(ZonedDateTime validUntil) Date and time (UTC) until which the Discount is effective.value
(CartDiscountValue value) Effect of the CartDiscount on thetarget
.value
(Function<CartDiscountValueBuilder, Builder<? extends CartDiscountValue>> builder) Effect of the CartDiscount on thetarget
.Current version of the CartDiscount.withCreatedBy
(Function<CreatedByBuilder, CreatedBy> builder) IDs and references that created the CartDiscount.withCustom
(Function<CustomFieldsBuilder, CustomFields> builder) Custom Fields of the CartDiscount.Description of the CartDiscount.IDs and references that last modified the CartDiscount.Name of the CartDiscount.withReferences
(Function<ReferenceBuilder, Builder<? extends Reference>> builder) References of all resources that are addressed in the predicate.If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field. If empty, the Cart Discount applies on all Carts, irrespective of a Store.
-
Constructor Details
-
CartDiscountBuilder
public CartDiscountBuilder()
-
-
Method Details
-
id
Unique identifier of the CartDiscount.
- Parameters:
id
- value to be set- Returns:
- Builder
-
version
Current version of the CartDiscount.
- Parameters:
version
- value to be set- Returns:
- Builder
-
createdAt
Date and time (UTC) the CartDiscount was initially created.
- Parameters:
createdAt
- value to be set- Returns:
- Builder
-
lastModifiedAt
Date and time (UTC) the CartDiscount was last updated.
- Parameters:
lastModifiedAt
- value to be set- Returns:
- Builder
-
lastModifiedBy
public CartDiscountBuilder lastModifiedBy(Function<LastModifiedByBuilder, LastModifiedByBuilder> builder) IDs and references that last modified the CartDiscount.
- Parameters:
builder
- function to build the lastModifiedBy value- Returns:
- Builder
-
withLastModifiedBy
public CartDiscountBuilder withLastModifiedBy(Function<LastModifiedByBuilder, LastModifiedBy> builder) IDs and references that last modified the CartDiscount.
- Parameters:
builder
- function to build the lastModifiedBy value- Returns:
- Builder
-
lastModifiedBy
IDs and references that last modified the CartDiscount.
- Parameters:
lastModifiedBy
- value to be set- Returns:
- Builder
-
createdBy
IDs and references that created the CartDiscount.
- Parameters:
builder
- function to build the createdBy value- Returns:
- Builder
-
withCreatedBy
IDs and references that created the CartDiscount.
- Parameters:
builder
- function to build the createdBy value- Returns:
- Builder
-
createdBy
IDs and references that created the CartDiscount.
- Parameters:
createdBy
- value to be set- Returns:
- Builder
-
name
Name of the CartDiscount.
- Parameters:
builder
- function to build the name value- Returns:
- Builder
-
withName
Name of the CartDiscount.
- Parameters:
builder
- function to build the name value- Returns:
- Builder
-
name
Name of the CartDiscount.
- Parameters:
name
- value to be set- Returns:
- Builder
-
key
User-defined unique identifier of the CartDiscount.
- Parameters:
key
- value to be set- Returns:
- Builder
-
description
public CartDiscountBuilder description(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) Description of the CartDiscount.
- Parameters:
builder
- function to build the description value- Returns:
- Builder
-
withDescription
public CartDiscountBuilder withDescription(Function<LocalizedStringBuilder, LocalizedString> builder) Description of the CartDiscount.
- Parameters:
builder
- function to build the description value- Returns:
- Builder
-
description
Description of the CartDiscount.
- Parameters:
description
- value to be set- Returns:
- Builder
-
value
Effect of the CartDiscount on the
target
.- Parameters:
value
- value to be set- Returns:
- Builder
-
value
public CartDiscountBuilder value(Function<CartDiscountValueBuilder, Builder<? extends CartDiscountValue>> builder) Effect of the CartDiscount on the
target
.- Parameters:
builder
- function to build the value value- Returns:
- Builder
-
cartPredicate
Valid Cart Predicate.
- Parameters:
cartPredicate
- value to be set- Returns:
- Builder
-
target
Segment of the Cart that is discounted.
Empty, if the
value
isgiftLineItem
.- Parameters:
target
- value to be set- Returns:
- Builder
-
target
public CartDiscountBuilder target(Function<CartDiscountTargetBuilder, Builder<? extends CartDiscountTarget>> builder) Segment of the Cart that is discounted.
Empty, if the
value
isgiftLineItem
.- Parameters:
builder
- function to build the target value- Returns:
- Builder
-
sortOrder
Value between
0
and1
. All matching CartDiscounts are applied to a Cart in the order defined by this field. A Discount with a higher sortOrder is prioritized. The sort order is unambiguous among all CartDiscounts.- Parameters:
sortOrder
- value to be set- Returns:
- Builder
-
stores
- If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If empty, the Cart Discount applies on all Carts, irrespective of a Store.
- Parameters:
stores
- value to be set- Returns:
- Builder
-
stores
- If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If empty, the Cart Discount applies on all Carts, irrespective of a Store.
- Parameters:
stores
- value to be set- Returns:
- Builder
-
plusStores
- If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If empty, the Cart Discount applies on all Carts, irrespective of a Store.
- Parameters:
stores
- value to be set- Returns:
- Builder
-
plusStores
public CartDiscountBuilder plusStores(Function<StoreKeyReferenceBuilder, StoreKeyReferenceBuilder> builder) - If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If empty, the Cart Discount applies on all Carts, irrespective of a Store.
- Parameters:
builder
- function to build the stores value- Returns:
- Builder
-
withStores
public CartDiscountBuilder withStores(Function<StoreKeyReferenceBuilder, StoreKeyReferenceBuilder> builder) - If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If empty, the Cart Discount applies on all Carts, irrespective of a Store.
- Parameters:
builder
- function to build the stores value- Returns:
- Builder
-
addStores
- If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If empty, the Cart Discount applies on all Carts, irrespective of a Store.
- Parameters:
builder
- function to build the stores value- Returns:
- Builder
-
setStores
- If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If empty, the Cart Discount applies on all Carts, irrespective of a Store.
- Parameters:
builder
- function to build the stores value- Returns:
- Builder
-
isActive
Indicates if the CartDiscount is active and can be applied to the Cart.
- Parameters:
isActive
- value to be set- Returns:
- Builder
-
validFrom
Date and time (UTC) from which the Discount is effective.
- Parameters:
validFrom
- value to be set- Returns:
- Builder
-
validUntil
Date and time (UTC) until which the Discount is effective.
- Parameters:
validUntil
- value to be set- Returns:
- Builder
-
requiresDiscountCode
Indicates if the Discount is used in connection with a DiscountCode.
- Parameters:
requiresDiscountCode
- value to be set- Returns:
- Builder
-
references
References of all resources that are addressed in the predicate. The API generates this array from the predicate.
- Parameters:
references
- value to be set- Returns:
- Builder
-
references
References of all resources that are addressed in the predicate. The API generates this array from the predicate.
- Parameters:
references
- value to be set- Returns:
- Builder
-
plusReferences
References of all resources that are addressed in the predicate. The API generates this array from the predicate.
- Parameters:
references
- value to be set- Returns:
- Builder
-
plusReferences
public CartDiscountBuilder plusReferences(Function<ReferenceBuilder, Builder<? extends Reference>> builder) References of all resources that are addressed in the predicate. The API generates this array from the predicate.
- Parameters:
builder
- function to build the references value- Returns:
- Builder
-
withReferences
public CartDiscountBuilder withReferences(Function<ReferenceBuilder, Builder<? extends Reference>> builder) References of all resources that are addressed in the predicate. The API generates this array from the predicate.
- Parameters:
builder
- function to build the references value- Returns:
- Builder
-
stackingMode
Indicates whether the application of the CartDiscount causes other discounts to be ignored.
- Parameters:
stackingMode
- value to be set- Returns:
- Builder
-
custom
Custom Fields of the CartDiscount.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
withCustom
Custom Fields of the CartDiscount.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
custom
Custom Fields of the CartDiscount.
- Parameters:
custom
- value to be set- Returns:
- Builder
-
getId
Unique identifier of the CartDiscount.
- Returns:
- id
-
getVersion
Current version of the CartDiscount.
- Returns:
- version
-
getCreatedAt
Date and time (UTC) the CartDiscount was initially created.
- Returns:
- createdAt
-
getLastModifiedAt
Date and time (UTC) the CartDiscount was last updated.
- Returns:
- lastModifiedAt
-
getLastModifiedBy
IDs and references that last modified the CartDiscount.
- Returns:
- lastModifiedBy
-
getCreatedBy
IDs and references that created the CartDiscount.
- Returns:
- createdBy
-
getName
Name of the CartDiscount.
- Returns:
- name
-
getKey
User-defined unique identifier of the CartDiscount.
- Returns:
- key
-
getDescription
Description of the CartDiscount.
- Returns:
- description
-
getValue
Effect of the CartDiscount on the
target
.- Returns:
- value
-
getCartPredicate
Valid Cart Predicate.
- Returns:
- cartPredicate
-
getTarget
Segment of the Cart that is discounted.
Empty, if the
value
isgiftLineItem
.- Returns:
- target
-
getSortOrder
Value between
0
and1
. All matching CartDiscounts are applied to a Cart in the order defined by this field. A Discount with a higher sortOrder is prioritized. The sort order is unambiguous among all CartDiscounts.- Returns:
- sortOrder
-
getStores
- If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
- If empty, the Cart Discount applies on all Carts, irrespective of a Store.
- Returns:
- stores
-
getIsActive
Indicates if the CartDiscount is active and can be applied to the Cart.
- Returns:
- isActive
-
getValidFrom
Date and time (UTC) from which the Discount is effective.
- Returns:
- validFrom
-
getValidUntil
Date and time (UTC) until which the Discount is effective.
- Returns:
- validUntil
-
getRequiresDiscountCode
Indicates if the Discount is used in connection with a DiscountCode.
- Returns:
- requiresDiscountCode
-
getReferences
References of all resources that are addressed in the predicate. The API generates this array from the predicate.
- Returns:
- references
-
getStackingMode
Indicates whether the application of the CartDiscount causes other discounts to be ignored.
- Returns:
- stackingMode
-
getCustom
Custom Fields of the CartDiscount.
- Returns:
- custom
-
build
builds CartDiscount with checking for non-null required values- Specified by:
build
in interfaceBuilder<CartDiscount>
- Returns:
- CartDiscount
-
buildUnchecked
builds CartDiscount without checking for non-null required values- Returns:
- CartDiscount
-
of
factory method for an instance of CartDiscountBuilder- Returns:
- builder
-
of
create builder for CartDiscount instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-