Interface Order
- All Superinterfaces:
MultiTenantCloneable<Order>,Serializable
- All Known Implementing Classes:
NullOrderImpl,OrderImpl
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 Summary
Modifier and TypeMethodDescriptionvoidaddAddedOfferCode(OfferCode offerCode) Deprecated.voidaddOfferCode(OfferCode addedOfferCode) voidaddOrderItem(OrderItem orderItem) voidAssigns a final price to all the order itemsReturns the sum of the item totals.booleancontainsSku(Sku sku) Checks the DiscreteOrderItems in the cart and returns whether or not the given SKU was found.booleanUpdates the averagePriceField for all order items.Returns a List of Adjustment originating from FUTURE_CREDIT Offers.Gets the auditable associated with this Order instance which tracks changes made to this Order (creation/update)This method returns null from the default implementation.The currency that theOrderis priced in.Gets theFulfillmentGroups associated with thisOrder.Returns the discount value of the applied future credit fulfillment offers for this order.Returns the discount value of the applied future credit item offers for this order.Returns a List of OrderAdjustment originating from FUTURE_CREDIT Offers.Returns the discount value of the applied future credit order offers originating.booleanReturns true if this item has order adjustments.getId()Returns the discount value of all the applied item offers for this order.intThis method returns the total number of items in this order.getName()Gets the name of the order, mainly in order to support wishlists.Returns a unmodifiable List of OrderAdjustment.Returns the discount value of all the applied order offers.A list of arbitrary attributes added to this order.The unique number associated with thisOrder.Gets all theOrderPayments associated with thisOrder.Gets the status of the Order.Gets the date that thisOrderwas submitted.Returns the subtotal price for the order.getTotal()The grand total of thisOrderwhich includes all shipping costs and taxes, as well as any adjustments from promotions.Returns the total discount value for all applied item and order offers in the order.This is getTotal() minus the sum of all theOrderPaymentalready applied to this order.Gets the total fulfillment costs that should be charged for thisOrder.Returns the total discount value for applied item, order, and fulfillment offers in the order originating from FUTURE_CREDIT Offers.Gets the total tax for this order, which is the sum of the taxes on all fulfillment groups.booleanhasCategoryItem(String categoryName) Determines if thisOrderhas an item in the given category.voidsetAdditionalOfferInformation(Map<Offer, OfferInfo> additionalOfferInformation) voidsetAuditable(Auditable auditable) voidsetCandidateOrderOffers(List<CandidateOrderOffer> candidateOrderOffers) voidsetCurrency(BroadleafCurrency currency) Set the currency that theOrderis priced in.voidsetCustomer(Customer customer) Sets the associatedCustomerfor this Order.voidsetEmailAddress(String emailAddress) voidsetFulfillmentGroups(List<FulfillmentGroup> fulfillmentGroups) voidvoidvoidSets the name of the order in the context of a wishlist.voidsetOrderAttributes(Map<String, OrderAttribute> orderAttributes) Sets the map of order attributes.voidsetOrderItems(List<OrderItem> orderItems) voidsetOrderMessages(List<ActivityMessageDTO> orderMessages) voidsetOrderNumber(String orderNumber) Set the unique order number for thisOrdervoidsetPayments(List<OrderPayment> payments) Sets the various payment types associated with thisOrdervoidsetStatus(OrderStatus status) Sets the status of the OrdervoidsetSubmitDate(Date submitDate) Set the date that thisOrderwas submitted.voidsetSubTotal(Money subTotal) Sets the subtotal price for the order.voidsetTaxOverride(Boolean taxOverride) Sets whether or not to override the tax calculationvoidUsed inTotalActivityto set the grand total of thisOrder.voidsetTotalFulfillmentCharges(Money totalFulfillmentCharges) Set the total fulfillment cost of thisOrder.voidsetTotalShipping(Money totalShipping) Deprecated.voidsetTotalTax(Money totalTax) Sets the total tax of this order, which is the sum of the taxes on all fulfillment groups.booleanMethods inherited from interface org.broadleafcommerce.common.copy.MultiTenantCloneable
createOrRetrieveCopyInstance
-
Method Details
-
getId
Long getId() -
setId
-
getName
String getName()Gets the name of the order, mainly in order to support wishlists.- Returns:
- the name of the order
-
setName
Sets the name of the order in the context of a wishlist. In this fashion, aCustomercan have multiple wishlists like "Christmas" or "Gaming Computer" etc.- Parameters:
name-
-
getAuditable
Auditable getAuditable()Gets the auditable associated with this Order instance which tracks changes made to this Order (creation/update)- Returns:
-
setAuditable
-
getSubTotal
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
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
Money calculateSubTotal()Returns the sum of the item totals.- Returns:
-
getTotal
Money getTotal()The grand total of thisOrderwhich includes all shipping costs and taxes, as well as any adjustments from promotions.- Returns:
- the grand total price of this
Order
-
setTotal
Used inTotalActivityto set the grand total of thisOrder. This includes the prices of all of theOrderItems as well as any taxes, fees, shipping and adjustments for all 3.- Parameters:
orderTotal- the total cost of thisOrder
-
getTotalAfterAppliedPayments
Money getTotalAfterAppliedPayments()This is getTotal() minus the sum of all theOrderPaymentalready 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,AdjustOrderPaymentsActivitywill 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
OrderPaymentdoes 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
Customer getCustomer()- Returns:
-
setCustomer
Sets the associatedCustomerfor this Order.- Parameters:
customer-
-
getStatus
OrderStatus getStatus()Gets the status of the Order.- Returns:
-
setStatus
Sets the status of the Order- Parameters:
status-
-
getOrderItems
- Returns:
-
setOrderItems
-
addOrderItem
-
getFulfillmentGroups
List<FulfillmentGroup> getFulfillmentGroups()Gets theFulfillmentGroups associated with thisOrder. AnOrdercan have manyFulfillmentGroups associated with it in order to support multi-address (and multi-type) shipping.- Returns:
- the
FulfillmentGroups associated with thisOrder
-
setFulfillmentGroups
-
getCandidateOrderOffers
List<CandidateOrderOffer> getCandidateOrderOffers()- Returns:
-
setCandidateOrderOffers
- Parameters:
candidateOrderOffers-
-
getSubmitDate
Date getSubmitDate()Gets the date that thisOrderwas submitted. Note that if this date is non-null, then the following should also be true:getStatus()should returnOrderStatus.SUBMITTEDgetOrderNumber()should return a non-null value
- Returns:
-
setSubmitDate
Set the date that thisOrderwas 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 thisOrderwas submitted.
-
getTotalTax
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
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
Money getTotalShipping() -
setTotalShipping
Deprecated.- UsesetTotalFulfillmentCharges(Money)instead.- Parameters:
totalShipping-
-
getTotalFulfillmentCharges
Money getTotalFulfillmentCharges()Gets the total fulfillment costs that should be charged for thisOrder. This value should be equivalent to the summation ofFulfillmentGroup.getTotal()for eachFulfillmentGroupassociated with thisOrder- Returns:
- the total fulfillment cost of this
Order
-
setTotalFulfillmentCharges
Set the total fulfillment cost of thisOrder. Used in theFulfillmentGroupPricingActivityafter the cost of eachFulfillmentGrouphas been calculated.- Parameters:
totalFulfillmentCharges-
-
getPayments
List<OrderPayment> getPayments()Gets all theOrderPayments associated with thisOrder. AnOrdercan have manyOrderPayments associated with it to support things like paying with multiple cards or perhaps paying some of thisOrderwith a gift card and some with a credit card.- Returns:
- the
OrderPayments associated with thisOrder.
-
setPayments
Sets the various payment types associated with thisOrder- Parameters:
payments-
-
hasCategoryItem
Determines if thisOrderhas an item in the given category.- Parameters:
categoryName- theCategory.getName()to check- Returns:
- true if at least one
OrderItemis 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 theOrderItems in thisOrderthat are an instanceofDiscreteOrderItem. This will also go into eachBundleOrderItem(if there are any) and return all of theBundleOrderItem.getDiscreteOrderItems()from each of those as well.- Returns:
-
getNonDiscreteOrderItems
Returns all of theOrderItems in thisOrderthat are an instanceofOrderItemImpl. This will return all of the order items that do not have any reference to a product or sku- Returns:
-
containsSku
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 theDiscreteOrderItems from {linkBundleOrderItem.getDiscreteOrderItems()- Parameters:
sku- The sku to check for- Returns:
- whether or not the given SKU exists in the cart
-
getAddedOfferCodes
-
getFulfillmentStatus
String getFulfillmentStatus() -
getOrderNumber
String getOrderNumber()The unique number associated with thisOrder. Generally preferred to use instead of just usinggetId()since that exposes unwanted information about your database.- Returns:
- the unique order number for this
Order
-
setOrderNumber
Set the unique order number for thisOrder- Parameters:
orderNumber-
-
getEmailAddress
String getEmailAddress() -
setEmailAddress
-
getAdditionalOfferInformation
-
setAdditionalOfferInformation
-
getItemAdjustmentsValue
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
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
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
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
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
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()- Returns:
- true if at least 1
OrderItemreturned true fromOrderItem#updatePrices, false otherwise.
-
finalizeItemPrices
boolean finalizeItemPrices()Updates the averagePriceField for all order items.- Returns:
-
getFulfillmentGroupAdjustmentsValue
Money getFulfillmentGroupAdjustmentsValue() -
getFutureCreditFulfillmentGroupAdjustmentsValue
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
-
addAddedOfferCode
Deprecated. -
getOrderAttributes
Map<String,OrderAttribute> getOrderAttributes()A list of arbitrary attributes added to this order. -
setOrderAttributes
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
BroadleafCurrency getCurrency()The currency that theOrderis priced in. Note that this is only onOrdersince all of the other entities that are related (likeFulfillmentGroupandOrderItemhave a link back to here. This also has the side effect that anOrdercan only be priced in a single currency.- Returns:
-
setCurrency
Set the currency that theOrderis priced in.- Parameters:
currency-
-
getLocale
Locale getLocale() -
setLocale
-
getHasOrderAdjustments
boolean getHasOrderAdjustments()Returns true if this item has order adjustments.- Returns:
-
getOrderMessages
List<ActivityMessageDTO> getOrderMessages() -
setOrderMessages
-
getTaxOverride
Boolean getTaxOverride()- Returns:
- whether or not to override the tax calculation
-
setTaxOverride
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()
-
setTotalFulfillmentCharges(Money)instead.