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 DiscountCodeDraftBuilderbuilder()builder factory method for DiscountCodeDraftstatic DiscountCodeDraftBuilderbuilder(DiscountCodeDraft template) create builder for DiscountCodeDraft instancecopyDeep()static DiscountCodeDraftdeepCopy(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 StringgetCode()User-defined unique identifier for the DiscountCode that can be added to the Cart to apply the related CartDiscounts.@Valid CustomFieldsDraftCustom Fields for the DiscountCode.@Valid LocalizedStringDescription 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 LocalizedStringgetName()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 DiscountCodeDraftof()factory methodstatic DiscountCodeDraftof(DiscountCodeDraft template) factory method to create a shallow copy DiscountCodeDraftvoidsetCartDiscounts(CartDiscountResourceIdentifier... cartDiscounts) Specify what CartDiscounts the API applies when you add the DiscountCode to the Cart.voidsetCartDiscounts(List<CartDiscountResourceIdentifier> cartDiscounts) Specify what CartDiscounts the API applies when you add the DiscountCode to the Cart.voidsetCartPredicate(String cartPredicate) DiscountCode can only be applied to Carts that match this predicate.voidUser-defined unique identifier for the DiscountCode that can be added to the Cart to apply the related CartDiscounts.voidsetCustom(CustomFieldsDraft custom) Custom Fields for the DiscountCode.voidsetDescription(LocalizedString description) Description of the DiscountCode.voidGroups to which the DiscountCode will belong to.voidGroups to which the DiscountCode will belong to.voidsetIsActive(Boolean isActive) Only active DiscountCodes can be applied to the Cart.voidUser-defined unique identifier for 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.voidsetName(LocalizedString name) Name of the DiscountCode.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.static com.fasterxml.jackson.core.type.TypeReference<DiscountCodeDraft>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithDiscountCodeDraft(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:
getCustomin 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:
setCustomin 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
-
copyDeep
DiscountCodeDraft copyDeep() -
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
-