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 booleanbooleanList<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 theattributeNamefrom 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 anInstanttimestamp of when the checkout was made.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextStateA subset ofTrackinginformation to expose the context state for this object.The date that this cart was first created.javax.money.CurrencyUnitcom.broadleafcommerce.order.common.domain.CustomerRefA 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.intReturns 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 ofVouchersthat thisCartis qualifier for.inthashCode()booleanReturns whether or not the cart is for an anonymous user.booleanisPriced()Flag to indicate whether this cart has been fully priced.booleanFlag to indicate whether the taxes on the cart are estimates.voidsetAdjustments(List<com.broadleafcommerce.order.common.domain.Adjustment> adjustments) Adjustments to order pricing that should be applied toCartPricing.getSubtotal().voidsetApprovalRequestedDate(Instant approvalRequestedDate) The time this cart was submitted for approval.voidsetApproverEmail(String approverEmail) The cart approver's email address.voidsetAssignedSalesRepEmail(String assignedSalesRepEmail) The email of the assigned sales rep.voidsetAssignedSalesRepId(String assignedSalesRepId) The id of the assigned sales rep.voidsetAttributeChoices(Map<String, com.broadleafcommerce.order.common.domain.AttributeChoiceValue> attributeChoices) Attribute choices for this cart driven by its items' product options, where each key is theattributeNamefrom an attribute choice.voidsetAttributes(Map<String, Object> attributes) Miscellaneous attributes for this cart.voidsetCampaignRefs(List<com.broadleafcommerce.order.common.domain.CampaignRef> campaignRefs) A list of campaign references that are attached to this cart.voidsetCartAlerts(List<CartAlert> cartAlerts) The list of the alerts for thisCart.voidsetCartItems(List<CartItem> cartItems) Items that are contained within this cart.voidsetCartPricing(CartPricing cartPricing) Embedded container for all pricing information on this cart.voidsetCheckoutSubmissions(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 anInstanttimestamp of when the checkout was made.voidsetContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTrackinginformation to expose the context state for this object.voidsetCreateDate(Instant createDate) The date that this cart was first created.voidsetCurrency(javax.money.CurrencyUnit currencyUnit) voidsetCustomerRef(com.broadleafcommerce.order.common.domain.CustomerRef customerRef) A reference to the customer that owns this cart.voidsetEmailAddress(String emailAddress) The customer's email address.voidsetExpirationDate(Instant expirationDate) The expiration date of the cart.voidsetFulfillmentGroups(List<FulfillmentGroup> fulfillmentGroups) A list of fulfillment information for this cart.voidThe context ID of the cart.voidsetInternalAttributes(Map<String, Object> internalAttributes) Miscellaneous internal attributes for this item.voidsetLastCatalogReprice(Instant lastCatalogReprice) The last time the cart was fully repriced with the most updated catalog pricing.voidsetLastUpdatedAudit(CartActionAudit lastUpdatedAudit) The id of this cart's most recent audit.voidThe locale for this cart.voidA unique name for the cart, used for retrieval.voidsetOfferCodes(List<String> offerCodes) A list of offer codes that a user has added to their cart.voidsetOrderNumber(String orderNumber) The unique number associated with thisCart.voidsetPriced(boolean isPriced) Flag to indicate whether this cart has been fully priced.voidThe status of this cart.voidsetSubmitDate(Instant submitDate) The date that this cart was submitted.voidsetTaxEstimated(boolean isTaxEstimated) Flag to indicate whether the taxes on the cart are estimates.voidThe type of cart.voidsetVersion(Integer version) The version of this cart.voidsetVouchers(List<com.broadleafcommerce.order.common.domain.Voucher> vouchers) A list ofVouchersthat thisCartis 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:
setCurrencyin interfacecom.broadleafcommerce.money.CurrencyConsumer
-
getCurrency
public javax.money.CurrencyUnit getCurrency()- Specified by:
getCurrencyin 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 statusisDefaultCartStatuses.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 applyAdjustmentsto different aspects of the order.- Returns:
- A list of offer codes that a user has added to their cart.
-
getVouchers
A list ofVouchersthat thisCartis qualifier for.This mainly serves as a temporary storage and for UI display, the
Voucherswill 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 applyAdjustmentsto 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
quotesfor the sales rep review process. -
getAssignedSalesRepEmail
The email of the assigned sales rep.This is field is only used for
quotesfor 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 theattributeNamefrom an attribute choice.- Returns:
- Attribute choices for this cart driven by its items' product options, where each key
is the
attributeNamefrom 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 anInstanttimestamp 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
Instanttimestamp 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 ofTrackinginformation to expose the context state for this object.- Specified by:
getContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Returns:
- a subset of
Trackinginformation 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 statusisDefaultCartStatuses.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 applyAdjustmentsto different aspects of the order.- Parameters:
offerCodes- A list of offer codes that a user has added to their cart.
-
setVouchers
A list ofVouchersthat thisCartis qualifier for.This mainly serves as a temporary storage and for UI display, the
Voucherswill 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 applyAdjustmentsto 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
quotesfor the sales rep review process. -
setAssignedSalesRepEmail
The email of the assigned sales rep.This is field is only used for
quotesfor 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 theattributeNamefrom an attribute choice.- Parameters:
attributeChoices- Attribute choices for this cart driven by its items' product options, where each key is theattributeNamefrom 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 anInstanttimestamp 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 anInstanttimestamp 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 ofTrackinginformation to expose the context state for this object.- Specified by:
setContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Parameters:
contextState- a subset ofTrackinginformation to expose the context state for this object
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-