Interface Order

All Superinterfaces:
org.broadleafcommerce.common.copy.MultiTenantCloneable<Order>, Serializable
All Known Implementing Classes:
NullOrderImpl, OrderImpl

public interface Order extends Serializable, org.broadleafcommerce.common.copy.MultiTenantCloneable<Order>
Defines an order in Broadleaf. There are several key items to be aware of with the BLC Order.

1. Carts are also Orders that are in a Pending status

2. Wishlists (and similar) are "NamedOrders"

3. Orders have several price related methods that are useful when displaying totals on the cart. 3a. getSubTotal() : The total of all order items and their adjustments exclusive of taxes 3b. getOrderAdjustmentsValue() : The total of all order adjustments 3c. getTotalTax() : The total taxes being charged for the order 3d. getTotal() : The order total (equivalent of getSubTotal() - getOrderAdjustmentsValue() + getTotalTax())

4. Order payments are represented with OrderPayment objects.

5. Order shipping (e.g. fulfillment) are represented with Fulfillment objects.

  • Method Details

    • getId

      Long getId()
    • setId

      void setId(Long id)
    • getName

      String getName()
      Gets the name of the order, mainly in order to support wishlists.
      Returns:
      the name of the order
    • setName

      void setName(String name)
      Sets the name of the order in the context of a wishlist. In this fashion, a Customer can have multiple wishlists like "Christmas" or "Gaming Computer" etc.
      Parameters:
      name -
    • getAuditable

      org.broadleafcommerce.common.audit.Auditable getAuditable()
      Gets the auditable associated with this Order instance which tracks changes made to this Order (creation/update)
      Returns:
    • setAuditable

      void setAuditable(org.broadleafcommerce.common.audit.Auditable auditable)
    • getSubTotal

      org.broadleafcommerce.common.money.Money getSubTotal()
      Returns the subtotal price for the order. The subtotal price is the price of all order items with item offers applied. The subtotal does not take into account the order promotions, shipping costs or any taxes that apply to this order.
      Returns:
      the total item price with offers applied
    • setSubTotal

      void setSubTotal(org.broadleafcommerce.common.money.Money subTotal)
      Sets the subtotal price for the order. The subtotal price is the price of all order items with item offers applied. The subtotal does not take into account the order offers or any taxes that apply to this order.
      Parameters:
      subTotal -
    • assignOrderItemsFinalPrice

      void assignOrderItemsFinalPrice()
      Assigns a final price to all the order items
    • calculateSubTotal

      org.broadleafcommerce.common.money.Money calculateSubTotal()
      Returns the sum of the item totals.
      Returns:
    • getTotal

      org.broadleafcommerce.common.money.Money getTotal()
      The grand total of this Order which includes all shipping costs and taxes, as well as any adjustments from promotions.
      Returns:
      the grand total price of this Order
    • setTotal

      void setTotal(org.broadleafcommerce.common.money.Money orderTotal)
      Used in TotalActivity to set the grand total of this Order. This includes the prices of all of the OrderItems as well as any taxes, fees, shipping and adjustments for all 3.
      Parameters:
      orderTotal - the total cost of this Order
    • getTotalAfterAppliedPayments

      org.broadleafcommerce.common.money.Money getTotalAfterAppliedPayments()
      This is getTotal() minus the sum of all the OrderPayment already applied to this order. An applied payment can be of any type that does NOT have to be the final payment on the order. In this implementation, THIRD_PARTY_ACCOUNT and CREDIT_CARD type payments must be sent to the gateway as the last step in the checkout process and will NOT be considered an applied payment. Since, these types have to be the last payment applied, AdjustOrderPaymentsActivity will adjust the value of the payment based on what has already been applied to the order.

      For example, Gift Cards and Account Credit can be applied BEFORE a final payment (e.g. most Credit Card Gateways) is applied. This OrderPayment does not necessarily have to be confirmed (i.e. captured), as it will happen on callback of the final payment and will be captured in the checkout workflow.

      This method is used in cases where you need to determine the final amount to send to the gateways of what is left on the order minus what has already been applied.

      Returns:
      the total price minus any payments that have been applied to this order already.
    • getCustomer

      org.broadleafcommerce.profile.core.domain.Customer getCustomer()
      Gets the Customer for this Order.
      Returns:
    • setCustomer

      void setCustomer(org.broadleafcommerce.profile.core.domain.Customer customer)
      Sets the associated Customer for this Order.
      Parameters:
      customer -
    • getStatus

      OrderStatus getStatus()
      Gets the status of the Order.
      Returns:
    • setStatus

      void setStatus(OrderStatus status)
      Sets the status of the Order
      Parameters:
      status -
    • getOrderItems

      List<OrderItem> getOrderItems()
      Gets all the OrderItems included in this Order
      Returns:
    • setOrderItems

      void setOrderItems(List<OrderItem> orderItems)
    • addOrderItem

      void addOrderItem(OrderItem orderItem)
      Adds an OrderItem to the list of OrderItems already associated with this Order
      Parameters:
      orderItem - the OrderItem to add to this Order
    • getFulfillmentGroups

      List<FulfillmentGroup> getFulfillmentGroups()
      Gets the FulfillmentGroups associated with this Order. An Order can have many FulfillmentGroups associated with it in order to support multi-address (and multi-type) shipping.
      Returns:
      the FulfillmentGroups associated with this Order
    • setFulfillmentGroups

      void setFulfillmentGroups(List<FulfillmentGroup> fulfillmentGroups)
    • getCandidateOrderOffers

      List<CandidateOrderOffer> getCandidateOrderOffers()
      Gets the Offers that could potentially apply to this Order. Used in the promotion engine.
      Returns:
    • setCandidateOrderOffers

      void setCandidateOrderOffers(List<CandidateOrderOffer> candidateOrderOffers)
      Sets the Offers that could potentially apply to this Order
      Parameters:
      candidateOrderOffers -
    • getSubmitDate

      Date getSubmitDate()
      Gets the date that this Order was submitted. Note that if this date is non-null, then the following should also be true:
      Returns:
    • setSubmitDate

      void setSubmitDate(Date submitDate)
      Set the date that this Order was submitted. Used in the blCheckoutWorkflow as the last step after everything else has been completed (payments charged, integration systems notified, etc).
      Parameters:
      submitDate - the date that this Order was submitted.
    • getTotalTax

      org.broadleafcommerce.common.money.Money getTotalTax()
      Gets the total tax for this order, which is the sum of the taxes on all fulfillment groups. This total is calculated in the TotalActivity stage of the pricing workflow.
      Returns:
      the total tax for the order
    • setTotalTax

      void setTotalTax(org.broadleafcommerce.common.money.Money totalTax)
      Sets the total tax of this order, which is the sum of the taxes on all fulfillment groups. This total should only be set during the TotalActivity stage of the pricing workflow.
      Parameters:
      totalTax - the total tax for this order
    • getTotalShipping

      org.broadleafcommerce.common.money.Money getTotalShipping()
    • setTotalShipping

      @Deprecated void setTotalShipping(org.broadleafcommerce.common.money.Money totalShipping)
      Deprecated.
      Parameters:
      totalShipping -
    • getTotalFulfillmentCharges

      org.broadleafcommerce.common.money.Money getTotalFulfillmentCharges()
      Gets the total fulfillment costs that should be charged for this Order. This value should be equivalent to the summation of FulfillmentGroup.getTotal() for each FulfillmentGroup associated with this Order
      Returns:
      the total fulfillment cost of this Order
    • setTotalFulfillmentCharges

      void setTotalFulfillmentCharges(org.broadleafcommerce.common.money.Money totalFulfillmentCharges)
      Set the total fulfillment cost of this Order. Used in the FulfillmentGroupPricingActivity after the cost of each FulfillmentGroup has been calculated.
      Parameters:
      totalFulfillmentCharges -
    • getPayments

      List<OrderPayment> getPayments()
      Gets all the OrderPayments associated with this Order. An Order can have many OrderPayments associated with it to support things like paying with multiple cards or perhaps paying some of this Order with a gift card and some with a credit card.
      Returns:
      the OrderPayments associated with this Order.
    • setPayments

      void setPayments(List<OrderPayment> payments)
      Sets the various payment types associated with this Order
      Parameters:
      payments -
    • hasCategoryItem

      boolean hasCategoryItem(String categoryName)
      Determines if this Order has an item in the given category.
      Parameters:
      categoryName - the Category.getName() to check
      Returns:
      true if at least one OrderItem is in the given category, false otherwise.
    • getOrderAdjustments

      List<OrderAdjustment> getOrderAdjustments()
      Returns a unmodifiable List of OrderAdjustment. To modify the List of OrderAdjustment, please use the addOrderAdjustments or removeAllOrderAdjustments methods.
      Returns:
      a unmodifiable List of OrderItemAdjustment
    • getFutureCreditOrderAdjustments

      List<OrderAdjustment> getFutureCreditOrderAdjustments()
      Returns a List of OrderAdjustment originating from FUTURE_CREDIT Offers.

      See Offer.getAdjustmentType() for more info on future credit

      Returns:
      a List of OrderItemAdjustment
    • getAllFutureCreditAdjustments

      List<Adjustment> getAllFutureCreditAdjustments()
      Returns a List of Adjustment originating from FUTURE_CREDIT Offers. This is obtained from the Order, OrderItem, and FulfillmentGroup levels.

      See Offer.getAdjustmentType() for more info on future credit

      Returns:
      a List of OrderItemAdjustment
    • getDiscreteOrderItems

      List<DiscreteOrderItem> getDiscreteOrderItems()
      Returns all of the OrderItems in this Order that are an instanceof DiscreteOrderItem. This will also go into each BundleOrderItem (if there are any) and return all of the BundleOrderItem.getDiscreteOrderItems() from each of those as well.
      Returns:
    • getNonDiscreteOrderItems

      List<OrderItem> getNonDiscreteOrderItems()
      Returns all of the OrderItems in this Order that are an instanceof OrderItemImpl. This will return all of the order items that do not have any reference to a product or sku
      Returns:
    • containsSku

      boolean containsSku(Sku sku)
      Checks the DiscreteOrderItems in the cart and returns whether or not the given SKU was found. The equality of the SKUs is based on the .equals() method in SkuImpl. This includes checking the DiscreteOrderItems from {link BundleOrderItem.getDiscreteOrderItems()
      Parameters:
      sku - The sku to check for
      Returns:
      whether or not the given SKU exists in the cart
    • getAddedOfferCodes

      List<OfferCode> getAddedOfferCodes()
    • getFulfillmentStatus

      String getFulfillmentStatus()
    • getOrderNumber

      String getOrderNumber()
      The unique number associated with this Order. Generally preferred to use instead of just using getId() since that exposes unwanted information about your database.
      Returns:
      the unique order number for this Order
    • setOrderNumber

      void setOrderNumber(String orderNumber)
      Set the unique order number for this Order
      Parameters:
      orderNumber -
    • getEmailAddress

      String getEmailAddress()
    • setEmailAddress

      void setEmailAddress(String emailAddress)
    • getAdditionalOfferInformation

      Map<Offer,OfferInfo> getAdditionalOfferInformation()
    • setAdditionalOfferInformation

      void setAdditionalOfferInformation(Map<Offer,OfferInfo> additionalOfferInformation)
    • getItemAdjustmentsValue

      org.broadleafcommerce.common.money.Money getItemAdjustmentsValue()
      Returns the discount value of all the applied item offers for this order. This value is already deducted from the order subTotal.
      Returns:
      the discount value of all the applied item offers for this order
    • getFutureCreditItemAdjustmentsValue

      org.broadleafcommerce.common.money.Money getFutureCreditItemAdjustmentsValue()
      Returns the discount value of the applied future credit item offers for this order.

      See Offer.getAdjustmentType() for more info on future credit

      Returns:
      the discount value of the applied item offers for this order
    • getOrderAdjustmentsValue

      org.broadleafcommerce.common.money.Money getOrderAdjustmentsValue()
      Returns the discount value of all the applied order offers. The value returned from this method should be subtracted from the getSubTotal() to get the order price with all item and order offers applied.
      Returns:
      the discount value of all applied order offers.
    • getFutureCreditOrderAdjustmentsValue

      org.broadleafcommerce.common.money.Money getFutureCreditOrderAdjustmentsValue()
      Returns the discount value of the applied future credit order offers originating.

      See Offer.getAdjustmentType() for more info on future credit

      Returns:
      the discount value of applied order offers.
    • getTotalAdjustmentsValue

      org.broadleafcommerce.common.money.Money getTotalAdjustmentsValue()
      Returns the total discount value for all applied item and order offers in the order. The return value should not be used with getSubTotal() to calculate the final price, since getSubTotal() already takes into account the applied item offers.
      Returns:
      the total discount of all applied item and order offers
    • getTotalFutureCreditAdjustmentsValue

      org.broadleafcommerce.common.money.Money getTotalFutureCreditAdjustmentsValue()
      Returns the total discount value for applied item, order, and fulfillment offers in the order originating from FUTURE_CREDIT Offers. This should be used to credit the customer after the order has been placed.

      See Offer.getAdjustmentType() for more info on future credit

      Returns:
      the total discount of applied item, order, and fulfillment offers
    • updatePrices

      boolean updatePrices()
      Updates all of the prices of the OrderItems in this Order
      Returns:
      true if at least 1 OrderItem returned true from OrderItem#updatePrices, false otherwise.
    • finalizeItemPrices

      boolean finalizeItemPrices()
      Updates the averagePriceField for all order items.
      Returns:
    • getFulfillmentGroupAdjustmentsValue

      org.broadleafcommerce.common.money.Money getFulfillmentGroupAdjustmentsValue()
    • getFutureCreditFulfillmentGroupAdjustmentsValue

      org.broadleafcommerce.common.money.Money getFutureCreditFulfillmentGroupAdjustmentsValue()
      Returns the discount value of the applied future credit fulfillment offers for this order.

      See Offer.getAdjustmentType() for more info on future credit

      Returns:
      the discount value of the applied future credit fulfillment offers for this order.
    • addOfferCode

      void addOfferCode(OfferCode addedOfferCode)
    • addAddedOfferCode

      @Deprecated void addAddedOfferCode(OfferCode offerCode)
      Deprecated.
    • getOrderAttributes

      Map<String,OrderAttribute> getOrderAttributes()
      A list of arbitrary attributes added to this order.
    • setOrderAttributes

      void setOrderAttributes(Map<String,OrderAttribute> orderAttributes)
      Sets the map of order attributes.
      Parameters:
      orderAttributes -
    • getItemCount

      int getItemCount()
      This method returns the total number of items in this order. It iterates through all of the discrete order items and sums up the quantity. This method is useful for display to the customer the current number of "physical" items in the cart
      Returns:
      the number of items in the order
    • getCurrency

      org.broadleafcommerce.common.currency.domain.BroadleafCurrency getCurrency()
      The currency that the Order is priced in. Note that this is only on Order since all of the other entities that are related (like FulfillmentGroup and OrderItem have a link back to here. This also has the side effect that an Order can only be priced in a single currency.
      Returns:
    • setCurrency

      void setCurrency(org.broadleafcommerce.common.currency.domain.BroadleafCurrency currency)
      Set the currency that the Order is priced in.
      Parameters:
      currency -
    • getLocale

      org.broadleafcommerce.common.locale.domain.Locale getLocale()
    • setLocale

      void setLocale(org.broadleafcommerce.common.locale.domain.Locale locale)
    • getHasOrderAdjustments

      boolean getHasOrderAdjustments()
      Returns true if this item has order adjustments.
      Returns:
    • getOrderMessages

      List<ActivityMessageDTO> getOrderMessages()
    • setOrderMessages

      void setOrderMessages(List<ActivityMessageDTO> orderMessages)
    • getTaxOverride

      Boolean getTaxOverride()
      Returns:
      whether or not to override the tax calculation
    • setTaxOverride

      void setTaxOverride(Boolean taxOverride)
      Sets whether or not to override the tax calculation
      Parameters:
      taxOverride -
    • getBroadleafAccountId

      Long getBroadleafAccountId()
      This method returns null from the default implementation. The Broadleaf Account module weaves in an implementation that returns the account id associated with the order.

      This method is used by the Broadleaf Offer engine to allow offers to be restricted so that a given account can only use the offer a max number of times.

    • hasValidationErrors

      Boolean hasValidationErrors()