com.softslate.commerce.businessobjects.order
Interface CartDiscountProcessor

All Known Implementing Classes:
BasicCartDiscountProcessor

public interface CartDiscountProcessor

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

CartProcessor employs an instance implementing CartDiscountProcessor when discounting needs to be processed.

When the application needs to create an instance that implements CartDiscountProcessor, BusinessObjectFactory finds the name of the Java class to instantiate from the "cartDiscountProcessorImplementer" setting in the appComponents.properties file.

The default "cartDiscountProcessorImplementer" is BasicCartDiscountProcessor.

Author:
David Tobey
See Also:
InventoryProcessor

Method Summary
 boolean isDiscountOk(Discount discount, java.lang.Double previousOrderTotal)
          Checks that a given discount is applicable.
 java.util.Map processAddItems(java.util.Collection orderItems)
          Processes discounts upon adding an item or items to the user's cart.
 java.util.Map processCouponCode(java.util.Map parameters)
          Processes discounts as a user enters a coupon code.
 java.util.Map processCustomerLogin(java.util.Map parameters)
          Processes discounts as a customer logs in.
 java.util.Map processCustomerLogout(java.util.Map parameters)
          Processes discounts as a customer logs out.
 java.util.Map processOnCheckout(java.util.Map parameters)
          Processes discounts during checkout, as taxes and shipping are processed.
 java.util.Map processOrderComplete(java.util.Map parameters)
          Processes discounts as a user's order is completed.
 java.util.Map processRemoveDiscounts()
          Removes all the discounts in the current user's cart.
 

Method Detail

processAddItems

java.util.Map processAddItems(java.util.Collection orderItems)
                              throws java.lang.Exception
Processes discounts upon adding an item or items to the user's cart. The default implementation simply calls BasicCartDiscountProcessor.processDiscounts(Collection, boolean)

Parameters:
orderItems - The collection of OrderItem objects being added to the cart.
Returns:
A Map containing results of the processing. The default implementation returns null.
Throws:
java.lang.Exception

processOnCheckout

java.util.Map processOnCheckout(java.util.Map parameters)
                                throws java.lang.Exception
Processes discounts during checkout, as taxes and shipping are processed. The default implementation simply calls BasicCartDiscountProcessor.processDiscounts(Collection, boolean)

Parameters:
parameters - A Map with any parameters needed for the processing. The default implementation does not use this argument.
Returns:
A Map containing results of the processing. The default implementation returns null.
Throws:
java.lang.Exception

processCouponCode

java.util.Map processCouponCode(java.util.Map parameters)
                                throws java.lang.Exception
Processes discounts as a user enters a coupon code. The default implementation simply calls BasicCartDiscountProcessor.processDiscounts(Collection, boolean)

Parameters:
parameters - A Map with any parameters needed for the processing. The default implementation does not use this argument.
Returns:
A Map containing results of the processing. The default implementation returns null.
Throws:
java.lang.Exception

processCustomerLogin

java.util.Map processCustomerLogin(java.util.Map parameters)
                                   throws java.lang.Exception
Processes discounts as a customer logs in. Some discounts only apply if the user is logged in as a customer, so discounts must be rerun. The default implementation simply calls BasicCartDiscountProcessor.processDiscounts(Collection, boolean)

Parameters:
parameters - A Map with any parameters needed for the processing. The default implementation does not use this argument.
Returns:
A Map containing results of the processing. The default implementation returns null.
Throws:
java.lang.Exception

processCustomerLogout

java.util.Map processCustomerLogout(java.util.Map parameters)
                                    throws java.lang.Exception
Processes discounts as a customer logs out. Some discounts only apply if the user is logged in as a customer, so discounts must be rerun. The default implementation simply calls BasicCartDiscountProcessor.processDiscounts(Collection, boolean)

Parameters:
parameters - A Map with any parameters needed for the processing. The default implementation does not use this argument.
Returns:
A Map containing results of the processing. The default implementation returns null.
Throws:
java.lang.Exception

processOrderComplete

java.util.Map processOrderComplete(java.util.Map parameters)
                                   throws java.lang.Exception
Processes discounts as a user's order is completed. The default implementation simply calls BasicCartDiscountProcessor.processDiscounts(Collection, boolean)

Parameters:
parameters - A Map with any parameters needed for the processing. The default implementation does not use this argument.
Returns:
A Map containing results of the processing. The default implementation returns null.
Throws:
java.lang.Exception

processRemoveDiscounts

java.util.Map processRemoveDiscounts()
                                     throws java.lang.Exception
Removes all the discounts in the current user's cart. Updates the cart totals accordingly. Called before items are removed from the cart by BasicCartProcessor.processRemoveItem(OrderItem)

Returns:
A Map containing results of the processing. The default implementation returns null.
Throws:
java.lang.Exception

isDiscountOk

boolean isDiscountOk(Discount discount,
                     java.lang.Double previousOrderTotal)
                     throws java.lang.Exception
Checks that a given discount is applicable. Used by discount processing to help determine which discounts to apply, and in the presentation to determine which discounts to display to the user.

Parameters:
discount - The discount whose applicability is being checked.
previousOrderTotal - The previous order total of the current user, or null. Some discounts are only applicable if the user has previously placed orders totalling a certain amount.
Returns:
true, the discount is applicable, otherwise, false.
Throws:
java.lang.Exception


Copyright ? SoftSlate, LLC 2003?2005