Interface AddOrderDiscountRAOAction


  • public interface AddOrderDiscountRAOAction
    AddOrderDiscountRAOAction adds a discount on order/cart level.
    • 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 given cartRao, recalculates the cart totals and returns the discount. The absolute flag determines whether the discount is absolute or percentage based. For absolute values, the cart's currency is used. The amount specifies the amount used, e.g. $20 or 10%. The ruleContext can be used to enhance the returned DiscountRAO.
        Parameters:
        cartRao - the CartRAO to apply the discount to
        absolute - the type of discount
        amount - the amount of the discount
        result - the result rao
        ruleContext - 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 the cartRao 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 discount
        amount - currency amount or percentage to be discounted
        result - resultRAO containing information from evaluation action
        ruleContext - 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 calculated
        excludedProductCodes - 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