|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softslate.commerce.businessobjects.core.BaseBusinessObject com.softslate.commerce.businessobjects.core.BaseBusinessProcessor com.softslate.commerce.businessobjects.order.BasicCartProcessor
public class BasicCartProcessor
Processes business logic having to do with a user's cart.
BasicCartProcessor
is the default implementation of the
CartProcessor
interface for the application.
CartProcessor
Field Summary | |
---|---|
(package private) static java.lang.String |
addItemStatus
|
(package private) static java.lang.String |
addressAddedStatus
|
(package private) static java.lang.String |
corruptedStatus
|
(package private) static java.lang.String |
initializedStatus
|
(package private) static org.apache.commons.logging.Log |
log
|
(package private) static java.lang.String |
pendingStatus
|
(package private) static java.lang.String |
receivedStatus
|
Constructor Summary | |
---|---|
BasicCartProcessor()
|
Method Summary | |
---|---|
java.lang.String |
getOrderAttribute(java.util.Map parameters,
java.lang.String productCode,
java.lang.String attributeCode,
int index)
Retrieves the value submitted for an attribute of a given product, as part of a request to add or edit an item in the user's cart. |
int |
getOrderItemQuantity(java.util.Map parameters,
int index)
Looks up the submitted quantity of a given product contained in a request to add or edit a user's cart item. |
void |
initializeCart()
Initializes a user's cart. |
java.util.Map |
postProcessAddItems(java.util.Collection newOrderItems)
|
java.util.Map |
processAddItems(java.util.Collection newOrderItems)
Given a Collection of initialized OrderItem
objects, adds the items to the 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. |
void |
processItemAttribute(OrderItem orderItem,
Attribute attribute,
Option option,
java.lang.String attributeValue)
Adds an attribute to a given OrderItem . |
java.util.Map |
processOrderComplete(java.util.Map parameters)
Handles processing at the very end of the checkout process, after payments have been processed. |
void |
processQuantities(java.util.Collection newOrderItems)
Given a Collection of OrderItems in the user's cart whose
quantities have been set, updates the totals and weights of each
OrderItem based on the (new) quantity. |
java.util.Map |
processRemoveItem(OrderItem orderItem)
Removes a given OrderItem from the user's cart, updating the cart totals in the process. |
void |
processTotalsAndFormatting(java.util.Collection orderItems)
Given a Collection of OrderItems in the user's cart whose
totals have been set, updates the totals and weights of each
OrderDelivery and Order they are under, and
applies formatting to the totals. |
void |
updateOrderAndDeliveryTotals(OrderDelivery orderDelivery,
OrderItem orderItem)
Given an OrderItem , updates the totals of the user's
Order and the OrderDelivery the
OrderItem is under. |
Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor |
---|
formatDateTime, formatPrice, getAppComponents, getAppSettings, getAttributeIDs, getBusinessObjectFactory, getDaoFactory, getProductIDs, getSettings, getUser, initialize, loadMatchingSkus, parseDateTime, parseResponseData, prepareRequestData, sendHTTPPost, setAppComponents, setAppSettings, setBusinessObjectFactory, setDaoFactory, setSettings, setUser, utils |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.softslate.commerce.businessobjects.core.BusinessObject |
---|
initialize |
Field Detail |
---|
static org.apache.commons.logging.Log log
static java.lang.String addItemStatus
static java.lang.String initializedStatus
static java.lang.String addressAddedStatus
static java.lang.String pendingStatus
static java.lang.String receivedStatus
static java.lang.String corruptedStatus
Constructor Detail |
---|
public BasicCartProcessor()
Method Detail |
---|
public java.util.Map processAddItems(java.util.Map parameters) throws java.lang.Exception
CartProcessor
CartProcessor.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
.
This method manages the parsing of incoming parameters that identify the
products, quantities, and attribute values of the items to be added. It
populates OrderItem
objects with the incoming information
and then hands off the processing to the
CartProcessor.processAddItems(Collection)
method.
The incoming 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)orderAttributes
(aHashMap
holding
attribute keys and values, where the attribute keys are in the form of
'productCode|attributeCode')
processAddItems
in interface CartProcessor
parameters
- A Map
representing the items and attributes
being added to the user's cart.
Map
representing the results of the processing.
The Map
may have one or more of the following keys
related to inventory processing: "lowStockEmails",
"missingAttributes", "rejectedOrderItems", "adjustedOrderItems",
and "newOOSSKUs".
java.lang.Exception
CartAddAction
public java.util.Map processAddItems(java.util.Collection newOrderItems) throws java.lang.Exception
CartProcessor
Collection
of initialized OrderItem
objects, adds the items to the user's cart. Manages the processing of
inventory and discounting, updates the user's cart totals, and manages
synchronizing the objects with the database.
processAddItems
in interface CartProcessor
newOrderItems
- The Collection
containing the
OrderItem
objects to be added to the user's
cart.
Map
containing information on the results of the
processing. The Map
may have one or more of the
following keys related to inventory processing: "lowStockEmails",
"missingAttributes", "rejectedOrderItems", "adjustedOrderItems",
and "newOOSSKUs".
java.lang.Exception
public void initializeCart() throws java.lang.Exception
CartProcessor
Order
and
OrderDelivery
representing a user's cart. Sets the current User
object's
order property with the newly created Order
. Synchronizes
the new cart with the database.
initializeCart
in interface CartProcessor
java.lang.Exception
public void processQuantities(java.util.Collection newOrderItems) throws java.lang.Exception
CartProcessor
OrderItems
in the user's cart whose
quantities have been set, updates the totals and weights of each
OrderItem
based on the (new) quantity.
processQuantities
in interface CartProcessor
newOrderItems
- The Collection
containing the
OrderItem
objects whose quantities and totals
are to be set.
java.lang.Exception
public void processTotalsAndFormatting(java.util.Collection orderItems) throws java.lang.Exception
OrderItems
in the user's cart whose
totals have been set, updates the totals and weights of each
OrderDelivery
and Order
they are under, and
applies formatting to the totals.
orderItems
- The OrderItems
whose totals must be added to
the order and order delivery.
java.lang.Exception
public void updateOrderAndDeliveryTotals(OrderDelivery orderDelivery, OrderItem orderItem)
OrderItem
, updates the totals of the user's
Order
and the OrderDelivery
the
OrderItem
is under. Calculates new totals for the
quantity, price total, and weight total.
orderDelivery
- The order delivery that contains the new
OrderItem
.orderItem
- The newly-added order item whose price must be added to the
order's total and the delivery's total.public java.lang.String getOrderAttribute(java.util.Map parameters, java.lang.String productCode, java.lang.String attributeCode, int index) throws java.lang.Exception
orderAttributes
property (which is a HashMap
)
of the incoming Map
to look up the attribute's value. The
key for the attribute is formed like so:
productCode|attributeCode
.
parameters
- A Map
representing the items and properties
submitted to add or edit items in the user's cart.productCode
- The code of the product corresponding to the attribute.attributeCode
- The code of the attribute whose value is being looked up.index
- The index of the submitted array of product codes
corresponding to the item being added.
attibuteCode
, or null
, if the
attribute is not found.
java.lang.Exception
public void processItemAttribute(OrderItem orderItem, Attribute attribute, Option option, java.lang.String attributeValue) throws java.lang.Exception
OrderItem
. Adds the
attribute's total and weight to the order item's.
orderItem
- The OrderItem
that is having an attribute added
to it.attribute
- The Attribute
being added to the order itemoption
- The Option
of the above attribute that is being
added to the order item. If no option is relevant, this
parameter may be null.attributeValue
- The value of the attribute being added to the
OrderItem
. Corresponds to the option's code,
or a free form value if no option is relevant.
java.lang.Exception
public int getOrderItemQuantity(java.util.Map parameters, int index) throws java.lang.Exception
orderProductQuantities
property (which is a
String[]
) of the incoming Map
to look up
the value.
parameters
- A Map
representing the items and properties
being added or edited.index
- The index of the submitted array of product quantities
corresponding to the item being added.
java.lang.Exception
public java.util.Map processEditItem(java.util.Map parameters) throws java.lang.Exception
CartProcessor
Map
must have the same keys required by
CartProcessor.processAddItems(Map)
, plus a key named orderItem
,
which identifies the order item being edited.
processEditItem
in interface CartProcessor
parameters
- A Map
identifying the item being edited and
specifying the item's new properties.
Map
containing information on the results of the
processing. The Map
may have one or more of the
following keys related to inventory processing: "lowStockEmails",
"missingAttributes", "rejectedOrderItems", "adjustedOrderItems",
and "newOOSSKUs".
java.lang.Exception
CartItemEditAction
public java.util.Map processRemoveItem(OrderItem orderItem) throws java.lang.Exception
CartProcessor
processRemoveItem
in interface CartProcessor
orderItem
- The OrderItem
being removed.
java.lang.Exception
public java.util.Map processCheckoutAddresses(java.util.Map parameters) throws java.lang.Exception
CartProcessor
processCheckoutAddresses
in interface CartProcessor
parameters
- A Map
representing the address information of
the current user.
java.lang.Exception
CheckoutAction.processCheckoutAddresses(BaseForm)
public java.util.Map processOrderComplete(java.util.Map parameters) throws java.lang.Exception
CartProcessor
The order number is an integer given to each completed order, starting at the "orderNumberFloor" database setting (whose default is 1,000).
processOrderComplete
in interface CartProcessor
Map
representing the results of the processing.
java.lang.Exception
CheckoutAction.processOrderComplete(BaseForm)
public java.util.Map postProcessAddItems(java.util.Collection newOrderItems) throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |