Interface PromotionActionService

  • All Known Implementing Classes:
    DefaultPromotionActionService

    public interface PromotionActionService
    Encapsulates logic for taking actions to apply promotions.
    • Method Detail

      • recalculateFiredPromotionMessage

        void recalculateFiredPromotionMessage​(PromotionResultModel promoResult)
        Recalculates promotion fired message and stores it in provided PromotionResultModel. This method should be used for potential promotion only to update computed values displayed in the message
        Parameters:
        promoResult - a promotion result that holds fired promotion message which needs to be updated
      • createPromotionResult

        PromotionResultModel createPromotionResult​(AbstractRuleActionRAO action)
        Creates a PromotionResultModel object for the given AbstractRuleActionRAO.
        Parameters:
        action - the action rao to use for the promotion result creation
        Returns:
        the newly created (not persisted!) PromotionResultModel.
      • createDiscountValue

        void createDiscountValue​(DiscountRAO discountRao,
                                 java.lang.String code,
                                 AbstractOrderModel order)
        Creates a DiscountValue from the given discountRao and adds it to the given order. Note: The order is not saved!
        Parameters:
        discountRao - the discountRao to take the values from
        code - the code for the new DiscountValue (e.g. UUID from the respective AbstractPromotionActionModel that creates this discount)
        order - the order to apply the discount value to
      • removeDiscountValue

        java.util.List<ItemModel> removeDiscountValue​(java.lang.String code,
                                                      AbstractOrderModel order)
        Removes the DiscountValue with the given code from the given order and its order entries. Returns the list of all modified items (order, order entries). Note: The returned items are not saved!
        Parameters:
        code - the code for the DiscountValue to be removed
        order - the order to remove the discount value from
        Returns:
        all items (order, order entries) that have been modified and need saving
      • createDiscountValue

        void createDiscountValue​(DiscountRAO discountRao,
                                 java.lang.String code,
                                 AbstractOrderEntryModel orderEntry)
        Creates a DiscountValue from the given discountRao and adds it to the given orderEntry. Note: The orderEntry is not saved!
        Parameters:
        discountRao - the discountRao to take the values from
        code - the code for the new DiscountValue (e.g. UUID from the respective AbstractPromotionActionModel that creates this discount)
        orderEntry - the orderEntry to apply the discount value to
      • getOrderEntry

        AbstractOrderEntryModel getOrderEntry​(AbstractRuleActionRAO action)
        Looks up the AbstractOrderEntryModel based on the given AbstractRuleActionRAO.
        Parameters:
        action - the action to use for the look-up
        Returns:
        the AbstractOrderEntryModel
      • getOrder

        AbstractOrderModel getOrder​(AbstractRuleActionRAO action)
        Returns the order for the given action.
        Parameters:
        action - the orderRao
        Returns:
        the order or null if no order is found
      • recalculateTotals

        void recalculateTotals​(AbstractOrderModel order)
        Recalculates totals for the given order.
        Parameters:
        order - the order to recalculate its totals