Class ProductDiscount
java.lang.Object
com.commercetools.graphql.api.types.ProductDiscount
- All Implemented Interfaces:
ReferenceExpandable,Versioned
A product price can be discounted in two ways:
* with a relative or an absolute product discount, which will be automatically applied to all prices in a product that match a discount predicate.
A relative discount reduces the matching price by a fraction (for example 10 % off). An absolute discount reduces the matching price by a fixed amount (for example 10€ off). If more than one product discount matches a price, the discount sort order determines which one will be applied.
* with an external product discount, which can then be used to explicitly set a discounted value on a particular product price.
The discounted price is stored in the discounted field of the Product Price.
Note that when a discount is created, updated or removed it can take up to 15 minutes to update all the prices with the discounts.
The maximum number of ProductDiscounts that can be active at the same time is **200**.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionProductDiscount(String predicate, OffsetDateTime validFrom, OffsetDateTime validUntil, Boolean isActive, Boolean isValid, String sortOrder, String key, String name, String description, List<Reference> referenceRefs, List<LocalizedString> nameAllLocales, List<LocalizedString> descriptionAllLocales, ProductDiscountValue value, String id, Long version, OffsetDateTime createdAt, OffsetDateTime lastModifiedAt, Initiator createdBy, Initiator lastModifiedBy) -
Method Summary
Modifier and TypeMethodDescriptionbooleangetId()getKey()getName()getValue()inthashCode()static ProductDiscount.BuildervoidsetCreatedAt(OffsetDateTime createdAt) voidsetCreatedBy(Initiator createdBy) voidsetDescription(String description) voidsetDescriptionAllLocales(List<LocalizedString> descriptionAllLocales) voidvoidsetIsActive(Boolean isActive) voidsetIsValid(Boolean isValid) voidvoidsetLastModifiedAt(OffsetDateTime lastModifiedAt) voidsetLastModifiedBy(Initiator lastModifiedBy) voidvoidsetNameAllLocales(List<LocalizedString> nameAllLocales) voidsetPredicate(String predicate) voidsetReferenceRefs(List<Reference> referenceRefs) voidsetSortOrder(String sortOrder) voidsetValidFrom(OffsetDateTime validFrom) voidsetValidUntil(OffsetDateTime validUntil) voidsetValue(ProductDiscountValue value) voidsetVersion(Long version) toString()
-
Constructor Details
-
ProductDiscount
public ProductDiscount() -
ProductDiscount
public ProductDiscount(String predicate, OffsetDateTime validFrom, OffsetDateTime validUntil, Boolean isActive, Boolean isValid, String sortOrder, String key, String name, String description, List<Reference> referenceRefs, List<LocalizedString> nameAllLocales, List<LocalizedString> descriptionAllLocales, ProductDiscountValue value, String id, Long version, OffsetDateTime createdAt, OffsetDateTime lastModifiedAt, Initiator createdBy, Initiator lastModifiedBy)
-
-
Method Details
-
getPredicate
-
setPredicate
-
getValidFrom
-
setValidFrom
-
getValidUntil
-
setValidUntil
-
getIsActive
-
setIsActive
-
getIsValid
-
setIsValid
-
getSortOrder
-
setSortOrder
-
getKey
-
setKey
-
getName
-
setName
-
getDescription
-
setDescription
-
getReferenceRefs
-
setReferenceRefs
-
getNameAllLocales
-
setNameAllLocales
-
getDescriptionAllLocales
-
setDescriptionAllLocales
-
getValue
-
setValue
-
getId
- Specified by:
getIdin interfaceReferenceExpandable- Specified by:
getIdin interfaceVersioned
-
setId
- Specified by:
setIdin interfaceReferenceExpandable- Specified by:
setIdin interfaceVersioned
-
getVersion
- Specified by:
getVersionin interfaceVersioned
-
setVersion
- Specified by:
setVersionin interfaceVersioned
-
getCreatedAt
- Specified by:
getCreatedAtin interfaceVersioned
-
setCreatedAt
- Specified by:
setCreatedAtin interfaceVersioned
-
getLastModifiedAt
- Specified by:
getLastModifiedAtin interfaceVersioned
-
setLastModifiedAt
- Specified by:
setLastModifiedAtin interfaceVersioned
-
getCreatedBy
- Specified by:
getCreatedByin interfaceVersioned
-
setCreatedBy
- Specified by:
setCreatedByin interfaceVersioned
-
getLastModifiedBy
- Specified by:
getLastModifiedByin interfaceVersioned
-
setLastModifiedBy
- Specified by:
setLastModifiedByin interfaceVersioned
-
toString
-
equals
-
hashCode
public int hashCode() -
newBuilder
-