com.ibm.commerce.price.commands
Class DiscountCalculationCodeApplyCmdImpl

com.ibm.commerce.price.commands.DiscountCalculationCodeApplyCmdImpl

public class DiscountCalculationCodeApplyCmdImpl

The default implementation for the discount calculationUsage adds the specified MonetaryAmounts to the total adjustment of the orderItem. Order item adjustments and an order adjustment are also created for each calculation code applied.

NOTE : Order adjustments can not make the net price of an order item cross the zero boundary. That is, if an order item has a gross price that is on the opposite side of zero from the resulting net price (after applying the discount) then the net price is adjusted to zero and the discount is changed accordingly. Any left-over discount is distributed over the other order items that also qualify for the same discount. The distribution is done in proportion to the original discount. Any order item that has a gross price that is zero can only have a net price (price after applying discounts) that is positive.


Constructor Summary
DiscountCalculationCodeApplyCmdImpl()
          DiscountCalculationCodeApplyCmdImpl constructor.
 
Method Summary
protected  void distributeExtraDiscount(java.math.BigDecimal discountToRedistribute, java.math.BigDecimal[] weights, java.math.BigDecimal[] netPrices, java.math.BigDecimal[] discounts)
           
 void performExecute()
          Execute the command.
protected  java.math.BigDecimal roundCustomized(java.math.BigDecimal value, java.lang.String currency)
           
 void setCalculationCodeAB(CalculationCodeAccessBean calculationCodeAB)
          Set the CalculationCodeAccessBean.
 void setOrderItemABHash(java.util.Hashtable orderItemABHash)
          Set the orderItemABHash.
 

Constructor Detail

DiscountCalculationCodeApplyCmdImpl

public DiscountCalculationCodeApplyCmdImpl()
DiscountCalculationCodeApplyCmdImpl constructor.
Method Detail

distributeExtraDiscount

protected void distributeExtraDiscount(java.math.BigDecimal discountToRedistribute,
                                       java.math.BigDecimal[] weights,
                                       java.math.BigDecimal[] netPrices,
                                       java.math.BigDecimal[] discounts)

performExecute

public void performExecute()
                    throws ECException
Execute the command.

roundCustomized

protected java.math.BigDecimal roundCustomized(java.math.BigDecimal value,
                                               java.lang.String currency)
                                        throws ECException

setCalculationCodeAB

public void setCalculationCodeAB(CalculationCodeAccessBean calculationCodeAB)
Set the CalculationCodeAccessBean.
Parameters:
calculationCodeAB - A CalculationCodeAccessBean.

setOrderItemABHash

public void setOrderItemABHash(java.util.Hashtable orderItemABHash)
Set the orderItemABHash.
Parameters:
orderItemABHash - An orderItemABHash.

java.util.Hashtable orderItemABHash

  • key: com.ibm.commerce.order.objects.OrderItemAccessBean orderItemAB
  • element: com.ibm.commerce.price.CategorizedMonetaryAmount monetaryAmount