java.lang.Object
com.broadleafcommerce.order.client.domain.Order
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware, com.broadleafcommerce.data.tracking.core.policy.Owned, com.broadleafcommerce.money.CurrencyConsumer, Serializable, javax.money.CurrencySupplier

public class Order extends Object implements com.broadleafcommerce.data.tracking.core.ContextStateAware, Serializable, com.broadleafcommerce.data.tracking.core.policy.Owned, javax.money.CurrencySupplier, com.broadleafcommerce.money.CurrencyConsumer
Represents a purchase of items, often generated from a submitted cart.
See Also:
  • Constructor Details

    • Order

      public Order()
  • Method Details

    • getCartType

      public String getCartType()
      Returns the cart type or DefaultCartTypes.BLC_CART if null.
      Returns:
      the cart type or DefaultCartTypes.BLC_CART if null
    • getOwnerIdentifier

      public String getOwnerIdentifier()
      Specified by:
      getOwnerIdentifier in interface com.broadleafcommerce.data.tracking.core.policy.Owned
    • getCurrency

      @Nullable public javax.money.CurrencyUnit getCurrency()
      Specified by:
      getCurrency in interface javax.money.CurrencySupplier
    • setCurrency

      public void setCurrency(javax.money.CurrencyUnit currency)
      Specified by:
      setCurrency in interface com.broadleafcommerce.money.CurrencyConsumer
    • getOrderItemsWithDependentItems

      public List<OrderItem> getOrderItemsWithDependentItems()
    • getId

      public String getId()
      The context ID of the order.
      Returns:
      the context ID of the order
    • getCartId

      public String getCartId()
      The context ID of the original cart for this order.
      Returns:
      the context ID of the original cart for this order
    • getName

      public String getName()
      A unique name for the order, used for retrieval. This field is not displayed anywhere.
      Returns:
      a unique name for the order, used for retrieval
    • getStatus

      public String getStatus()
      The status of this order.
      Returns:
      The status of this order.
    • getApproverEmail

      public String getApproverEmail()
      The order approver's email address.

      This field is only needed for B2B orders to represent the order approver's email address. For B2C orders, we don't expect a value to be provided for this field.

      Returns:
      The order approver's email address.
    • getCustomerId

      public String getCustomerId()
      The ID of the customer that owns this order.
      Returns:
      The ID of the customer that owns this order.
    • getCustomerName

      public String getCustomerName()
      The name of the customer that owns this order.
      Returns:
      The name of the customer that owns this order.
    • getEmailAddress

      public String getEmailAddress()
      The customer's email address.
      Returns:
      The customer's email address.
    • getAccountId

      public String getAccountId()
      The ID of the account the account member belongs to.
      Returns:
      The ID of the account of the account member.
    • getRootAccountId

      public String getRootAccountId()
      The ID of the root account the account member belongs to.

      For example, if we have this account setup, rootAcct -> subAcct (child of rootAcct) -> subSubAcct (child of subAcct), this field would be rootAcct.

      Returns:
      The ID of the root account of the account member.
    • getAccountHierarchy

      public List<String> getAccountHierarchy()
      The hierarchy of accounts, from the root account to the account member's account.

      For example, if we have this account setup, rootAcct -> subAcct (child of rootAcct) -> subSubAcct (child of subAcct), this field would be [rootAcct, subAcct, subSubAcct]. This is useful to query all the orders that belong to the same non-root account and its sub-accounts.

      Returns:
      The hierarchy of accounts, from the root account to the account member's account.
    • getOrderNumber

      public String getOrderNumber()
      The unique number associated with this Order. Typically, this is generated and set on order submission. Used for record keeping and communicating with the customer instead of just using getId() since that exposes unwanted information about your database.
      Returns:
      The unique number associated with this Order.
    • getCartCreateDate

      public Instant getCartCreateDate()
      The date that the originating cart was first created.
      Returns:
      The date that the originating was first created.
    • getCheckoutRequestId

      public String getCheckoutRequestId()
      The id of the latest checkout request for the originating cart.

      This is typically the latest checkout request id if there were multiple checkout submissions for the cart.

      Returns:
      The id of the latest checkout request for the originating cart.
    • getSubmitDate

      public Instant getSubmitDate()
      The date that this order was submitted.
      Returns:
      The date that this order was submitted.
    • getLocale

      public Locale getLocale()
      The locale for this order. Used to determine what locale this order was in for translations and other location-based functionality.
      Returns:
      The locale code for this order.
    • getOrderPricing

      public OrderPricing getOrderPricing()
      Embedded container for all pricing information on this order.
      Returns:
      Embedded container for all pricing information on this order.
    • getPaymentDistributionDetails

      public List<PaymentDistributionDetail> getPaymentDistributionDetails()
      A list of PaymentDistributionDetails representing how this order's total is split across different payments.
      Returns:
      a list of PaymentDistributionDetails representing how this order's total is split across different payments
    • getOrderItems

      public List<OrderItem> getOrderItems()
      Items that are contained within this order. Typically represents a good or service that the customer is purchasing.
      Returns:
      Items for purchase that are contained within this order.
    • getAdjustments

      public List<com.broadleafcommerce.order.common.domain.Adjustment> getAdjustments()
      Adjustments to order pricing that were applied to OrderPricing.getSubtotal().
      Returns:
      Adjustments to order pricing that were applied to OrderPricing.getSubtotal().
    • getOfferCodes

      public List<String> getOfferCodes()
      A list of offer codes that were added to this order. Used to apply Adjustments to different aspects of the order.
      Returns:
      A list of offer codes that were added to this order.
    • getVouchers

      public List<com.broadleafcommerce.order.common.domain.Voucher> getVouchers()
      A list of Vouchers that this order is qualified for.
      Returns:
      A list of Vouchers that this order is qualified for.
    • getCampaignRefs

      public List<com.broadleafcommerce.order.common.domain.CampaignRef> getCampaignRefs()
      A list of campaign references that are attached to this order. Similar to getOfferCodes(), the CampaignRef.getCampaignTrackingId() can be used to apply Adjustments 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 order.
    • getAttributes

      public Map<String,Object> getAttributes()
      Miscellaneous attributes for this order.
      Returns:
      Miscellaneous attributes for this order.
    • getInternalAttributes

      public Map<String,Object> getInternalAttributes()
      Miscellaneous internal attributes for this item. Distinguished from getAttributes() 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 order's checkout.
      Returns:
      Miscellaneous internal attributes for this item.
    • getAttributeChoices

      public Map<String,com.broadleafcommerce.order.common.domain.AttributeChoiceValue> getAttributeChoices()
      Attribute choices for this order driven by its items' product options, where each key is the attributeName from an attribute choice.
      Returns:
      Attribute choices for this order driven by its items' product options, where each key is the attributeName from an attribute choice.
    • getContextState

      public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      getContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
      Returns:
      a subset of Tracking information to expose the context state for this object.
    • setId

      public void setId(String id)
      The context ID of the order.
      Parameters:
      id - the context ID of the order
    • setCartId

      public void setCartId(String cartId)
      The context ID of the original cart for this order.
      Parameters:
      id - the context ID of the original cart for this order
    • setName

      public void setName(String name)
      A unique name for the order, used for retrieval. This field is not displayed anywhere.
      Parameters:
      name - a unique name for the order, used for retrieval
    • setCartType

      public void setCartType(String cartType)
      The type of cart for this order.
      Parameters:
      cartType - The type of cart for this order.
      See Also:
    • setStatus

      public void setStatus(String status)
      The status of this order.
      Parameters:
      status - The status of this order.
    • setApproverEmail

      public void setApproverEmail(String approverEmail)
      The order approver's email address.

      This field is only needed for B2B orders to represent the order approver's email address. For B2C orders, we don't expect a value to be provided for this field.

      Parameters:
      approverEmail - The order approver's email address.
    • setCustomerId

      public void setCustomerId(String customerId)
      The ID of the customer that owns this order.
      Parameters:
      customerId - The ID of the customer that owns this order.
    • setCustomerName

      public void setCustomerName(String customerName)
      The name of the customer that owns this order.
      Parameters:
      customerName - The name of the customer that owns this order.
    • setEmailAddress

      public void setEmailAddress(String emailAddress)
      The customer's email address.
      Parameters:
      emailAddress - The customer's email address.
    • setAccountId

      public void setAccountId(String accountId)
      The ID of the account the account member belongs to.
      Parameters:
      accountId - The ID of the account of the account member.
    • setRootAccountId

      public void setRootAccountId(String rootAccountId)
      The ID of the root account the account member belongs to.

      For example, if we have this account setup, rootAcct -> subAcct (child of rootAcct) -> subSubAcct (child of subAcct), this field would be rootAcct.

      Parameters:
      rootAccountId - The ID of the root account of the account member.
    • setAccountHierarchy

      public void setAccountHierarchy(List<String> accountHierarchy)
      The hierarchy of accounts, from the root account to the account member's account.

      For example, if we have this account setup, rootAcct -> subAcct (child of rootAcct) -> subSubAcct (child of subAcct), this field would be [rootAcct, subAcct, subSubAcct]. This is useful to query all the orders that belong to the same non-root account and its sub-accounts.

      Parameters:
      accountHierarchy - The hierarchy of accounts, from the root account to the account member's account.
    • setOrderNumber

      public void setOrderNumber(String orderNumber)
      The unique number associated with this Order. Typically, this is generated and set on order submission. Used for record keeping and communicating with the customer instead of just using getId() since that exposes unwanted information about your database.
      Parameters:
      orderNumber - The unique number associated with this Order.
    • setCartCreateDate

      public void setCartCreateDate(Instant cartCreateDate)
      The date that the originating cart was first created.
      Parameters:
      cartCreateDate - The date that the originating cart was first created.
    • setCheckoutRequestId

      public void setCheckoutRequestId(String checkoutRequestId)
      The id of the latest checkout request for the originating cart.

      This is typically the latest checkout request id if there were multiple checkout submissions for the cart.

      Parameters:
      checkoutRequestId - The id of the latest checkout request for the originating cart.
    • setSubmitDate

      public void setSubmitDate(Instant submitDate)
      The date that this order was submitted.
      Parameters:
      submitDate - The date that this order was submitted.
    • setLocale

      public void setLocale(Locale locale)
      The locale for this order. Used to determine what locale this order was in for translations and other location-based functionality.
      Parameters:
      locale - The locale code for this order.
    • setOrderPricing

      public void setOrderPricing(OrderPricing orderPricing)
      Embedded container for all pricing information on this order.
      Parameters:
      orderPricing - Embedded container for all pricing information on this order.
    • setPaymentDistributionDetails

      public void setPaymentDistributionDetails(List<PaymentDistributionDetail> paymentDistributionDetails)
      A list of PaymentDistributionDetails representing how this order's total is split across different payments.
      Parameters:
      paymentDistributionDetails - a list of PaymentDistributionDetails representing how this order's total is split across different payments
    • setOrderItems

      public void setOrderItems(List<OrderItem> orderItems)
      Items that are contained within this order. Typically represents a good or service that the customer is purchasing.
      Parameters:
      orderItems - Items for purchase that are contained within this order.
    • setAdjustments

      public void setAdjustments(List<com.broadleafcommerce.order.common.domain.Adjustment> adjustments)
      Adjustments to order pricing that were applied to OrderPricing.getSubtotal().
      Parameters:
      adjustments - Adjustments to order pricing that were applied to OrderPricing.getSubtotal().
    • setOfferCodes

      public void setOfferCodes(List<String> offerCodes)
      A list of offer codes that were added to this order. Used to apply Adjustments to different aspects of the order.
      Parameters:
      offerCodes - A list of offer codes that were added to this order.
    • setVouchers

      public void setVouchers(List<com.broadleafcommerce.order.common.domain.Voucher> vouchers)
      A list of Vouchers that this order is qualified for.
      Parameters:
      vouchers - A list of Vouchers that this order is qualified for.
    • setCampaignRefs

      public void setCampaignRefs(List<com.broadleafcommerce.order.common.domain.CampaignRef> campaignRefs)
      A list of campaign references that are attached to this order. Similar to getOfferCodes(), the CampaignRef.getCampaignTrackingId() can be used to apply Adjustments 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 order.
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
      Miscellaneous attributes for this order.
      Parameters:
      attributes - Miscellaneous attributes for this order.
    • setInternalAttributes

      public void setInternalAttributes(Map<String,Object> internalAttributes)
      Miscellaneous internal attributes for this item. Distinguished from getAttributes() 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 order'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 order driven by its items' product options, where each key is the attributeName from an attribute choice.
      Parameters:
      attributeChoices - Attribute choices for this order driven by its items' product options, where each key is the attributeName from an attribute choice.
    • setContextState

      public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      setContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
      Parameters:
      contextState - a subset of Tracking information to expose the context state for this object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object