Interface DiscountCode
- All Superinterfaces:
BaseResource,Customizable<DiscountCode>,DiscountCodeMixin,DomainResource<DiscountCode>,Identifiable<DiscountCode>,Referencable<DiscountCode>,ResourceIdentifiable<DiscountCode>,Versioned<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()
-
Method Summary
Modifier and TypeMethodDescriptionstatic DiscountCodeBuilderbuilder()builder factory method for DiscountCodestatic DiscountCodeBuilderbuilder(DiscountCode template) create builder for DiscountCode instancecopyDeep()static DiscountCodedeepCopy(DiscountCode template) factory method to create a deep copy of DiscountCodeUsed and managed by the API and must not be used in customer logic.@NotNull @Valid List<CartDiscountReference>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.@NotNull StringgetCode()User-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts.@NotNull ZonedDateTimeDate and time (UTC) the DiscountCode was initially created.@Valid CreatedByIDs and references that created the DiscountCode.@Valid CustomFieldsCustom Fields of the DiscountCode.@Valid LocalizedStringDescription of the DiscountCode.Groups to which the DiscountCode belongs to.@NotNull StringgetId()Unique identifier of the DiscountCode.@NotNull BooleanIndicates if the DiscountCode is active and can be applied to the Cart.getKey()User-defined unique identifier of the DiscountCode.@NotNull ZonedDateTimeDate and time (UTC) the DiscountCode was last updated.@Valid LastModifiedByIDs 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).@Valid LocalizedStringgetName()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.@NotNull LongCurrent version of the DiscountCode.static DiscountCodeof()factory methodstatic DiscountCodeof(DiscountCode template) factory method to create a shallow copy DiscountCodestatic ReferenceTypeIdvoidsetApplicationVersion(Long applicationVersion) Used and managed by the API and must not be used in customer logic.voidsetCartDiscounts(CartDiscountReference... cartDiscounts) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.voidsetCartDiscounts(List<CartDiscountReference> cartDiscounts) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.voidsetCartPredicate(String cartPredicate) DiscountCode can only be applied to Carts that match this predicate.voidUser-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts.voidsetCreatedAt(ZonedDateTime createdAt) Date and time (UTC) the DiscountCode was initially created.voidsetCreatedBy(CreatedBy createdBy) IDs and references that created the DiscountCode.voidsetCustom(CustomFields custom) Custom Fields of the DiscountCode.voidsetDescription(LocalizedString description) Description of the DiscountCode.voidGroups to which the DiscountCode belongs to.voidGroups to which the DiscountCode belongs to.voidUnique identifier of the DiscountCode.voidsetIsActive(Boolean isActive) Indicates if the DiscountCode is active and can be applied to the Cart.voidUser-defined unique identifier of the DiscountCode.voidsetLastModifiedAt(ZonedDateTime lastModifiedAt) Date and time (UTC) the DiscountCode was last updated.voidsetLastModifiedBy(LastModifiedBy lastModifiedBy) IDs and references that last modified the DiscountCode.voidsetMaxApplications(Long maxApplications) Number of times the DiscountCode can be applied.voidsetMaxApplicationsPerCustomer(Long maxApplicationsPerCustomer) Number of times the DiscountCode can be applied per Customer (anonymous Carts are not supported).voidsetName(LocalizedString name) Name of the DiscountCode.voidsetReferences(Reference... references) Array generated from the Cart predicate.voidsetReferences(List<Reference> references) Array generated from the Cart predicate.voidsetValidFrom(ZonedDateTime validFrom) Date and time (UTC) from which the DiscountCode is effective.voidsetValidUntil(ZonedDateTime validUntil) Date and time (UTC) until which the DiscountCode is effective.voidsetVersion(Long version) Current version of the DiscountCode.static com.fasterxml.jackson.core.type.TypeReference<DiscountCode>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithDiscountCode(Function<DiscountCode, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.common.BaseResource
withBaseResourceMethods inherited from interface com.commercetools.api.models.Customizable
unwrapCustomizableMethods inherited from interface com.commercetools.api.models.discount_code.DiscountCodeMixin
toReference, toResourceIdentifierMethods inherited from interface com.commercetools.api.models.DomainResource
get
-
Method Details
-
getId
Unique identifier of the DiscountCode.
- Specified by:
getIdin interfaceBaseResource- Specified by:
getIdin interfaceDomainResource<DiscountCode>- Specified by:
getIdin interfaceIdentifiable<DiscountCode>- Specified by:
getIdin interfaceVersioned<DiscountCode>- Returns:
- id
-
getKey
String getKey()User-defined unique identifier of the DiscountCode.
- Returns:
- key
-
getVersion
Current version of the DiscountCode.
- Specified by:
getVersionin interfaceBaseResource- Specified by:
getVersionin interfaceDomainResource<DiscountCode>- Specified by:
getVersionin interfaceVersioned<DiscountCode>- Returns:
- version
-
getCreatedAt
Date and time (UTC) the DiscountCode was initially created.
- Specified by:
getCreatedAtin interfaceBaseResource- Returns:
- createdAt
-
getLastModifiedAt
Date and time (UTC) the DiscountCode was last updated.
- Specified by:
getLastModifiedAtin interfaceBaseResource- Returns:
- lastModifiedAt
-
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
String 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
Long 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
Long 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.
- Specified by:
getCustomin interfaceCustomizable<DiscountCode>- Returns:
- custom
-
getGroups
Groups to which the DiscountCode belongs to.
- Returns:
- groups
-
getValidFrom
ZonedDateTime getValidFrom()Date and time (UTC) from which the DiscountCode is effective.
- Returns:
- validFrom
-
getValidUntil
ZonedDateTime getValidUntil()Date and time (UTC) until which the DiscountCode is effective.
- Returns:
- validUntil
-
getApplicationVersion
Long 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
-
setId
Unique identifier of the DiscountCode.
- Specified by:
setIdin interfaceBaseResource- Parameters:
id- value to be set
-
setKey
User-defined unique identifier of the DiscountCode.
- Parameters:
key- value to be set
-
setVersion
Current version of the DiscountCode.
- Specified by:
setVersionin interfaceBaseResource- Parameters:
version- value to be set
-
setCreatedAt
Date and time (UTC) the DiscountCode was initially created.
- Specified by:
setCreatedAtin interfaceBaseResource- Parameters:
createdAt- value to be set
-
setLastModifiedAt
Date and time (UTC) the DiscountCode was last updated.
- Specified by:
setLastModifiedAtin interfaceBaseResource- Parameters:
lastModifiedAt- value to be set
-
setLastModifiedBy
IDs and references that last modified the DiscountCode.
- Parameters:
lastModifiedBy- value to be set
-
setCreatedBy
IDs and references that created the DiscountCode.
- Parameters:
createdBy- value to be set
-
setName
Name of the DiscountCode.
- Parameters:
name- value to be set
-
setDescription
Description of the DiscountCode.
- Parameters:
description- value to be set
-
setCode
User-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts.
- Parameters:
code- value to be set
-
setCartDiscounts
Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
cartDiscounts- values to be set
-
setCartDiscounts
Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
cartDiscounts- values to be set
-
setCartPredicate
DiscountCode can only be applied to Carts that match this predicate.
- Parameters:
cartPredicate- value to be set
-
setIsActive
Indicates if the DiscountCode is active and can be applied to the Cart.
- Parameters:
isActive- value to be set
-
setReferences
Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.
- Parameters:
references- values to be set
-
setReferences
Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.
- Parameters:
references- values to be set
-
setMaxApplications
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
-
setMaxApplicationsPerCustomer
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
-
setCustom
Custom Fields of the DiscountCode.
- Specified by:
setCustomin interfaceCustomizable<DiscountCode>- Parameters:
custom- value to be set
-
setGroups
Groups to which the DiscountCode belongs to.
- Parameters:
groups- values to be set
-
setGroups
Groups to which the DiscountCode belongs to.
- Parameters:
groups- values to be set
-
setValidFrom
Date and time (UTC) from which the DiscountCode is effective.
- Parameters:
validFrom- value to be set
-
setValidUntil
Date and time (UTC) until which the DiscountCode is effective.
- Parameters:
validUntil- value to be set
-
setApplicationVersion
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
-
of
factory method- Returns:
- instance of DiscountCode
-
of
factory method to create a shallow copy DiscountCode- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
DiscountCode copyDeep()- Specified by:
copyDeepin interfaceBaseResource
-
deepCopy
factory method to create a deep copy of DiscountCode- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for DiscountCode- Returns:
- builder
-
builder
create builder for DiscountCode instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withDiscountCode
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
-