public interface Cart extends CartLike<Cart>
A shopping cart holds product variants and can be ordered.
Each cart either belongs to a registered customer or is an anonymous cart (getCustomerId()
yields null).
A cart can have custom fields
.
Modifier and Type | Method and Description |
---|---|
String |
getAnonymousId()
Identifies carts and orders belonging to an anonymous session (the customer has not signed up/in yet).
|
Address |
getBillingAddress()
Address for the bill.
|
CartState |
getCartState()
State in the perspective if the cart is active, merged with another cart or ordered.
|
com.neovisionaries.i18n.CountryCode |
getCountry() |
CustomFields |
getCustom() |
String |
getCustomerEmail()
The email of the customer which should be used for this cart/order.
|
Reference<CustomerGroup> |
getCustomerGroup()
In the order context the customer group can only be expanded if the customer was in a group before creating the order.
|
String |
getCustomerId()
The id of the customer possessing the cart.
|
List<CustomLineItem> |
getCustomLineItems()
The custom line items of this cart.
|
Integer |
getDeleteDaysAfterLastModification() |
List<DiscountCodeInfo> |
getDiscountCodes()
Discount codes belonging to this cart.
|
InventoryMode |
getInventoryMode() |
List<Address> |
getItemShippingAddresses() |
String |
getKey() |
List<LineItem> |
getLineItems()
Snapshots of the products added to the cart.
|
CartOrigin |
getOrigin() |
PaymentInfo |
getPaymentInfo()
Get associated payments.
|
List<Reference<CartDiscount>> |
getRefusedGifts()
The refused gifts of this cart.
|
Address |
getShippingAddress()
Address to ship the goods.
|
CartShippingInfo |
getShippingInfo()
Information about shipping set by the backend once the shipping method is set.
|
ShippingRateInput |
getShippingRateInput()
The shippingRateInput is used as an input to select a shipping rate price tier
|
KeyReference<Store> |
getStore() |
TaxCalculationMode |
getTaxCalculationMode()
Tax calculation mode of this cart.
|
TaxedPrice |
getTaxedPrice()
The taxed price.
|
javax.money.MonetaryAmount |
getTotalPrice() |
static Reference<Cart> |
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<Cart> |
toReference()
Creates a reference to this resource, the reference may not be filled.
|
static com.fasterxml.jackson.core.type.TypeReference<Cart> |
typeReference()
Creates a container which contains the full Java type information to deserialize this class from JSON.
|
calculateSubTotalPrice, calculateTotalAppliedTaxes, findCustomLineItem, findLineItem, getCurrency, getLocale, getTaxMode, getTaxRoundingMode
getCreatedAt, getId, getLastModifiedAt, getVersion
hasSameIdAs, toResourceIdentifier
static String resourceTypeId()
CustomFields
.TypeDraft.getResourceTypeIds()
,
Custom
static String referenceTypeId()
Reference.getTypeId()
static com.fasterxml.jackson.core.type.TypeReference<Cart> typeReference()
default Reference<Cart> toReference()
Referenceable
toReference
in interface Referenceable<Cart>
toReference
in interface Resource<Cart>
@Nullable String getAnonymousId()
CartLike
getAnonymousId
in interface CartLike<Cart>
CartState getCartState()
CustomerSignInCommand
,
OrderFromCartCreateCommand
InventoryMode getInventoryMode()
@Nullable CartShippingInfo getShippingInfo()
CartLike
getShippingInfo
in interface CartLike<Cart>
SetShippingMethod
,
SetCustomShippingMethod
,
AddDelivery
@Nullable Address getBillingAddress()
CartLike
getBillingAddress
in interface CartLike<Cart>
SetBillingAddress
@Nullable com.neovisionaries.i18n.CountryCode getCountry()
getCountry
in interface CartLike<Cart>
@Nullable String getCustomerEmail()
CartLike
Customer.getEmail()
.getCustomerEmail
in interface CartLike<Cart>
SetCustomerEmail
@Nullable Reference<CustomerGroup> getCustomerGroup()
CartLike
getCustomerGroup
in interface CartLike<Cart>
@Nullable String getCustomerId()
getCustomerId
in interface CartLike<Cart>
CustomerSignInCommand
,
SetCustomerId
List<CustomLineItem> getCustomLineItems()
getCustomLineItems
in interface CartLike<Cart>
AddCustomLineItem
,
RemoveCustomLineItem
,
Order.getCustomLineItems()
List<LineItem> getLineItems()
CartLike
getLineItems
in interface CartLike<Cart>
AddLineItem
,
ChangeLineItemQuantity
,
RemoveLineItem
@Nullable Address getShippingAddress()
CartLike
getShippingAddress
in interface CartLike<Cart>
SetShippingAddress
,
CartLike.getTaxedPrice()
@Nullable TaxedPrice getTaxedPrice()
CartLike
CartLike.getShippingAddress()
) is used to determine tax rate of the line items.getTaxedPrice
in interface CartLike<Cart>
TaxCalculationMode getTaxCalculationMode()
CartLike
getTaxCalculationMode
in interface CartLike<Cart>
ChangeTaxCalculationMode
javax.money.MonetaryAmount getTotalPrice()
getTotalPrice
in interface CartLike<Cart>
List<DiscountCodeInfo> getDiscountCodes()
CartLike
getDiscountCodes
in interface CartLike<Cart>
AddDiscountCode
@Nullable CustomFields getCustom()
@Nullable PaymentInfo getPaymentInfo()
CartLike
getPaymentInfo
in interface CartLike<Cart>
AddPayment
,
RemovePayment
,
AddPayment
,
RemovePayment
@Nullable List<Reference<CartDiscount>> getRefusedGifts()
LineItemMode.GIFT_LINE_ITEM
is removed from this cart.@Nullable ShippingRateInput getShippingRateInput()
getShippingRateInput
in interface CartLike<Cart>
CartOrigin getOrigin()
List<Address> getItemShippingAddresses()
getItemShippingAddresses
in interface CartLike<Cart>
@Nullable KeyReference<Store> getStore()
static Reference<Cart> 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.