public interface CartDiscount extends Resource<CartDiscount>, Custom, WithKey
Modifier and Type | Method and Description |
---|---|
String |
getCartPredicate()
Predicate where the discounts should be applied to.
|
CustomFields |
getCustom()
Allow to add
CustomFields to the CartDiscount |
LocalizedString |
getDescription()
Description of this cart discount.
|
String |
getKey() |
LocalizedString |
getName()
Name of this discount.
|
List<Reference<com.fasterxml.jackson.databind.JsonNode>> |
getReferences() |
String |
getSortOrder()
Determinates the order of multiple cart discounts.
|
StackingMode |
getStackingMode()
Specify whether the application of this discount causes the following discounts to be ignored.
|
CartDiscountTarget |
getTarget()
Defines what part of the cart will be discounted.
|
ZonedDateTime |
getValidFrom()
Lower bound of the validity period.
|
ZonedDateTime |
getValidUntil()
Upper bound of the validity period.
|
CartDiscountValue |
getValue()
The value of the discount (determines the reduced price).
|
Boolean |
isActive()
Flag if the discount is active.
|
Boolean |
isRequiringDiscountCode()
States whether the the discount code can only be used in a connection with a
DiscountCode . |
static Reference<CartDiscount> |
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() |
default Reference<CartDiscount> |
toReference()
Creates a reference to this resource, the reference may not be filled.
|
static com.fasterxml.jackson.core.type.TypeReference<CartDiscount> |
typeReference()
Creates a container which contains the full Java type information to deserialize this class from JSON.
|
getCreatedAt, getId, getLastModifiedAt, getVersion
hasSameIdAs, toResourceIdentifier
String getCartPredicate()
isRequiringDiscountCode()
,
CartPredicate
@Nullable LocalizedString getDescription()
SetDescription
Boolean isActive()
ChangeIsActive
LocalizedString getName()
ChangeName
Boolean isRequiringDiscountCode()
DiscountCode
.ChangeRequiresDiscountCode
String getSortOrder()
ChangeSortOrder
@Nullable CartDiscountTarget getTarget()
getValue()
is a GiftLineItemCartDiscountValue
ChangeTarget
@Nullable CustomFields getCustom()
CustomFields
to the CartDiscount
getCustom
in interface Custom
CustomFields
defined at this CartDiscount
@Nullable ZonedDateTime getValidFrom()
SetValidFrom
@Nullable ZonedDateTime getValidUntil()
SetValidUntil
CartDiscountValue getValue()
ChangeValue
StackingMode getStackingMode()
StackingMode.STACKING
.static String referenceTypeId()
Reference.getTypeId()
static String resourceTypeId()
default Reference<CartDiscount> toReference()
Referenceable
toReference
in interface Referenceable<CartDiscount>
toReference
in interface Resource<CartDiscount>
static com.fasterxml.jackson.core.type.TypeReference<CartDiscount> typeReference()
static Reference<CartDiscount> 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.