Interface CartDiscount
- All Superinterfaces:
BaseResource
,CartDiscountMixin
,Customizable<CartDiscount>
,DomainResource<CartDiscount>
,Identifiable<CartDiscount>
,Referencable<CartDiscount>
,ResourceIdentifiable<CartDiscount>
,Versioned<CartDiscount>
,WithKey
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()
-
Method Summary
Modifier and TypeMethodDescriptionstatic CartDiscountBuilder
builder()
builder factory method for CartDiscountstatic CartDiscountBuilder
builder
(CartDiscount template) create builder for CartDiscount instancestatic CartDiscount
deepCopy
(CartDiscount template) factory method to create a deep copy of CartDiscount@NotNull String
Valid Cart Predicate.@NotNull ZonedDateTime
Date and time (UTC) the CartDiscount was initially created.@Valid CreatedBy
IDs and references that created the CartDiscount.@Valid CustomFields
Custom Fields of the CartDiscount.@Valid LocalizedString
Description of the CartDiscount.@NotNull String
getId()
Unique identifier of the CartDiscount.@NotNull Boolean
Indicates if the CartDiscount is active and can be applied to the Cart.getKey()
User-defined unique identifier of the CartDiscount.@NotNull ZonedDateTime
Date and time (UTC) the CartDiscount was last updated.@Valid LastModifiedBy
IDs and references that last modified the CartDiscount.@NotNull @Valid LocalizedString
getName()
Name of the CartDiscount.References of all resources that are addressed in the predicate.@NotNull Boolean
Indicates if the Discount is used in connection with a DiscountCode.@NotNull String
Value between0
and1
.@NotNull StackingMode
Indicates whether the application of the CartDiscount causes other discounts to be ignored.@NotNull @Valid List<StoreKeyReference>
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.@Valid CartDiscountTarget
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.@NotNull @Valid CartDiscountValue
getValue()
Effect of the CartDiscount on thetarget
.@NotNull Long
Current version of the CartDiscount.static CartDiscount
of()
factory methodstatic CartDiscount
of
(CartDiscount template) factory method to create a shallow copy CartDiscountstatic ReferenceTypeId
void
setCartPredicate
(String cartPredicate) Valid Cart Predicate.void
setCreatedAt
(ZonedDateTime createdAt) Date and time (UTC) the CartDiscount was initially created.void
setCreatedBy
(CreatedBy createdBy) IDs and references that created the CartDiscount.void
setCustom
(CustomFields custom) Custom Fields of the CartDiscount.void
setDescription
(LocalizedString description) Description of the CartDiscount.void
Unique identifier of the CartDiscount.void
setIsActive
(Boolean isActive) Indicates if the CartDiscount is active and can be applied to the Cart.void
User-defined unique identifier of the CartDiscount.void
setLastModifiedAt
(ZonedDateTime lastModifiedAt) Date and time (UTC) the CartDiscount was last updated.void
setLastModifiedBy
(LastModifiedBy lastModifiedBy) IDs and references that last modified the CartDiscount.void
setName
(LocalizedString name) Name of the CartDiscount.void
setReferences
(Reference... references) References of all resources that are addressed in the predicate.void
setReferences
(List<Reference> references) References of all resources that are addressed in the predicate.void
setRequiresDiscountCode
(Boolean requiresDiscountCode) Indicates if the Discount is used in connection with a DiscountCode.void
setSortOrder
(String sortOrder) Value between0
and1
.void
setStackingMode
(StackingMode stackingMode) Indicates whether the application of the CartDiscount causes other discounts to be ignored.void
setStores
(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.void
setStores
(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.void
setTarget
(CartDiscountTarget target) Segment of the Cart that is discounted.void
setValidFrom
(ZonedDateTime validFrom) Date and time (UTC) from which the Discount is effective.void
setValidUntil
(ZonedDateTime validUntil) Date and time (UTC) until which the Discount is effective.void
setValue
(CartDiscountValue value) Effect of the CartDiscount on thetarget
.void
setVersion
(Long version) Current version of the CartDiscount.static com.fasterxml.jackson.core.type.TypeReference<CartDiscount>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withCartDiscount
(Function<CartDiscount, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.common.BaseResource
withBaseResource
Methods inherited from interface com.commercetools.api.models.cart_discount.CartDiscountMixin
toReference, toResourceIdentifier
Methods inherited from interface com.commercetools.api.models.Customizable
unwrapCustomizable
Methods inherited from interface com.commercetools.api.models.DomainResource
get
-
Method Details
-
getId
Unique identifier of the CartDiscount.
- Specified by:
getId
in interfaceBaseResource
- Specified by:
getId
in interfaceDomainResource<CartDiscount>
- Specified by:
getId
in interfaceIdentifiable<CartDiscount>
- Specified by:
getId
in interfaceVersioned<CartDiscount>
- Returns:
- id
-
getVersion
Current version of the CartDiscount.
- Specified by:
getVersion
in interfaceBaseResource
- Specified by:
getVersion
in interfaceDomainResource<CartDiscount>
- Specified by:
getVersion
in interfaceVersioned<CartDiscount>
- Returns:
- version
-
getCreatedAt
Date and time (UTC) the CartDiscount was initially created.
- Specified by:
getCreatedAt
in interfaceBaseResource
- Returns:
- createdAt
-
getLastModifiedAt
Date and time (UTC) the CartDiscount was last updated.
- Specified by:
getLastModifiedAt
in interfaceBaseResource
- 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
String getKey()User-defined unique identifier of the CartDiscount.
-
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
ZonedDateTime getValidFrom()Date and time (UTC) from which the Discount is effective.
- Returns:
- validFrom
-
getValidUntil
ZonedDateTime 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.
- Specified by:
getCustom
in interfaceCustomizable<CartDiscount>
- Returns:
- custom
-
setId
Unique identifier of the CartDiscount.
- Specified by:
setId
in interfaceBaseResource
- Parameters:
id
- value to be set
-
setVersion
Current version of the CartDiscount.
- Specified by:
setVersion
in interfaceBaseResource
- Parameters:
version
- value to be set
-
setCreatedAt
Date and time (UTC) the CartDiscount was initially created.
- Specified by:
setCreatedAt
in interfaceBaseResource
- Parameters:
createdAt
- value to be set
-
setLastModifiedAt
Date and time (UTC) the CartDiscount was last updated.
- Specified by:
setLastModifiedAt
in interfaceBaseResource
- Parameters:
lastModifiedAt
- value to be set
-
setLastModifiedBy
IDs and references that last modified the CartDiscount.
- Parameters:
lastModifiedBy
- value to be set
-
setCreatedBy
IDs and references that created the CartDiscount.
- Parameters:
createdBy
- value to be set
-
setName
Name of the CartDiscount.
- Parameters:
name
- value to be set
-
setKey
User-defined unique identifier of the CartDiscount.
- Parameters:
key
- value to be set
-
setDescription
Description of the CartDiscount.
- Parameters:
description
- value to be set
-
setValue
Effect of the CartDiscount on the
target
.- Parameters:
value
- value to be set
-
setCartPredicate
Valid Cart Predicate.
- Parameters:
cartPredicate
- value to be set
-
setTarget
Segment of the Cart that is discounted.
Empty, if the
value
isgiftLineItem
.- Parameters:
target
- value to be set
-
setSortOrder
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
-
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:
stores
- values to be set
-
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:
stores
- values to be set
-
setIsActive
Indicates if the CartDiscount is active and can be applied to the Cart.
- Parameters:
isActive
- value to be set
-
setValidFrom
Date and time (UTC) from which the Discount is effective.
- Parameters:
validFrom
- value to be set
-
setValidUntil
Date and time (UTC) until which the Discount is effective.
- Parameters:
validUntil
- value to be set
-
setRequiresDiscountCode
Indicates if the Discount is used in connection with a DiscountCode.
- Parameters:
requiresDiscountCode
- value to be set
-
setReferences
References of all resources that are addressed in the predicate. The API generates this array from the predicate.
- Parameters:
references
- values to be set
-
setReferences
References of all resources that are addressed in the predicate. The API generates this array from the predicate.
- Parameters:
references
- values to be set
-
setStackingMode
Indicates whether the application of the CartDiscount causes other discounts to be ignored.
- Parameters:
stackingMode
- value to be set
-
setCustom
Custom Fields of the CartDiscount.
- Specified by:
setCustom
in interfaceCustomizable<CartDiscount>
- Parameters:
custom
- value to be set
-
of
factory method- Returns:
- instance of CartDiscount
-
of
factory method to create a shallow copy CartDiscount- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of CartDiscount- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for CartDiscount- Returns:
- builder
-
builder
create builder for CartDiscount instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withCartDiscount
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
referenceTypeId
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-