Class Cart
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware
,com.broadleafcommerce.money.CurrencyConsumer
,Serializable
,javax.money.CurrencySupplier
- Direct Known Subclasses:
CheckoutCart
- Author:
- Chad Harchar (charchar)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
List<com.broadleafcommerce.order.common.domain.Adjustment>
Adjustments to order pricing that should be applied toCartPricing.getSubtotal()
.The time this cart was submitted for approval.The cart approver's email address.The email of the assigned sales rep.The id of the assigned sales rep.Attribute choices for this cart driven by its items' product options, where each key is theattributeName
from an attribute choice.Miscellaneous attributes for this cart.List<com.broadleafcommerce.order.common.domain.CampaignRef>
A list of campaign references that are attached to this cart.The list of the alerts for thisCart
.Items that are contained within this cart.Embedded container for all pricing information on this cart.The checkout submissions made for this cart where each key is the request ID of a checkout and the value is anInstant
timestamp of when the checkout was made.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState
A subset ofTracking
information to expose the context state for this object.The date that this cart was first created.javax.money.CurrencyUnit
com.broadleafcommerce.order.common.domain.CustomerRef
A reference to the customer that owns this cart.The customer's email address.The expiration date of the cart.A list of fulfillment information for this cart.getId()
The context ID of the cart.Miscellaneous internal attributes for this item.The last time the cart was fully repriced with the most updated catalog pricing.The id of this cart's most recent audit.The locale for this cart.getName()
A unique name for the cart, used for retrieval.A list of offer codes that a user has added to their cart.The unique number associated with thisCart
.int
Returns the sum of the quantities of all thecartItems
.The estimated recurring adjustments total for the first period discounted for all items grouped by their recurring period type.The estimated recurring subtotal for the first period discounted for all items grouped by their recurring period type.The estimated recurring total for the first period discounted for all items grouped by their recurring period type.The status of this cart.The date that this cart was submitted.getType()
The type of cart.The version of this cart.List<com.broadleafcommerce.order.common.domain.Voucher>
A list ofVouchers
that thisCart
is qualifier for.int
hashCode()
boolean
Returns whether or not the cart is for an anonymous user.boolean
isPriced()
Flag to indicate whether this cart has been fully priced.boolean
Flag to indicate whether the taxes on the cart are estimates.void
setAdjustments
(List<com.broadleafcommerce.order.common.domain.Adjustment> adjustments) Adjustments to order pricing that should be applied toCartPricing.getSubtotal()
.void
setApprovalRequestedDate
(Instant approvalRequestedDate) The time this cart was submitted for approval.void
setApproverEmail
(String approverEmail) The cart approver's email address.void
setAssignedSalesRepEmail
(String assignedSalesRepEmail) The email of the assigned sales rep.void
setAssignedSalesRepId
(String assignedSalesRepId) The id of the assigned sales rep.void
setAttributeChoices
(Map<String, com.broadleafcommerce.order.common.domain.AttributeChoiceValue> attributeChoices) Attribute choices for this cart driven by its items' product options, where each key is theattributeName
from an attribute choice.void
setAttributes
(Map<String, Object> attributes) Miscellaneous attributes for this cart.void
setCampaignRefs
(List<com.broadleafcommerce.order.common.domain.CampaignRef> campaignRefs) A list of campaign references that are attached to this cart.void
setCartAlerts
(List<CartAlert> cartAlerts) The list of the alerts for thisCart
.void
setCartItems
(List<CartItem> cartItems) Items that are contained within this cart.void
setCartPricing
(CartPricing cartPricing) Embedded container for all pricing information on this cart.void
setCheckoutSubmissions
(Map<String, Instant> checkoutSubmissions) The checkout submissions made for this cart where each key is the request ID of a checkout and the value is anInstant
timestamp of when the checkout was made.void
setContextState
(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTracking
information to expose the context state for this object.void
setCreateDate
(Instant createDate) The date that this cart was first created.void
setCurrency
(javax.money.CurrencyUnit currencyUnit) void
setCustomerRef
(com.broadleafcommerce.order.common.domain.CustomerRef customerRef) A reference to the customer that owns this cart.void
setEmailAddress
(String emailAddress) The customer's email address.void
setExpirationDate
(Instant expirationDate) The expiration date of the cart.void
setFulfillmentGroups
(List<FulfillmentGroup> fulfillmentGroups) A list of fulfillment information for this cart.void
The context ID of the cart.void
setInternalAttributes
(Map<String, Object> internalAttributes) Miscellaneous internal attributes for this item.void
setLastCatalogReprice
(Instant lastCatalogReprice) The last time the cart was fully repriced with the most updated catalog pricing.void
setLastUpdatedAudit
(CartActionAudit lastUpdatedAudit) The id of this cart's most recent audit.void
The locale for this cart.void
A unique name for the cart, used for retrieval.void
setOfferCodes
(List<String> offerCodes) A list of offer codes that a user has added to their cart.void
setOrderNumber
(String orderNumber) The unique number associated with thisCart
.void
setPriced
(boolean isPriced) Flag to indicate whether this cart has been fully priced.void
The status of this cart.void
setSubmitDate
(Instant submitDate) The date that this cart was submitted.void
setTaxEstimated
(boolean isTaxEstimated) Flag to indicate whether the taxes on the cart are estimates.void
The type of cart.void
setVersion
(Integer version) The version of this cart.void
setVouchers
(List<com.broadleafcommerce.order.common.domain.Voucher> vouchers) A list ofVouchers
that thisCart
is qualifier for.toString()
-
Constructor Details
-
Cart
public Cart()
-
-
Method Details
-
getQuantity
public int getQuantity()Returns the sum of the quantities of all thecartItems
.- Returns:
- the sum of the quantities of all the
cartItems
.
-
isAnonymous
public boolean isAnonymous()Returns whether or not the cart is for an anonymous user.- Returns:
- whether or not the cart is for an anonymous user.
-
setCurrency
public void setCurrency(javax.money.CurrencyUnit currencyUnit) - Specified by:
setCurrency
in interfacecom.broadleafcommerce.money.CurrencyConsumer
-
getCurrency
public javax.money.CurrencyUnit getCurrency()- Specified by:
getCurrency
in interfacejavax.money.CurrencySupplier
-
getCartItemsWithDependentItems
-
getRecurringSubtotals
The estimated recurring subtotal for the first period discounted for all items grouped by their recurring period type.- Since:
- Cart Client 2.0.4
-
getRecurringAdjustmentsTotals
The estimated recurring adjustments total for the first period discounted for all items grouped by their recurring period type.- Since:
- Cart Client 2.0.4
-
getRecurringTotals
The estimated recurring total for the first period discounted for all items grouped by their recurring period type.- Since:
- Cart Client 2.0.4
-
getId
The context ID of the cart.- Returns:
- the context ID of the cart
-
getName
A unique name for the cart, used for retrieval. This field is not displayed anywhere.- Returns:
- a unique name for the cart, used for retrieval
-
getType
The type of cart.- See Also:
-
getStatus
The status of this cart.- Returns:
- The status of this cart.
- See Also:
-
getCustomerRef
public com.broadleafcommerce.order.common.domain.CustomerRef getCustomerRef()A reference to the customer that owns this cart.- Returns:
- A reference to the customer that owns this cart.
-
getApprovalRequestedDate
The time this cart was submitted for approval.This field is only needed for B2B carts to represent the cart approval process. For B2C carts, we don't expect a value to be provided for this field.
-
getApproverEmail
The cart approver's email address.This field is only needed for B2B carts to represent the cart approver's email address. For B2C carts, we don't expect a value to be provided for this field.
- Returns:
- The cart approver's email address.
-
getEmailAddress
The customer's email address.- Returns:
- The customer's email address.
-
getOrderNumber
The unique number associated with thisCart
. Typically, this is generated and set on cart submission. Used for record keeping and communicating with the customer instead of just usinggetId()
since that exposes unwanted information about your database.- Returns:
- The unique number associated with this
Cart
.
-
getCreateDate
The date that this cart was first created.- Returns:
- The date that this cart was first created.
-
getSubmitDate
The date that this cart was submitted. Only set if thecart status
isDefaultCartStatuses.SUBMITTED
, otherwise null.- Returns:
- The date that this cart was submitted.
- See Also:
-
getLocale
The locale for this cart. Used to determine what locale this cart was in for translations and other location-based functionality.- Returns:
- The locale code for this cart.
-
getCartPricing
Embedded container for all pricing information on this cart.- Returns:
- Embedded container for all pricing information on this cart.
-
getCartItems
Items that are contained within this cart. Typically represents a good or service that the customer is purchasing.- Returns:
- Items for purchase that are contained within this cart.
-
getFulfillmentGroups
A list of fulfillment information for this cart. A cart can have many fulfillment groups associated with it in order to support multi-address and multi-type shipping.- Returns:
- A list of fulfillment information for this cart.
-
getAdjustments
Adjustments to order pricing that should be applied toCartPricing.getSubtotal()
.- Returns:
- Adjustments to order pricing that should be applied to
CartPricing.getSubtotal()
.
-
getOfferCodes
A list of offer codes that a user has added to their cart. Can be used to applyAdjustments
to different aspects of the order.- Returns:
- A list of offer codes that a user has added to their cart.
-
getVouchers
A list ofVouchers
that thisCart
is qualifier for.This mainly serves as a temporary storage and for UI display, the
Vouchers
will not be processed until the order is completed. -
getCampaignRefs
A list of campaign references that are attached to this cart. Similar togetOfferCodes()
, theCampaignRef.getCampaignTrackingId()
can be used to applyAdjustments
to different aspects of the order. The difference is that these items need to be validated against a valid "Campaign" before being added to this list.- Returns:
- A list of campaign references that are attached to this cart.
-
getAssignedSalesRepId
The id of the assigned sales rep.This is field is only used for
quotes
for the sales rep review process. -
getAssignedSalesRepEmail
The email of the assigned sales rep.This is field is only used for
quotes
for the sales rep review process. -
getAttributes
Miscellaneous attributes for this cart.- Returns:
- Miscellaneous attributes for this cart.
-
getInternalAttributes
Miscellaneous internal attributes for this item. Distinguished fromgetAttributes()
in that this map is used for attributes that assist in the internal working of Broadleaf MicroServices. For example, attributes to help with processing the cart's checkout.- Returns:
- Miscellaneous internal attributes for this item.
-
getAttributeChoices
public Map<String,com.broadleafcommerce.order.common.domain.AttributeChoiceValue> getAttributeChoices()Attribute choices for this cart driven by its items' product options, where each key is theattributeName
from an attribute choice.- Returns:
- Attribute choices for this cart driven by its items' product options, where each key
is the
attributeName
from an attribute choice.
-
getCheckoutSubmissions
The checkout submissions made for this cart where each key is the request ID of a checkout and the value is anInstant
timestamp of when the checkout was made.- Returns:
- The checkout submissions made for this cart where each key is the request ID and the
value is an
Instant
timestamp of when the checkout was made.
-
isPriced
public boolean isPriced()Flag to indicate whether this cart has been fully priced. This means totalling of items, adjustments, shipping and tax.- Returns:
- Flag to indicate whether this cart has been fully priced.
-
isTaxEstimated
public boolean isTaxEstimated()Flag to indicate whether the taxes on the cart are estimates.- Returns:
- Flag to indicate whether the taxes on the cart are estimates.
-
getVersion
The version of this cart. Used for checking that the requested version of the cart is up-to-date before saving changes. Required for any request which results in an update being made to the cart. This should never be manually incremented/decremented. -
getCartAlerts
The list of the alerts for thisCart
. NOTE: This is a transient property that is not persisted in the database.- Returns:
- the list of the cart alerts
-
getLastCatalogReprice
The last time the cart was fully repriced with the most updated catalog pricing.- Returns:
- The last time the cart was fully repriced with the most updated catalog pricing.
-
getExpirationDate
The expiration date of the cart. This is typically only used forDefaultCartTypes.QUOTE
-typed carts. -
getLastUpdatedAudit
The id of this cart's most recent audit. -
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()A subset ofTracking
information to expose the context state for this object.- Specified by:
getContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Returns:
- a subset of
Tracking
information to expose the context state for this object
-
setId
The context ID of the cart.- Parameters:
id
- the context ID of the cart
-
setName
A unique name for the cart, used for retrieval. This field is not displayed anywhere.- Parameters:
name
- a unique name for the cart, used for retrieval
-
setType
The type of cart.- See Also:
-
setStatus
The status of this cart.- Parameters:
status
- The status of this cart.- See Also:
-
setCustomerRef
public void setCustomerRef(com.broadleafcommerce.order.common.domain.CustomerRef customerRef) A reference to the customer that owns this cart.- Parameters:
customerRef
- A reference to the customer that owns this cart.
-
setApprovalRequestedDate
The time this cart was submitted for approval.This field is only needed for B2B carts to represent the cart approval process. For B2C carts, we don't expect a value to be provided for this field.
-
setApproverEmail
The cart approver's email address.This field is only needed for B2B carts to represent the cart approver's email address. For B2C carts, we don't expect a value to be provided for this field.
- Parameters:
approverEmail
- The cart approver's email address.
-
setEmailAddress
The customer's email address.- Parameters:
emailAddress
- The customer's email address.
-
setOrderNumber
The unique number associated with thisCart
. Typically, this is generated and set on cart submission. Used for record keeping and communicating with the customer instead of just usinggetId()
since that exposes unwanted information about your database.- Parameters:
orderNumber
- The unique number associated with thisCart
.
-
setCreateDate
The date that this cart was first created.- Parameters:
createDate
- The date that this cart was first created.
-
setSubmitDate
The date that this cart was submitted. Only set if thecart status
isDefaultCartStatuses.SUBMITTED
, otherwise null.- Parameters:
submitDate
- The date that this cart was submitted.- See Also:
-
setLocale
The locale for this cart. Used to determine what locale this cart was in for translations and other location-based functionality.- Parameters:
locale
- The locale code for this cart.
-
setCartPricing
Embedded container for all pricing information on this cart.- Parameters:
cartPricing
- Embedded container for all pricing information on this cart.
-
setCartItems
Items that are contained within this cart. Typically represents a good or service that the customer is purchasing.- Parameters:
cartItems
- Items for purchase that are contained within this cart.
-
setFulfillmentGroups
A list of fulfillment information for this cart. A cart can have many fulfillment groups associated with it in order to support multi-address and multi-type shipping.- Parameters:
fulfillmentGroups
- A list of fulfillment information for this cart.
-
setAdjustments
Adjustments to order pricing that should be applied toCartPricing.getSubtotal()
.- Parameters:
adjustments
- Adjustments to order pricing that should be applied toCartPricing.getSubtotal()
.
-
setOfferCodes
A list of offer codes that a user has added to their cart. Can be used to applyAdjustments
to different aspects of the order.- Parameters:
offerCodes
- A list of offer codes that a user has added to their cart.
-
setVouchers
A list ofVouchers
that thisCart
is qualifier for.This mainly serves as a temporary storage and for UI display, the
Vouchers
will not be processed until the order is completed. -
setCampaignRefs
public void setCampaignRefs(List<com.broadleafcommerce.order.common.domain.CampaignRef> campaignRefs) A list of campaign references that are attached to this cart. Similar togetOfferCodes()
, theCampaignRef.getCampaignTrackingId()
can be used to applyAdjustments
to different aspects of the order. The difference is that these items need to be validated against a valid "Campaign" before being added to this list.- Parameters:
campaignRefs
- A list of campaign references that are attached to this cart.
-
setAssignedSalesRepId
The id of the assigned sales rep.This is field is only used for
quotes
for the sales rep review process. -
setAssignedSalesRepEmail
The email of the assigned sales rep.This is field is only used for
quotes
for the sales rep review process. -
setAttributes
Miscellaneous attributes for this cart.- Parameters:
attributes
- Miscellaneous attributes for this cart.
-
setInternalAttributes
Miscellaneous internal attributes for this item. Distinguished fromgetAttributes()
in that this map is used for attributes that assist in the internal working of Broadleaf MicroServices. For example, attributes to help with processing the cart's checkout.- Parameters:
internalAttributes
- Miscellaneous internal attributes for this item.
-
setAttributeChoices
public void setAttributeChoices(Map<String, com.broadleafcommerce.order.common.domain.AttributeChoiceValue> attributeChoices) Attribute choices for this cart driven by its items' product options, where each key is theattributeName
from an attribute choice.- Parameters:
attributeChoices
- Attribute choices for this cart driven by its items' product options, where each key is theattributeName
from an attribute choice.
-
setCheckoutSubmissions
The checkout submissions made for this cart where each key is the request ID of a checkout and the value is anInstant
timestamp of when the checkout was made.- Parameters:
checkoutSubmissions
- The checkout submissions made for this cart where each key is the request ID of a checkout and the value is anInstant
timestamp of when the checkout was made.
-
setPriced
public void setPriced(boolean isPriced) Flag to indicate whether this cart has been fully priced. This means totalling of items, adjustments, shipping and tax.- Parameters:
isPriced
- Flag to indicate whether this cart has been fully priced.
-
setTaxEstimated
public void setTaxEstimated(boolean isTaxEstimated) Flag to indicate whether the taxes on the cart are estimates.- Parameters:
isTaxEstimated
- Flag to indicate whether the taxes on the cart are estimates.
-
setVersion
The version of this cart. Used for checking that the requested version of the cart is up-to-date before saving changes. Required for any request which results in an update being made to the cart. This should never be manually incremented/decremented. -
setCartAlerts
The list of the alerts for thisCart
. NOTE: This is a transient property that is not persisted in the database.- Parameters:
cartAlerts
- the list of the cart alerts
-
setLastCatalogReprice
The last time the cart was fully repriced with the most updated catalog pricing.- Parameters:
lastCatalogReprice
- The last time the cart was fully repriced with the most updated catalog pricing.
-
setExpirationDate
The expiration date of the cart. This is typically only used forDefaultCartTypes.QUOTE
-typed carts. -
setLastUpdatedAudit
The id of this cart's most recent audit. -
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTracking
information to expose the context state for this object.- Specified by:
setContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Parameters:
contextState
- a subset ofTracking
information to expose the context state for this object
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-