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 CartDiscountBuilderbuilder()builder factory method for CartDiscountstatic CartDiscountBuilderbuilder(CartDiscount template) create builder for CartDiscount instancecopyDeep()static CartDiscountdeepCopy(CartDiscount template) factory method to create a deep copy of CartDiscount@NotNull StringValid Cart Predicate.@NotNull ZonedDateTimeDate and time (UTC) the CartDiscount was initially created.@Valid CreatedByIDs and references that created the CartDiscount.@Valid CustomFieldsCustom Fields of the CartDiscount.@Valid LocalizedStringDescription of the CartDiscount.@Valid DiscountGroupReferenceReference to a DiscountGroup that the CartDiscount belongs to.@NotNull StringgetId()Unique identifier of the CartDiscount.@NotNull BooleanIndicates if the CartDiscount is active and can be applied to the Cart.getKey()User-defined unique identifier of the CartDiscount.@NotNull ZonedDateTimeDate and time (UTC) the CartDiscount was last updated.@Valid LastModifiedByIDs and references that last modified the CartDiscount.@NotNull @Valid LocalizedStringgetName()Name of the CartDiscount.References of all resources that are addressed in the predicate.@NotNull BooleanIndicates if the Discount is used in connection with a DiscountCode.@NotNull StringValue between0and1that determines the order in which the CartDiscounts are applied; a CartDiscount with a higher value is prioritized.@NotNull StackingModeIndicates whether the application of the CartDiscount causes other discounts to be ignored.@NotNull @Valid List<StoreKeyReference>@Valid CartDiscountTargetSegment 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 CartDiscountValuegetValue()Effect of the CartDiscount on thetarget.@NotNull LongCurrent version of the CartDiscount.static CartDiscountof()factory methodstatic CartDiscountof(CartDiscount template) factory method to create a shallow copy CartDiscountstatic ReferenceTypeIdvoidsetCartPredicate(String cartPredicate) Valid Cart Predicate.voidsetCreatedAt(ZonedDateTime createdAt) Date and time (UTC) the CartDiscount was initially created.voidsetCreatedBy(CreatedBy createdBy) IDs and references that created the CartDiscount.voidsetCustom(CustomFields custom) Custom Fields of the CartDiscount.voidsetDescription(LocalizedString description) Description of the CartDiscount.voidsetDiscountGroup(DiscountGroupReference discountGroup) Reference to a DiscountGroup that the CartDiscount belongs to.voidUnique identifier of the CartDiscount.voidsetIsActive(Boolean isActive) Indicates if the CartDiscount is active and can be applied to the Cart.voidUser-defined unique identifier of the CartDiscount.voidsetLastModifiedAt(ZonedDateTime lastModifiedAt) Date and time (UTC) the CartDiscount was last updated.voidsetLastModifiedBy(LastModifiedBy lastModifiedBy) IDs and references that last modified the CartDiscount.voidsetName(LocalizedString name) Name of the CartDiscount.voidsetReferences(Reference... references) References of all resources that are addressed in the predicate.voidsetReferences(List<Reference> references) References of all resources that are addressed in the predicate.voidsetRequiresDiscountCode(Boolean requiresDiscountCode) Indicates if the Discount is used in connection with a DiscountCode.voidsetSortOrder(String sortOrder) Value between0and1that determines the order in which the CartDiscounts are applied; a CartDiscount with a higher value is prioritized.voidsetStackingMode(StackingMode stackingMode) Indicates whether the application of the CartDiscount causes other discounts to be ignored.voidsetStores(StoreKeyReference... stores) voidsetStores(List<StoreKeyReference> stores) voidsetTarget(CartDiscountTarget target) Segment of the Cart that is discounted.voidsetValidFrom(ZonedDateTime validFrom) Date and time (UTC) from which the Discount is effective.voidsetValidUntil(ZonedDateTime validUntil) Date and time (UTC) until which the Discount is effective.voidsetValue(CartDiscountValue value) Effect of the CartDiscount on thetarget.voidsetVersion(Long version) Current version of the CartDiscount.static com.fasterxml.jackson.core.type.TypeReference<CartDiscount>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithCartDiscount(Function<CartDiscount, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.common.BaseResource
withBaseResourceMethods inherited from interface com.commercetools.api.models.cart_discount.CartDiscountMixin
toReference, toResourceIdentifierMethods inherited from interface com.commercetools.api.models.Customizable
unwrapCustomizableMethods inherited from interface com.commercetools.api.models.DomainResource
get
-
Method Details
-
getId
Unique identifier of the CartDiscount.
- Specified by:
getIdin interfaceBaseResource- Specified by:
getIdin interfaceDomainResource<CartDiscount>- Specified by:
getIdin interfaceIdentifiable<CartDiscount>- Specified by:
getIdin interfaceVersioned<CartDiscount>- Returns:
- id
-
getVersion
Current version of the CartDiscount.
- Specified by:
getVersionin interfaceBaseResource- Specified by:
getVersionin interfaceDomainResource<CartDiscount>- Specified by:
getVersionin interfaceVersioned<CartDiscount>- Returns:
- version
-
getCreatedAt
Date and time (UTC) the CartDiscount was initially created.
- Specified by:
getCreatedAtin interfaceBaseResource- Returns:
- createdAt
-
getLastModifiedAt
Date and time (UTC) the CartDiscount was last updated.
- Specified by:
getLastModifiedAtin 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
valueisgiftLineItem.- Returns:
- target
-
getSortOrder
Value between
0and1that determines the order in which the CartDiscounts are applied; a CartDiscount with a higher value is prioritized.It is unique among all CartDiscounts and DiscountGroups.
If the CartDiscount is part of a DiscountGroup, it uses the sort order of the DiscountGroup.
- Returns:
- sortOrder
-
getStores
- 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:
getCustomin interfaceCustomizable<CartDiscount>- Returns:
- custom
-
getDiscountGroup
Reference to a DiscountGroup that the CartDiscount belongs to.
- Returns:
- discountGroup
-
setId
Unique identifier of the CartDiscount.
- Specified by:
setIdin interfaceBaseResource- Parameters:
id- value to be set
-
setVersion
Current version of the CartDiscount.
- Specified by:
setVersionin interfaceBaseResource- Parameters:
version- value to be set
-
setCreatedAt
Date and time (UTC) the CartDiscount was initially created.
- Specified by:
setCreatedAtin interfaceBaseResource- Parameters:
createdAt- value to be set
-
setLastModifiedAt
Date and time (UTC) the CartDiscount was last updated.
- Specified by:
setLastModifiedAtin 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
valueisgiftLineItem.- Parameters:
target- value to be set
-
setSortOrder
Value between
0and1that determines the order in which the CartDiscounts are applied; a CartDiscount with a higher value is prioritized.It is unique among all CartDiscounts and DiscountGroups.
If the CartDiscount is part of a DiscountGroup, it uses the sort order of the DiscountGroup.
- Parameters:
sortOrder- value to be set
-
setStores
- Parameters:
stores- values to be set
-
setStores
- 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:
setCustomin interfaceCustomizable<CartDiscount>- Parameters:
custom- value to be set
-
setDiscountGroup
Reference to a DiscountGroup that the CartDiscount belongs to.
- Parameters:
discountGroup- 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
-
copyDeep
CartDiscount copyDeep()- Specified by:
copyDeepin interfaceBaseResource
-
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
-