java.lang.Object | +--CalculationCmdImpl | +--com.ibm.commerce.price.commands.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.
This command calls the following TaskCommands:
This command uses the following AccessBeans:CalculationCodeAccessBean
OrderItemAccessBean
OrderAdjustmentAccessBean
CalculationCodeDescriptionAccessBean
CalculationCodeTaxExemptAccessBean
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) Calculate distribute extra discount on weight |
void |
performExecute() Execute the command. |
protected
java.math.BigDecimal |
roundCustomized(java.math.BigDecimal value,
java.lang.String currency) Get round customized price |
void |
setCalculationCodeAB(CalculationCodeAccessBean calculationCodeAB) Set the CalculationCodeAccessBean. |
void |
setOrderItemABHash(java.util.Hashtable orderItemABHash) Set the orderItemABHash. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll,
toString, wait, wait, wait |
Constructor Detail |
---|
public DiscountCalculationCodeApplyCmdImpl()
Method Detail |
---|
protected void distributeExtraDiscount(java.math.BigDecimal discountToRedistribute, java.math.BigDecimal[] weights, java.math.BigDecimal[] netPrices, java.math.BigDecimal[] discounts)
discountToRedistribute
-weights
-netPrices
-discounts
-public void performExecute() throws ECException
ECException
protected java.math.BigDecimal roundCustomized(java.math.BigDecimal value, java.lang.String currency) throws ECException
value
- price value before roundcurrency
- a currency stringECException
public void setCalculationCodeAB(CalculationCodeAccessBean calculationCodeAB)
calculationCodeAB
- A
CalculationCodeAccessBean.public void setOrderItemABHash(java.util.Hashtable orderItemABHash)
orderItemABHash
- An orderItemABHash.
java.util.Hashtable orderItemABHash