public interface DiscountCode extends Resource<DiscountCode>, Custom
Modifier and Type | Method and Description |
---|---|
List<Reference<CartDiscount>> |
getCartDiscounts()
The referenced matching cart discounts can be applied to the cart once the discount code is added (
AddDiscountCode ). |
String |
getCartPredicate()
The discount code can only be applied to carts that match this predicate.
|
String |
getCode()
Unique identifier of this discount code.
|
CustomFields |
getCustom() |
LocalizedString |
getDescription()
Description of this discount code.
|
List<String> |
getGroups()
This field is used to signal to which groups the
DiscountCode belongs to. |
Long |
getMaxApplications()
The discount code can only be applied maxApplications times.
|
Long |
getMaxApplicationsPerCustomer()
The discount code can only be applied maxApplicationsPerCustomer times per customer.
|
LocalizedString |
getName()
Name of this discount code.
|
List<Reference<com.fasterxml.jackson.databind.JsonNode>> |
getReferences()
The backend will generate this array from the cartPredicate.
|
ZonedDateTime |
getValidFrom()
Start date for discount code validity
|
ZonedDateTime |
getValidUntil()
End date for discount code validity
|
Boolean |
isActive()
Flag if this cart discount is enabled
|
static Reference<DiscountCode> |
referenceOfId(String id)
Creates a reference for one item of this class by a known ID.
|
static String |
referenceTypeId()
A type hint for references which resource type is linked in a reference.
|
static String |
resourceTypeId()
An identifier for this resource which supports
CustomFields . |
default Reference<DiscountCode> |
toReference()
Creates a reference to this resource, the reference may not be filled.
|
static com.fasterxml.jackson.core.type.TypeReference<DiscountCode> |
typeReference()
Creates a container which contains the full Java type information to deserialize this class from JSON.
|
getCreatedAt, getId, getLastModifiedAt, getVersion
hasSameIdAs, toResourceIdentifier
List<Reference<CartDiscount>> getCartDiscounts()
AddDiscountCode
).ChangeCartDiscounts
@Nullable String getCartPredicate()
SetCartPredicate
String getCode()
AddDiscountCode
) to enable the related cart discounts in the cart.List<String> getGroups()
DiscountCode
belongs to.@Nullable LocalizedString getDescription()
SetDescription
Boolean isActive()
ChangeIsActive
@Nullable ZonedDateTime getValidFrom()
@Nullable ZonedDateTime getValidUntil()
@Nullable Long getMaxApplications()
SetMaxApplications
@Nullable Long getMaxApplicationsPerCustomer()
SetMaxApplicationsPerCustomer
@Nullable LocalizedString getName()
SetName
List<Reference<com.fasterxml.jackson.databind.JsonNode>> getReferences()
@Nullable CustomFields getCustom()
default Reference<DiscountCode> toReference()
Referenceable
toReference
in interface Referenceable<DiscountCode>
toReference
in interface Resource<DiscountCode>
static String referenceTypeId()
Reference.getTypeId()
static com.fasterxml.jackson.core.type.TypeReference<DiscountCode> typeReference()
static Reference<DiscountCode> referenceOfId(String id)
An example for categories but this applies for other resources, too:
final String categoryIdFromFormOrSession = "84ac4271-0fec-49d0-9fee-55586c565c58"; final Reference<Category> categoryReference = Category.referenceOfId(categoryIdFromFormOrSession); assertThat(categoryReference.getId()).isEqualTo(categoryIdFromFormOrSession);
See the test code.
If you already have a resource object, then use toReference()
instead:
final Category category = getCategory1(); final Reference<Category> categoryReference = category.toReference(); assertThat(category.getId()).isEqualTo(categoryReference.getId());
See the test code.
id
- the ID of the resource which should be referenced.static String resourceTypeId()
CustomFields
.TypeDraft.getResourceTypeIds()
,
Custom