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 DiscountCodeBuilder
builder()
builder factory method for DiscountCodestatic DiscountCodeBuilder
builder
(DiscountCode template) create builder for DiscountCode instancestatic DiscountCode
deepCopy
(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 String
getCode()
User-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts.@NotNull ZonedDateTime
Date and time (UTC) the DiscountCode was initially created.@Valid CreatedBy
IDs and references that created the DiscountCode.@Valid CustomFields
Custom Fields of the DiscountCode.@Valid LocalizedString
Description of the DiscountCode.Groups to which the DiscountCode belongs to.@NotNull String
getId()
Unique identifier of the DiscountCode.@NotNull Boolean
Indicates if the DiscountCode is active and can be applied to the Cart.getKey()
User-defined unique identifier of the DiscountCode.@NotNull ZonedDateTime
Date and time (UTC) the DiscountCode was last updated.@Valid LastModifiedBy
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).@Valid LocalizedString
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.@NotNull Long
Current version of the DiscountCode.static DiscountCode
of()
factory methodstatic DiscountCode
of
(DiscountCode template) factory method to create a shallow copy DiscountCodestatic ReferenceTypeId
void
setApplicationVersion
(Long applicationVersion) Used and managed by the API and must not be used in customer logic.void
setCartDiscounts
(CartDiscountReference... cartDiscounts) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.void
setCartDiscounts
(List<CartDiscountReference> cartDiscounts) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.void
setCartPredicate
(String cartPredicate) DiscountCode can only be applied to Carts that match this predicate.void
User-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts.void
setCreatedAt
(ZonedDateTime createdAt) Date and time (UTC) the DiscountCode was initially created.void
setCreatedBy
(CreatedBy createdBy) IDs and references that created the DiscountCode.void
setCustom
(CustomFields custom) Custom Fields of the DiscountCode.void
setDescription
(LocalizedString description) Description of the DiscountCode.void
Groups to which the DiscountCode belongs to.void
Groups to which the DiscountCode belongs to.void
Unique identifier of the DiscountCode.void
setIsActive
(Boolean isActive) Indicates if the DiscountCode is active and can be applied to the Cart.void
User-defined unique identifier of the DiscountCode.void
setLastModifiedAt
(ZonedDateTime lastModifiedAt) Date and time (UTC) the DiscountCode was last updated.void
setLastModifiedBy
(LastModifiedBy lastModifiedBy) IDs and references that last modified the DiscountCode.void
setMaxApplications
(Long maxApplications) Number of times the DiscountCode can be applied.void
setMaxApplicationsPerCustomer
(Long maxApplicationsPerCustomer) Number of times the DiscountCode can be applied per Customer (anonymous Carts are not supported).void
setName
(LocalizedString name) Name of the DiscountCode.void
setReferences
(Reference... references) Array generated from the Cart predicate.void
setReferences
(List<Reference> references) Array generated from the Cart predicate.void
setValidFrom
(ZonedDateTime validFrom) Date and time (UTC) from which the DiscountCode is effective.void
setValidUntil
(ZonedDateTime validUntil) Date and time (UTC) until which the DiscountCode is effective.void
setVersion
(Long version) Current version of the DiscountCode.static com.fasterxml.jackson.core.type.TypeReference<DiscountCode>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withDiscountCode
(Function<DiscountCode, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.common.BaseResource
withBaseResource
Methods inherited from interface com.commercetools.api.models.Customizable
unwrapCustomizable
Methods inherited from interface com.commercetools.api.models.discount_code.DiscountCodeMixin
toReference, toResourceIdentifier
Methods inherited from interface com.commercetools.api.models.DomainResource
get
-
Method Details
-
getId
Unique identifier of the DiscountCode.
- Specified by:
getId
in interfaceBaseResource
- Specified by:
getId
in interfaceDomainResource<DiscountCode>
- Specified by:
getId
in interfaceIdentifiable<DiscountCode>
- Specified by:
getId
in interfaceVersioned<DiscountCode>
- Returns:
- id
-
getKey
String getKey()User-defined unique identifier of the DiscountCode.
- Returns:
- key
-
getVersion
Current version of the DiscountCode.
- Specified by:
getVersion
in interfaceBaseResource
- Specified by:
getVersion
in interfaceDomainResource<DiscountCode>
- Specified by:
getVersion
in interfaceVersioned<DiscountCode>
- Returns:
- version
-
getCreatedAt
Date and time (UTC) the DiscountCode was initially created.
- Specified by:
getCreatedAt
in interfaceBaseResource
- Returns:
- createdAt
-
getLastModifiedAt
Date and time (UTC) the DiscountCode was last updated.
- Specified by:
getLastModifiedAt
in 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:
getCustom
in 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:
setId
in 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:
setVersion
in interfaceBaseResource
- Parameters:
version
- value to be set
-
setCreatedAt
Date and time (UTC) the DiscountCode was initially created.
- Specified by:
setCreatedAt
in interfaceBaseResource
- Parameters:
createdAt
- value to be set
-
setLastModifiedAt
Date and time (UTC) the DiscountCode was last updated.
- Specified by:
setLastModifiedAt
in 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:
setCustom
in 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
-
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
-