com.konakart.bl.modules.ordertotal
Class BaseOrderTotalModule

java.lang.Object
  extended by com.konakart.bl.modules.BaseModule
      extended by com.konakart.bl.modules.ordertotal.BaseOrderTotalModule
Direct Known Subclasses:
BuyXGetYFree, FreeProduct, GiftCertificate, ProductDiscount, RedeemPoints, RewardPoints, Shipping, ShippingDiscount, Subtotal, Tax, TaxCloud, Total, TotalDiscount

public class BaseOrderTotalModule
extends BaseModule

Base Order Total Module


Field Summary
protected  org.apache.commons.logging.Log log
          The Log instance for this application.
protected  java.util.List<OrderTotal> orderTotalList
          A list of the current order totals so that an order total module can modify an order total that was previously called.
 
Fields inherited from class com.konakart.bl.modules.BaseModule
basePackage
 
Constructor Summary
BaseOrderTotalModule()
           
 
Method Summary
protected  java.math.BigDecimal getCustomBigDecimal(java.lang.String customAttr, int customId)
          Utility method that gets a BigDecimal from one of the promotion custom attributes
protected  boolean getCustomBoolean(java.lang.String customAttr, int customId)
          Utility method that gets a boolean from one of the promotion custom attributes
protected  int getCustomInt(java.lang.String customAttr, int customId)
          Utility method that gets an int from one of the promotion custom attributes
protected  java.lang.String getCustomString(java.lang.String customAttr, int customId)
          Utility method that gets a String from one of the promotion custom attributes.
protected  OrderTotal getDiscountOrderTotalFromList(Order order, java.util.List<OrderTotal> orderTotalList)
          This is a helper method for the discount modules.
 java.util.List<OrderTotal> getOrderTotalList()
          A list of the current order totals so that an order total module can modify an order total that was previously called.
 PromotionResult getPromotionResult(Product product, Promotion promotion)
          Returns an object containing the promotion discount
 void setOrderTotalList(java.util.List<OrderTotal> orderTotalList)
          A list of the current order totals so that an order total module can modify an order total that was previously called.
 
Methods inherited from class com.konakart.bl.modules.BaseModule
getBasketMgr, getCatMgr, getConfigMgr, getCurrMgr, getCustMgr, getEmailMgr, getEng, getLangMgr, getMultiStoreMgr, getOrderMgr, getOrderTotalMgr, getPaymentMgr, getProdMgr, getPromMgr, getResourceBundle, getRewardPointMgr, getSecMgr, getShippingMgr, getSolrMgr, getStoreId, getTaxMgr, init, isAvailable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.apache.commons.logging.Log log
The Log instance for this application.


orderTotalList

protected java.util.List<OrderTotal> orderTotalList
A list of the current order totals so that an order total module can modify an order total that was previously called.

Constructor Detail

BaseOrderTotalModule

public BaseOrderTotalModule()
Method Detail

getCustomInt

protected int getCustomInt(java.lang.String customAttr,
                           int customId)
                    throws KKException
Utility method that gets an int from one of the promotion custom attributes

Parameters:
customAttr -
customId -
Returns:
int
Throws:
KKException

getCustomBigDecimal

protected java.math.BigDecimal getCustomBigDecimal(java.lang.String customAttr,
                                                   int customId)
                                            throws KKException
Utility method that gets a BigDecimal from one of the promotion custom attributes

Parameters:
customAttr -
customId -
Returns:
BigDecimal
Throws:
KKException

getCustomBoolean

protected boolean getCustomBoolean(java.lang.String customAttr,
                                   int customId)
                            throws KKException
Utility method that gets a boolean from one of the promotion custom attributes

Parameters:
customAttr -
customId -
Returns:
boolean
Throws:
KKException

getCustomString

protected java.lang.String getCustomString(java.lang.String customAttr,
                                           int customId)
                                    throws KKException
Utility method that gets a String from one of the promotion custom attributes. It ensures that the value isn't null.

Parameters:
customAttr -
customId -
Returns:
String
Throws:
KKException

getDiscountOrderTotalFromList

protected OrderTotal getDiscountOrderTotalFromList(Order order,
                                                   java.util.List<OrderTotal> orderTotalList)
                                            throws java.lang.Exception
This is a helper method for the discount modules. Many promotions may be relevant for an order. This method receives all of the relative promotions (in the form of Order Total objects) in a list as an input parameter. It sums all of the cumulative promotions into a single Order Total object and then compares all of the order totals that it has, in order to select the one that provides the largest discount.

Parameters:
order -
orderTotalList -
Returns:
An OrderTotal object
Throws:
java.lang.Exception

getOrderTotalList

public java.util.List<OrderTotal> getOrderTotalList()
A list of the current order totals so that an order total module can modify an order total that was previously called.

Returns:
the orderTotalList

setOrderTotalList

public void setOrderTotalList(java.util.List<OrderTotal> orderTotalList)
A list of the current order totals so that an order total module can modify an order total that was previously called.

Parameters:
orderTotalList - the orderTotalList to set

getPromotionResult

public PromotionResult getPromotionResult(Product product,
                                          Promotion promotion)
                                   throws java.lang.Exception
Returns an object containing the promotion discount

Parameters:
product -
promotion -
Returns:
Returns a PromotionResult object
Throws:
java.lang.Exception


Copyright © 2011 DS Data Systems UK Ltd.