Class DiscountCodeImportBuilder
- All Implemented Interfaces:
Builder<DiscountCodeImport>
Example to create an instance using the builder pattern
DiscountCodeImport discountCodeImport = DiscountCodeImport.builder()
.key("{key}")
.code("{code}")
.plusCartDiscounts(cartDiscountsBuilder -> cartDiscountsBuilder)
.isActive(true)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.build()
builds DiscountCodeImport with checking for non-null required valuesbuilds DiscountCodeImport without checking for non-null required valuescartDiscounts
(CartDiscountKeyReference... cartDiscounts) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.cartDiscounts
(List<CartDiscountKeyReference> cartDiscounts) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.cartPredicate
(String cartPredicate) DiscountCode can only be applied to Carts that match this predicate.User-defined unique identifier of the DiscountCode that is used by the customer to apply the discount.Custom Fields of the DiscountCode.custom
(Function<CustomBuilder, CustomBuilder> builder) Custom Fields of the DiscountCode.description
(LocalizedString description) Maps toDiscountCode.description
.Maps toDiscountCode.description
.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.getCode()
User-defined unique identifier of the DiscountCode that is used by the customer to apply the discount.Custom Fields of the DiscountCode.Maps toDiscountCode.description
.Groups to which the DiscountCode belongs.Indicates if the DiscountCode is active and can be applied to the Cart.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).getName()
Maps toDiscountCode.name
.Date and time (UTC) from which the DiscountCode is effective.Date and time (UTC) until which the DiscountCode is effective.Groups to which the DiscountCode belongs.Groups to which the DiscountCode belongs.Indicates if the DiscountCode is active and can be applied to the Cart.User-defined unique identifier.maxApplications
(Long maxApplications) Number of times the DiscountCode can be applied.maxApplicationsPerCustomer
(Long maxApplicationsPerCustomer) Number of times the DiscountCode can be applied per Customer (anonymous Carts are not supported).name
(LocalizedString name) Maps toDiscountCode.name
.Maps toDiscountCode.name
.static DiscountCodeImportBuilder
of()
factory method for an instance of DiscountCodeImportBuilderstatic DiscountCodeImportBuilder
of
(DiscountCodeImport template) create builder for DiscountCodeImport instanceplusCartDiscounts
(CartDiscountKeyReference... cartDiscounts) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.plusCartDiscounts
(Function<CartDiscountKeyReferenceBuilder, CartDiscountKeyReferenceBuilder> builder) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.plusGroups
(String... groups) Groups to which the DiscountCode belongs.Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.validFrom
(ZonedDateTime validFrom) Date and time (UTC) from which the DiscountCode is effective.validUntil
(ZonedDateTime validUntil) Date and time (UTC) until which the DiscountCode is effective.withCartDiscounts
(Function<CartDiscountKeyReferenceBuilder, CartDiscountKeyReferenceBuilder> builder) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.withCustom
(Function<CustomBuilder, Custom> builder) Custom Fields of the DiscountCode.Maps toDiscountCode.description
.Maps toDiscountCode.name
.
-
Constructor Details
-
DiscountCodeImportBuilder
public DiscountCodeImportBuilder()
-
-
Method Details
-
key
User-defined unique identifier. If a Discount Code with this
key
exists, it will be updated with the imported data.- Parameters:
key
- value to be set- Returns:
- Builder
-
name
public DiscountCodeImportBuilder name(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) Maps to
DiscountCode.name
.- Parameters:
builder
- function to build the name value- Returns:
- Builder
-
withName
Maps to
DiscountCode.name
.- Parameters:
builder
- function to build the name value- Returns:
- Builder
-
name
Maps to
DiscountCode.name
.- Parameters:
name
- value to be set- Returns:
- Builder
-
description
public DiscountCodeImportBuilder description(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) Maps to
DiscountCode.description
.- Parameters:
builder
- function to build the description value- Returns:
- Builder
-
withDescription
public DiscountCodeImportBuilder withDescription(Function<LocalizedStringBuilder, LocalizedString> builder) Maps to
DiscountCode.description
.- Parameters:
builder
- function to build the description value- Returns:
- Builder
-
description
Maps to
DiscountCode.description
.- Parameters:
description
- value to be set- Returns:
- Builder
-
code
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- Returns:
- Builder
-
cartDiscounts
Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
cartDiscounts
- value to be set- Returns:
- Builder
-
cartDiscounts
Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
cartDiscounts
- value to be set- Returns:
- Builder
-
plusCartDiscounts
Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
cartDiscounts
- value to be set- Returns:
- Builder
-
plusCartDiscounts
public DiscountCodeImportBuilder plusCartDiscounts(Function<CartDiscountKeyReferenceBuilder, CartDiscountKeyReferenceBuilder> builder) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
builder
- function to build the cartDiscounts value- Returns:
- Builder
-
withCartDiscounts
public DiscountCodeImportBuilder withCartDiscounts(Function<CartDiscountKeyReferenceBuilder, CartDiscountKeyReferenceBuilder> builder) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
builder
- function to build the cartDiscounts value- Returns:
- Builder
-
addCartDiscounts
public DiscountCodeImportBuilder addCartDiscounts(Function<CartDiscountKeyReferenceBuilder, CartDiscountKeyReference> builder) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
builder
- function to build the cartDiscounts value- Returns:
- Builder
-
setCartDiscounts
public DiscountCodeImportBuilder setCartDiscounts(Function<CartDiscountKeyReferenceBuilder, CartDiscountKeyReference> builder) Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.
- Parameters:
builder
- function to build the cartDiscounts value- Returns:
- Builder
-
cartPredicate
DiscountCode can only be applied to Carts that match this predicate.
- Parameters:
cartPredicate
- value to be set- Returns:
- Builder
-
isActive
Indicates if the DiscountCode is active and can be applied to the Cart.
- Parameters:
isActive
- value to be set- Returns:
- Builder
-
maxApplications
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- Returns:
- Builder
-
maxApplicationsPerCustomer
public DiscountCodeImportBuilder maxApplicationsPerCustomer(@Nullable Long maxApplicationsPerCustomer) 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- Returns:
- Builder
-
groups
Groups to which the DiscountCode belongs.
- Parameters:
groups
- value to be set- Returns:
- Builder
-
groups
Groups to which the DiscountCode belongs.
- Parameters:
groups
- value to be set- Returns:
- Builder
-
plusGroups
Groups to which the DiscountCode belongs.
- Parameters:
groups
- value to be set- Returns:
- Builder
-
validFrom
Date and time (UTC) from which the DiscountCode is effective.
- Parameters:
validFrom
- value to be set- Returns:
- Builder
-
validUntil
Date and time (UTC) until which the DiscountCode is effective.
- Parameters:
validUntil
- value to be set- Returns:
- Builder
-
custom
Custom Fields of the DiscountCode.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
withCustom
Custom Fields of the DiscountCode.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
custom
Custom Fields of the DiscountCode.
- Parameters:
custom
- value to be set- Returns:
- Builder
-
getKey
User-defined unique identifier. If a Discount Code with this
key
exists, it will be updated with the imported data.- 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
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
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
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
Date and time (UTC) from which the DiscountCode is effective.
- Returns:
- validFrom
-
getValidUntil
Date and time (UTC) until which the DiscountCode is effective.
- Returns:
- validUntil
-
getCustom
Custom Fields of the DiscountCode.
- Returns:
- custom
-
build
builds DiscountCodeImport with checking for non-null required values- Specified by:
build
in interfaceBuilder<DiscountCodeImport>
- Returns:
- DiscountCodeImport
-
buildUnchecked
builds DiscountCodeImport without checking for non-null required values- Returns:
- DiscountCodeImport
-
of
factory method for an instance of DiscountCodeImportBuilder- Returns:
- builder
-
of
create builder for DiscountCodeImport instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-