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 SummaryModifier 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.BaseResourcewithBaseResourceMethods inherited from interface com.commercetools.api.models.CustomizableunwrapCustomizableMethods inherited from interface com.commercetools.api.models.discount_code.DiscountCodeMixintoReference, toResourceIdentifierMethods inherited from interface com.commercetools.api.models.DomainResourceget
- 
Method Details- 
getIdUnique identifier of the DiscountCode. - Specified by:
- getIdin interface- BaseResource
- Specified by:
- getIdin interface- DomainResource<DiscountCode>
- Specified by:
- getIdin interface- Identifiable<DiscountCode>
- Specified by:
- getIdin interface- Versioned<DiscountCode>
- Returns:
- id
 
- 
getKeyString getKey()User-defined unique identifier of the DiscountCode. - Returns:
- key
 
- 
getVersionCurrent version of the DiscountCode. - Specified by:
- getVersionin interface- BaseResource
- Specified by:
- getVersionin interface- DomainResource<DiscountCode>
- Specified by:
- getVersionin interface- Versioned<DiscountCode>
- Returns:
- version
 
- 
getCreatedAtDate and time (UTC) the DiscountCode was initially created. - Specified by:
- getCreatedAtin interface- BaseResource
- Returns:
- createdAt
 
- 
getLastModifiedAtDate and time (UTC) the DiscountCode was last updated. - Specified by:
- getLastModifiedAtin interface- BaseResource
- Returns:
- lastModifiedAt
 
- 
getLastModifiedByIDs and references that last modified the DiscountCode. - Returns:
- lastModifiedBy
 
- 
getCreatedByIDs and references that created the DiscountCode. - Returns:
- createdBy
 
- 
getNameName of the DiscountCode. - Returns:
- name
 
- 
getDescriptionDescription of the DiscountCode. - Returns:
- description
 
- 
getCodeUser-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts. - Returns:
- code
 
- 
getCartDiscountsReference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied. - Returns:
- cartDiscounts
 
- 
getCartPredicateString getCartPredicate()DiscountCode can only be applied to Carts that match this predicate. - Returns:
- cartPredicate
 
- 
getIsActiveIndicates if the DiscountCode is active and can be applied to the Cart. - Returns:
- isActive
 
- 
getReferencesArray generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate. - Returns:
- references
 
- 
getMaxApplicationsLong 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
 
- 
getMaxApplicationsPerCustomerLong 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
 
- 
getCustomCustom Fields of the DiscountCode. - Specified by:
- getCustomin interface- Customizable<DiscountCode>
- Returns:
- custom
 
- 
getGroupsGroups to which the DiscountCode belongs to. - Returns:
- groups
 
- 
getValidFromZonedDateTime getValidFrom()Date and time (UTC) from which the DiscountCode is effective. - Returns:
- validFrom
 
- 
getValidUntilZonedDateTime getValidUntil()Date and time (UTC) until which the DiscountCode is effective. - Returns:
- validUntil
 
- 
getApplicationVersionLong 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
 
- 
setIdUnique identifier of the DiscountCode. - Specified by:
- setIdin interface- BaseResource
- Parameters:
- id- value to be set
 
- 
setKeyUser-defined unique identifier of the DiscountCode. - Parameters:
- key- value to be set
 
- 
setVersionCurrent version of the DiscountCode. - Specified by:
- setVersionin interface- BaseResource
- Parameters:
- version- value to be set
 
- 
setCreatedAtDate and time (UTC) the DiscountCode was initially created. - Specified by:
- setCreatedAtin interface- BaseResource
- Parameters:
- createdAt- value to be set
 
- 
setLastModifiedAtDate and time (UTC) the DiscountCode was last updated. - Specified by:
- setLastModifiedAtin interface- BaseResource
- Parameters:
- lastModifiedAt- value to be set
 
- 
setLastModifiedByIDs and references that last modified the DiscountCode. - Parameters:
- lastModifiedBy- value to be set
 
- 
setCreatedByIDs and references that created the DiscountCode. - Parameters:
- createdBy- value to be set
 
- 
setNameName of the DiscountCode. - Parameters:
- name- value to be set
 
- 
setDescriptionDescription of the DiscountCode. - Parameters:
- description- value to be set
 
- 
setCodeUser-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts. - Parameters:
- code- value to be set
 
- 
setCartDiscountsReference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied. - Parameters:
- cartDiscounts- values to be set
 
- 
setCartDiscountsReference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied. - Parameters:
- cartDiscounts- values to be set
 
- 
setCartPredicateDiscountCode can only be applied to Carts that match this predicate. - Parameters:
- cartPredicate- value to be set
 
- 
setIsActiveIndicates if the DiscountCode is active and can be applied to the Cart. - Parameters:
- isActive- value to be set
 
- 
setReferencesArray 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
 
- 
setReferencesArray 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
 
- 
setMaxApplicationsNumber 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
 
- 
setMaxApplicationsPerCustomerNumber 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
 
- 
setCustomCustom Fields of the DiscountCode. - Specified by:
- setCustomin interface- Customizable<DiscountCode>
- Parameters:
- custom- value to be set
 
- 
setGroupsGroups to which the DiscountCode belongs to. - Parameters:
- groups- values to be set
 
- 
setGroupsGroups to which the DiscountCode belongs to. - Parameters:
- groups- values to be set
 
- 
setValidFromDate and time (UTC) from which the DiscountCode is effective. - Parameters:
- validFrom- value to be set
 
- 
setValidUntilDate and time (UTC) until which the DiscountCode is effective. - Parameters:
- validUntil- value to be set
 
- 
setApplicationVersionUsed 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
 
- 
offactory method- Returns:
- instance of DiscountCode
 
- 
offactory method to create a shallow copy DiscountCode- Parameters:
- template- instance to be copied
- Returns:
- copy instance
 
- 
copyDeepDiscountCode copyDeep()- Specified by:
- copyDeepin interface- BaseResource
 
- 
deepCopyfactory method to create a deep copy of DiscountCode- Parameters:
- template- instance to be copied
- Returns:
- copy instance
 
- 
builderbuilder factory method for DiscountCode- Returns:
- builder
 
- 
buildercreate builder for DiscountCode instance- Parameters:
- template- instance with prefilled values for the builder
- Returns:
- builder
 
- 
withDiscountCodeaccessor map function- Type Parameters:
- T- mapped type
- Parameters:
- helper- function to map the object
- Returns:
- mapped value
 
- 
referenceTypeId
- 
typeReferencegives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
 
 
-