org.broadleafcommerce.core.order.domain
Interface Order

All Superinterfaces:
Serializable
All Known Implementing Classes:
NullOrderImpl, OrderImpl

public interface Order
extends Serializable

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 PaymentInfo objects. 5. Order shipping (e.g. fulfillment) are represented with Fulfillment objects.


Method Summary
 void addAddedOfferCode(OfferCode offerCode)
          Deprecated. 
 void addOfferCode(OfferCode addedOfferCode)
           
 void addOrderItem(OrderItem orderItem)
          Adds an OrderItem to the list of OrderItems already associated with this Order
 void assignOrderItemsFinalPrice()
          Assigns a final price to all the order items
 Money calculateSubTotal()
          Returns the sum of the item totals.
 boolean containsSku(Sku sku)
          Checks the DiscreteOrderItems in the cart and returns whether or not the given SKU was found.
 boolean finalizeItemPrices()
          Updates the averagePriceField for all order items.
 List<OfferCode> getAddedOfferCodes()
           
 Map<Offer,OfferInfo> getAdditionalOfferInformation()
           
 Auditable getAuditable()
          Gets the auditable associated with this Order instance which tracks changes made to this Order (creation/update)
 List<CandidateOrderOffer> getCandidateOrderOffers()
          Gets the Offers that could potentially apply to this Order.
 Money getCapturedTotal()
          Convenience method for determining how much of the order total has been captured.
 BroadleafCurrency getCurrency()
          The currency that the Order is priced in.
 Customer getCustomer()
          Gets the Customer for this Order.
 List<DiscreteOrderItem> getDiscreteOrderItems()
          Returns all of the OrderItems in this Order that are an instanceof DiscreteOrderItem.
 String getEmailAddress()
           
 Money getFulfillmentGroupAdjustmentsValue()
           
 List<FulfillmentGroup> getFulfillmentGroups()
          Gets the FulfillmentGroups associated with this Order.
 String getFulfillmentStatus()
           
 boolean getHasOrderAdjustments()
          Returns true if this item has order adjustments.
 Long getId()
           
 Money getItemAdjustmentsValue()
          Returns the discount value of all the applied item offers for this order.
 int getItemCount()
          This method returns the total number of items in this order.
 Locale getLocale()
           
 String getName()
          Gets the name of the order, mainly in order to support wishlists.
 List<OrderAdjustment> getOrderAdjustments()
          Returns a unmodifiable List of OrderAdjustment.
 Money getOrderAdjustmentsValue()
          Returns the discount value of all the applied order offers.
 Map<String,OrderAttribute> getOrderAttributes()
          A list of arbitrary attributes added to this order.
 List<OrderItem> getOrderItems()
          Gets all the OrderItems included in this Order
 String getOrderNumber()
          The unique number associated with this Order.
 List<PaymentInfo> getPaymentInfos()
          Gets all the PaymentInfos associated with this Order.
 Money getRemainingTotal()
          Convenience method for determining how much is left on the Order based on the payments that have already been applied.
 OrderStatus getStatus()
          Gets the status of the Order.
 Date getSubmitDate()
          Gets the date that this Order was submitted.
 Money getSubTotal()
          Returns the subtotal price for the order.
 Money getTotal()
          The grand total of this Order which includes all shipping costs and taxes, as well as any adjustments from promotions.
 Money getTotalAdjustmentsValue()
          Returns the total discount value for all applied item and order offers in the order.
 Money getTotalFulfillmentCharges()
          Gets the total fulfillment costs that should be charged for this Order.
 Money getTotalShipping()
           
 Money getTotalTax()
          Gets the total tax for this order, which is the sum of the taxes on all fulfillment groups.
 boolean hasCategoryItem(String categoryName)
          Determines if this Order has an item in the given category.
 void setAdditionalOfferInformation(Map<Offer,OfferInfo> additionalOfferInformation)
           
 void setAuditable(Auditable auditable)
           
 void setCandidateOrderOffers(List<CandidateOrderOffer> candidateOrderOffers)
          Sets the Offers that could potentially apply to this Order
 void setCurrency(BroadleafCurrency currency)
          Set the currency that the Order is priced in.
 void setCustomer(Customer customer)
          Sets the associated Customer for this Order.
 void setEmailAddress(String emailAddress)
           
 void setFulfillmentGroups(List<FulfillmentGroup> fulfillmentGroups)
           
 void setId(Long id)
           
 void setLocale(Locale locale)
           
 void setName(String name)
          Sets the name of the order in the context of a wishlist.
 void setOrderAttributes(Map<String,OrderAttribute> orderAttributes)
          Sets the map of order attributes.
 void setOrderItems(List<OrderItem> orderItems)
           
 void setOrderNumber(String orderNumber)
          Set the unique order number for this Order
 void setPaymentInfos(List<PaymentInfo> paymentInfos)
          Sets the various payment types associated with this Order
 void setStatus(OrderStatus status)
          Sets the status of the Order
 void setSubmitDate(Date submitDate)
          Set the date that this Order was submitted.
 void setSubTotal(Money subTotal)
          Sets the subtotal price for the order.
 void setTotal(Money orderTotal)
          Used in TotalActivity to set the grand total of this Order.
 void setTotalFulfillmentCharges(Money totalFulfillmentCharges)
          Set the total fulfillment cost of this Order.
 void setTotalShipping(Money totalShipping)
          Deprecated. - Use setTotalFulfillmentCharges(Money) instead.
 void setTotalTax(Money totalTax)
          Sets the total tax of this order, which is the sum of the taxes on all fulfillment groups.
 boolean updatePrices()
          Updates all of the prices of the OrderItems in this Order
 

