public interface DiscountCode extends Resource<DiscountCode>
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.
|
LocalizedString |
getDescription()
Description of this discount code.
|
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.
|
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.
|
default Reference<DiscountCode> |
toReference() |
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.@Nullable LocalizedString getDescription()
SetDescription
Boolean isActive()
ChangeIsActive
@Nullable Long getMaxApplications()
SetMaxApplications
@Nullable Long getMaxApplicationsPerCustomer()
SetMaxApplicationsPerCustomer
@Nullable LocalizedString getName()
SetName
List<Reference<com.fasterxml.jackson.databind.JsonNode>> getReferences()
default Reference<DiscountCode> toReference()
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.