Interface DiscountCodeDraft
- All Superinterfaces:
CustomizableDraft<DiscountCodeDraft>
,Draft<DiscountCodeDraft>
Example to create an instance using the builder pattern
DiscountCodeDraft discountCodeDraft = DiscountCodeDraft.builder()
.code("{code}")
.plusCartDiscounts(cartDiscountsBuilder -> cartDiscountsBuilder)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic DiscountCodeDraftBuilder
builder()
builder factory method for DiscountCodeDraftstatic DiscountCodeDraftBuilder
builder
(DiscountCodeDraft template) create builder for DiscountCodeDraft instancestatic DiscountCodeDraft
deepCopy
(DiscountCodeDraft template) factory method to create a deep copy of DiscountCodeDraft@NotNull @Valid List<CartDiscountResourceIdentifier>
Specify what CartDiscounts the API applies when you add the DiscountCode to the Cart.DiscountCode can only be applied to Carts that match this predicate.@NotNull String
getCode()
User-defined unique identifier for the DiscountCode that can be added to the Cart to apply the related CartDiscounts.@Valid CustomFieldsDraft
Custom Fields for the DiscountCode.@Valid LocalizedString
Description of the DiscountCode.Groups to which the DiscountCode will belong to.Only active DiscountCodes can be applied to the Cart.getKey()
User-defined unique identifier for the DiscountCode.Number of times the DiscountCode can be applied.Number of times the DiscountCode can be applied per Customer.@Valid LocalizedString
getName()
Name of the DiscountCode.Date and time (UTC) from which the DiscountCode is effective.Date and time (UTC) until which the DiscountCode is effective.static DiscountCodeDraft
of()
factory methodstatic DiscountCodeDraft
of
(DiscountCodeDraft template) factory method to create a shallow copy DiscountCodeDraftvoid
setCartDiscounts
(CartDiscountResourceIdentifier... cartDiscounts) Specify what CartDiscounts the API applies when you add the DiscountCode to the Cart.void
setCartDiscounts
(List<CartDiscountResourceIdentifier> cartDiscounts) Specify what CartDiscounts the API applies when you add the DiscountCode to the Cart.void
setCartPredicate
(String cartPredicate) DiscountCode can only be applied to Carts that match this predicate.void
User-defined unique identifier for the DiscountCode that can be added to the Cart to apply the related CartDiscounts.void
setCustom
(CustomFieldsDraft custom) Custom Fields for the DiscountCode.void
setDescription
(LocalizedString description) Description of the DiscountCode.void
Groups to which the DiscountCode will belong to.void
Groups to which the DiscountCode will belong to.void
setIsActive
(Boolean isActive) Only active DiscountCodes can be applied to the Cart.void
User-defined unique identifier for 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.void
setName
(LocalizedString name) Name of the DiscountCode.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.static com.fasterxml.jackson.core.type.TypeReference<DiscountCodeDraft>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withDiscountCodeDraft
(Function<DiscountCodeDraft, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.CustomizableDraft
unwrapCustomizableDraft
-
Method Details
-
getKey
String getKey()User-defined unique identifier for the DiscountCode.
This field is optional for backwards compatibility reasons, but we strongly recommend setting it. Keys are mandatory for importing Discount Codes with the Import API and the Merchant Center.
- Returns:
- key
-
getName
Name of the DiscountCode.
- Returns:
- name
-
getDescription
Description of the DiscountCode.
- Returns:
- description
-
getCode
User-defined unique identifier for the DiscountCode that can be added to the Cart to apply the related CartDiscounts. It cannot be modified after the DiscountCode is created.
- Returns:
- code
-
getCartDiscounts
Specify what CartDiscounts the API applies when you add the DiscountCode to the Cart.
- Returns:
- cartDiscounts
-
getCartPredicate
String getCartPredicate()DiscountCode can only be applied to Carts that match this predicate.
- Returns:
- cartPredicate
-
getIsActive
Boolean getIsActive()Only active DiscountCodes can be applied to the Cart.
- Returns:
- isActive
-
getMaxApplications
Long getMaxApplications()Number of times the DiscountCode can be applied.
If not set, the DiscountCode can be applied any number of times.
- Returns:
- maxApplications
-
getMaxApplicationsPerCustomer
Long getMaxApplicationsPerCustomer()Number of times the DiscountCode can be applied per Customer.
If not set, the DiscountCode can be applied any number of times.
- Returns:
- maxApplicationsPerCustomer
-
getCustom
Custom Fields for the DiscountCode.
- Specified by:
getCustom
in interfaceCustomizableDraft<DiscountCodeDraft>
- Returns:
- custom
-
getGroups
Groups to which the DiscountCode will belong to.
- Returns:
- groups
-
getValidFrom
ZonedDateTime getValidFrom()Date and time (UTC) from which the DiscountCode is effective. Must be earlier than
validUntil
.- Returns:
- validFrom
-
getValidUntil
ZonedDateTime getValidUntil()Date and time (UTC) until which the DiscountCode is effective. Must be later than
validFrom
.- Returns:
- validUntil
-
setKey
User-defined unique identifier for the DiscountCode.
This field is optional for backwards compatibility reasons, but we strongly recommend setting it. Keys are mandatory for importing Discount Codes with the Import API and the Merchant Center.
- Parameters:
key
- 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 for the DiscountCode that can be added to the Cart to apply the related CartDiscounts. It cannot be modified after the DiscountCode is created.
- Parameters:
code
- value to be set
-
setCartDiscounts
Specify what CartDiscounts the API applies when you add the DiscountCode to the Cart.
- Parameters:
cartDiscounts
- values to be set
-
setCartDiscounts
Specify what CartDiscounts the API applies when you add the DiscountCode to the Cart.
- 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
Only active DiscountCodes can be applied to the Cart.
- Parameters:
isActive
- value to be set
-
setMaxApplications
Number of times the DiscountCode can be applied.
If not set, the DiscountCode can be applied any number of times.
- Parameters:
maxApplications
- value to be set
-
setMaxApplicationsPerCustomer
Number of times the DiscountCode can be applied per Customer.
If not set, the DiscountCode can be applied any number of times.
- Parameters:
maxApplicationsPerCustomer
- value to be set
-
setCustom
Custom Fields for the DiscountCode.
- Specified by:
setCustom
in interfaceCustomizableDraft<DiscountCodeDraft>
- Parameters:
custom
- value to be set
-
setGroups
Groups to which the DiscountCode will belong to.
- Parameters:
groups
- values to be set
-
setGroups
Groups to which the DiscountCode will belong to.
- Parameters:
groups
- values to be set
-
setValidFrom
Date and time (UTC) from which the DiscountCode is effective. Must be earlier than
validUntil
.- Parameters:
validFrom
- value to be set
-
setValidUntil
Date and time (UTC) until which the DiscountCode is effective. Must be later than
validFrom
.- Parameters:
validUntil
- value to be set
-
of
factory method- Returns:
- instance of DiscountCodeDraft
-
of
factory method to create a shallow copy DiscountCodeDraft- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of DiscountCodeDraft- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for DiscountCodeDraft- Returns:
- builder
-
builder
create builder for DiscountCodeDraft instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withDiscountCodeDraft
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-