Interface DiscountCodeImport
- All Superinterfaces:
ImportResource
The data representation for a Discount Code to be imported that is persisted as a Discount Code in the Project.
Example to create an instance using the builder pattern
DiscountCodeImport discountCodeImport = DiscountCodeImport.builder()
.key("{key}")
.code("{code}")
.plusCartDiscounts(cartDiscountsBuilder -> cartDiscountsBuilder)
.isActive(true)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic DiscountCodeImportBuilder
builder()
builder factory method for DiscountCodeImportstatic DiscountCodeImportBuilder
builder
(DiscountCodeImport template) create builder for DiscountCodeImport instancestatic DiscountCodeImport
deepCopy
(DiscountCodeImport template) factory method to create a deep copy of DiscountCodeImport@NotNull @Valid List<CartDiscountKeyReference>
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 that is used by the customer to apply the discount.@Valid Custom
Custom Fields of the DiscountCode.@Valid LocalizedString
Maps toDiscountCode.description
.Groups to which the DiscountCode belongs.@NotNull Boolean
Indicates if the DiscountCode is active and can be applied to the Cart.@NotNull String
getKey()
User-defined unique identifier.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()
Maps toDiscountCode.name
.Date and time (UTC) from which the DiscountCode is effective.Date and time (UTC) until which the DiscountCode is effective.static DiscountCodeImport
of()
factory methodstatic DiscountCodeImport
of
(DiscountCodeImport template) factory method to create a shallow copy DiscountCodeImportvoid
setCartDiscounts
(CartDiscountKeyReference... cartDiscounts) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.void
setCartDiscounts
(List<CartDiscountKeyReference> 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 that is used by the customer to apply the discount.void
Custom Fields of the DiscountCode.void
setDescription
(LocalizedString description) Maps toDiscountCode.description
.void
Groups to which the DiscountCode belongs.void
Groups to which the DiscountCode belongs.void
setIsActive
(Boolean isActive) Indicates if the DiscountCode is active and can be applied to the Cart.void
User-defined unique identifier.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) Maps toDiscountCode.name
.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<DiscountCodeImport>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withDiscountCodeImport
(Function<DiscountCodeImport, T> helper) accessor map functionMethods inherited from interface com.commercetools.importapi.models.common.ImportResource
withImportResource
-
Method Details
-
getKey
User-defined unique identifier. If a Discount Code with this
key
exists, it will be updated with the imported data.- Specified by:
getKey
in interfaceImportResource
- Returns:
- key
-
getName
Maps to
DiscountCode.name
.- Returns:
- name
-
getDescription
Maps to
DiscountCode.description
.- Returns:
- description
-
getCode
User-defined unique identifier of the DiscountCode that is used by the customer to apply the discount.
The value cannot be updated. Attempting to update the value will result in an InvalidFieldsUpdate error.
- 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
-
getMaxApplications
Long getMaxApplications()Number of times the DiscountCode can be applied. DiscountCode application is counted at the time of Order creation or update. 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 update. However, Order cancellation or deletion does not decrement the count.
- Returns:
- maxApplicationsPerCustomer
-
getGroups
Groups to which the DiscountCode belongs.
- 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
-
getCustom
Custom Fields of the DiscountCode.
- Returns:
- custom
-
setKey
User-defined unique identifier. If a Discount Code with this
key
exists, it will be updated with the imported data.- Specified by:
setKey
in interfaceImportResource
- Parameters:
key
- value to be set
-
setName
Maps to
DiscountCode.name
.- Parameters:
name
- value to be set
-
setDescription
Maps to
DiscountCode.description
.- Parameters:
description
- value to be set
-
setCode
User-defined unique identifier of the DiscountCode that is used by the customer to apply the discount.
The value cannot be updated. Attempting to update the value will result in an InvalidFieldsUpdate error.
- 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
-
setMaxApplications
Number of times the DiscountCode can be applied. DiscountCode application is counted at the time of Order creation or update. 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 update. However, Order cancellation or deletion does not decrement the count.
- Parameters:
maxApplicationsPerCustomer
- value to be set
-
setGroups
Groups to which the DiscountCode belongs.
- Parameters:
groups
- values to be set
-
setGroups
Groups to which the DiscountCode belongs.
- 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
-
setCustom
Custom Fields of the DiscountCode.
- Parameters:
custom
- value to be set
-
of
factory method- Returns:
- instance of DiscountCodeImport
-
of
factory method to create a shallow copy DiscountCodeImport- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of DiscountCodeImport- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for DiscountCodeImport- Returns:
- builder
-
builder
create builder for DiscountCodeImport instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withDiscountCodeImport
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
-