Class AbstractCartOfferAction

All Implemented Interfaces:
PromotionAction
Direct Known Subclasses:
CartGiftWithPurchase, CartPriceOff, CartShippingOff, TradeInOffer

public abstract class AbstractCartOfferAction extends EcommBasePromotionAction
This class provides the functionality that are common to cart based offers
Since:
8.0
Version:
8.0
Author:
Infosys Equinox
  • Field Details

  • Constructor Details

    • AbstractCartOfferAction

      public AbstractCartOfferAction()
  • Method Details

    • getUpdatedTotalPrice

      protected static double getUpdatedTotalPrice(double price, int ruleType, List<PromotionCartOffer> offers, String enableForEligibleProducts, double ratio)
      Loads the updated total price of the cart
      Parameters:
      price - Total price of the cart
      ruleType - Rule type
      offers - An instance of List<PromotionCartOffer>
      enableForEligibleProducts - indicates the if the current offer is eligible for all items.
      ratio - indicates ratio of eligible price to the total price.
      Returns:
      The updated total price of the cart
    • getUpdatedTotalPriceForPriceFacets

      protected static double getUpdatedTotalPriceForPriceFacets(double price, int ruleType, List<PromotionCartOffer> offers, String keyDiscount, double ratio, String enableForEligibleProducts)
      Loads the updated total price facet value of the cart
      Parameters:
      price - Total price facet value of the cart
      ruleType - Rule type
      offers - An instance of List<PromotionCartOffer>
      keyDiscount - Holds the price facet key
      ratio - indicates ratio of eligible price to the total price.
      enableForEligibleProducts - indicates the if the current offer is eligible for all items.
      Returns:
      The updated total price facet value of the cart
    • getUpdatedTradeInValue

      protected static double getUpdatedTradeInValue(double tradeInValue, int ruleType, List<PromotionCartOffer> offers)
      Loads the updated trade-in value of the cart
      Parameters:
      tradeInValue - Trade-in value of the cart
      ruleType - Rule type
      offers - An instance of List<PromotionCartOffer>
      Returns:
      The updated trade-in value of the cart
    • getUpdatedShippingCost

      protected static double getUpdatedShippingCost(double shippingCost, int ruleType, List<PromotionCartOffer> offers)
      This method returns the updated shipping cost
      Parameters:
      shippingCost - Holds the shipping cost of the product
      ruleType - Holds the value for the rule type
      offers - An instance of List<PromotionCartOffer>
      Returns:
      The updated shipping cost of the product
    • setOffer

      protected PromotionCartOffer setOffer(PromotionOfferDO promotionOfferDO, PromotionDO promotion, PromotionCart cart)
      Functionality to set the offer details
      Parameters:
      promotionOfferDO - An instance of PromotionOfferDO
      promotion - An instance of PromotionDO
      cart - An instance of PromotionCart
      Returns:
      The instance of PromotionDiscount
    • getOffer

      protected void getOffer(PromotionOfferDO promotionOfferDO, PromotionDO promotion, PromotionCart cart)
      This method provides functionality to get offer
      Parameters:
      promotionOfferDO - An instance of PromotionOfferDO
      promotion - An instance of PromotionDO
      cart - An instance of PromotionCart
    • applyOffer

      protected abstract void applyOffer(PromotionOfferDO promotionOfferDO, PromotionDO promotion, PromotionCart cart)
      Functionality to calculate offer
      Parameters:
      promotionOfferDO - An instance of PromotionOfferDO
      promotion - An instance of PromotionDO
      cart - An instance of PromotionCart
    • applyAction

      public void applyAction(PromotionOfferDO promotionOfferDO, PromotionDO promotion)
      Description copied from interface: PromotionAction
      Provides functionality to perform discount calculation based on the configuration.
      Specified by:
      applyAction in interface PromotionAction
      Overrides:
      applyAction in class BasePromotionAction
      Parameters:
      promotionOfferDO - An instance of PromotionOfferDO.
      promotion - An instance of PromotionDO.
    • prepareApplyAction

      public boolean prepareApplyAction(PromotionOfferDO promotionOfferDO)
      Specified by:
      prepareApplyAction in interface PromotionAction
      Overrides:
      prepareApplyAction in class BasePromotionAction
    • updateProximityMessage

      protected void updateProximityMessage(PromotionCartOffer offer, PromotionOfferDO promotionOfferDO)
      This method is used to proximity message
      Parameters:
      offer - offer