com.softslate.commerce.businessobjects.order
Interface CartProcessor

All Superinterfaces:
BusinessObject
All Known Implementing Classes:
BasicCartProcessor

public interface CartProcessor
extends BusinessObject

Interface for business logic methods having to do with a user's cart.

The Struts layer creates instances implementing CartProcessor when a user adds items to his or her cart or edits items. It is also used to handle processing during checkout.

CartProcessor is similar in intention to OrderProcessor. OrderProcessor contains more generic code relating to orders, while CartProcessor contains code specific to manuipulating a user's cart.

When the application needs to create an instance that implements CartProcessor, BusinessObjectFactory finds the name of the Java class to instantiate from the "cartProcessorImplementer" setting in the npcSetting database table.

The default "cartProcessorImplementer" is BasicCartProcessor.

Author:
David Tobey

Method Summary
 void initializeCart()
          Initializes a user's cart.
 java.util.Map processAddItems(java.util.Map parameters)
          Processes a request to add items to a user's cart.
 java.util.Map processCheckoutAddresses(java.util.Map parameters)
          Processes a request to add address information to a user's cart.
 java.util.Map processEditItem(java.util.Map parameters)
          Processes a request to edit a given item in a user's cart.
 java.util.Map processOrderComplete(java.util.Map parameters)
          Handles processing at the very end of the checkout process, after payments have been processed.
 java.util.Map processRemoveItem(OrderItem orderItem)
          Removes a given OrderItem from the user's cart, updating the cart totals in the process.
 
Methods inherited from interface com.softslate.commerce.businessobjects.core.BusinessObject
initialize
 

Method Detail

processAddItems

public java.util.Map processAddItems(java.util.Map parameters)
                              throws java.lang.Exception
Processes a request to add items to a user's cart. If the user's cart has not been initialized, this method initializes it first by calling initializeCart() to create a new instance of Order in the User instance for the user. It then adds an OrderDelivery instance under the Order and OrderItem instances under the OrderDelivery.

The Map must have the following keys: orderProductCodes (aString[] holding the codes of the product(s) to add); orderProductQuantities (aString[] holding the quantities of the product(s) to add); and orderAttributes (aHashMap holding attribute keys and values, where the attribute keys are in the form of 'productCode|attributeCode').

Parameters:
parameters - A Map representing the items and attributes being added to the user's cart.
Returns:
A Map representing the results of the processing.
Throws:
java.lang.Exception

processEditItem

public java.util.Map processEditItem(java.util.Map parameters)
                              throws java.lang.Exception
Processes a request to edit a given item in a user's cart. The incoming Map must have keys named orderItem (which identifies the order item being edited) and orderProductQuantities (which holds the new quantity for the order item).

Parameters:
parameters - A Map identifying the item being edited and specifying the item's new properties.
Returns:
A Map representing the results of the processing.
Throws:
java.lang.Exception

processRemoveItem

public java.util.Map processRemoveItem(OrderItem orderItem)
                                throws java.lang.Exception
Removes a given OrderItem from the user's cart, updating the cart totals in the process.

Parameters:
orderItem - The OrderItem being removed.
Throws:
java.lang.Exception

initializeCart

public void initializeCart()
                    throws java.lang.Exception
Initializes a user's cart. Creates new instances of Order and OrderDelivery representing a user's cart. Sets the current User object's setOrder(Order order) with the newly created Order.

Throws:
java.lang.Exception

processCheckoutAddresses

public java.util.Map processCheckoutAddresses(java.util.Map parameters)
                                       throws java.lang.Exception
Processes a request to add address information to a user's cart. Originates usually from the checkout process in the Struts layer.

Parameters:
parameters - A Map representing the address information of the current user.
Throws:
java.lang.Exception

processOrderComplete

public java.util.Map processOrderComplete(java.util.Map parameters)
                                   throws java.lang.Exception
Handles processing at the very end of the checkout process, after payments have been processed. Sets the user's order with a status of "Received" and assigns an order number to the order. The "Received" status is given to all orders that have been successfully completed by the user. In other words, orders whose payments succeeded.

The order number is an integer given to each completed order, starting at the "orderNumberFloor" database setting (whose default is 1,000).

Returns:
A Map representing the results of the processing.
Throws:
java.lang.Exception


Copyright © SoftSlate, Inc. 2003–2005