Interface AddOrderDiscountRAOAction
-
public interface AddOrderDiscountRAOAction
AddOrderDiscountRAOAction adds a discount on order/cart level.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DiscountRAO
addOrderLevelDiscount(CartRAO cartRao, boolean absolute, java.math.BigDecimal amount, RuleEngineResultRAO result, java.lang.Object ruleContext)
Adds an order level discount to the givencartRao
, recalculates the cart totals and returns the discount.DiscountRAO
addOrderLevelDiscount(CartRAO cartRao, boolean absolute, java.math.BigDecimal amount, java.lang.String[] excludedProducts, RuleEngineResultRAO result, java.lang.Object ruleContext)
Adds an order-level discount to thecartRao
and recalculates cart totals.java.math.BigDecimal
calculateSubTotals(CartRAO cartRao, java.lang.String[] excludedProductCodes)
Calculates the cart sub total for CartRao excluding a set of products.
-
-
-
Method Detail
-
addOrderLevelDiscount
DiscountRAO addOrderLevelDiscount(CartRAO cartRao, boolean absolute, java.math.BigDecimal amount, RuleEngineResultRAO result, java.lang.Object ruleContext)
Adds an order level discount to the givencartRao
, recalculates the cart totals and returns the discount. Theabsolute
flag determines whether the discount is absolute or percentage based. For absolute values, the cart's currency is used. Theamount
specifies the amount used, e.g. $20 or 10%. TheruleContext
can be used to enhance the returned DiscountRAO.- Parameters:
cartRao
- the CartRAO to apply the discount toabsolute
- the type of discountamount
- the amount of the discountresult
- the result raoruleContext
- an optional context object that can be used to provide additional information for the returned DiscountRAO
-
addOrderLevelDiscount
DiscountRAO addOrderLevelDiscount(CartRAO cartRao, boolean absolute, java.math.BigDecimal amount, java.lang.String[] excludedProducts, RuleEngineResultRAO result, java.lang.Object ruleContext)
Adds an order-level discount to thecartRao
and recalculates cart totals. Takes into account the excluded products so that non-absolute discounts are calculated relative to the total excluding these products- Parameters:
cartRao
- Cart to apply the discount to.absolute
- true if the discount is a definite currency amount, rather than a percentage discountamount
- currency amount or percentage to be discountedresult
- resultRAO containing information from evaluation actionruleContext
- additional info for the rule execution environment- Returns:
- order-level DiscountRAO
-
calculateSubTotals
java.math.BigDecimal calculateSubTotals(CartRAO cartRao, java.lang.String[] excludedProductCodes)
Calculates the cart sub total for CartRao excluding a set of products.- Parameters:
cartRao
- CartRAO object to be calculatedexcludedProductCodes
- Array of product codes that identify cart entries to be excluded- Returns:
- result of the cartSubTotals (without charges like payment or delivery) minus the excluded products
-
-