Method Detail

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

Auditable getAuditable()
Gets the auditable associated with this Order instance which tracks changes made to this Order (creation/update)

Returns:

setAuditable

void setAuditable(Auditable auditable)

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

void setSubTotal(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

Money calculateSubTotal()
Returns the sum of the item totals.

Returns:

getTotal

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(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

getRemainingTotal

Money getRemainingTotal()
Convenience method for determining how much is left on the Order based on the payments that have already been applied. This takes getTotal() and subtracts the sum of all the PaymentInfos associated with this Order. Note that if an order has been fully paid for, this method will return zero.

Returns:
getTotal() minus the PaymentInfo.getAmount() for each PaymentInfo on this Order

getCapturedTotal

Money getCapturedTotal()
Convenience method for determining how much of the order total has been captured. This takes the PaymentInfos and checks the PaymentInfoDetailType for captured records.

Returns:

getCustomer

Customer getCustomer()
Gets the Customer for this Order.

Returns:

setCustomer

void setCustomer(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)

setCandidateOrderOffers

void setCandidateOrderOffers(List<CandidateOrderOffer> candidateOrderOffers)
Sets the Offers that could potentially apply to this Order

Parameters:
candidateOrderOffers -

getCandidateOrderOffers

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

Returns:

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

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(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:
the - total tax for this order

getTotalShipping

Money getTotalShipping()

setTotalShipping

void setTotalShipping(Money totalShipping)
Deprecated. - Use setTotalFulfillmentCharges(Money) instead.

Parameters:
totalShipping -

getTotalFulfillmentCharges

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(Money totalFulfillmentCharges)
Set the total fulfillment cost of this Order. Used in the FulfillmentGroupPricingActivity after the cost of each FulfillmentGroup has been calculated.

Parameters:
totalShipping -

getPaymentInfos

List<PaymentInfo> getPaymentInfos()
Gets all the PaymentInfos associated with this Order. An Order can have many PaymentInfos 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 PaymentInfos associated with this Order.

setPaymentInfos

void setPaymentInfos(List<PaymentInfo> paymentInfos)
Sets the various payment types associated with this Order

Parameters:
paymentInfos -

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.
See Also:
OrderItem#isInCategory(String)}

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

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:

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

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

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.

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

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.
See Also:
OrderItem#updatePrices()}

finalizeItemPrices

boolean finalizeItemPrices()
Updates the averagePriceField for all order items.

Returns:

getFulfillmentGroupAdjustmentsValue

Money getFulfillmentGroupAdjustmentsValue()

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

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(BroadleafCurrency currency)
Set the currency that the Order is priced in.

Parameters:
currency -

getLocale

Locale getLocale()

setLocale

void setLocale(Locale locale)

getHasOrderAdjustments

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

Returns:


Copyright © 2013. All Rights Reserved.