Interface DiscountService

  • All Known Implementing Classes:
    DefaultDiscountService

    public interface DiscountService
    Service around the DiscountModel.

    There are different kinds of discounts: absolute or relative, and global and non-global. Absolute discounts contain a real price value (price and currency), whereas relative discounts are discounts in percent. Global discounts are applied on order level, which means that they can not be applied to a single entry. Non-global discounts are only applicable on entry - level.

    Since all price calculation is done be the currently installed pricefactory refer to it for maybe differing behavior.

    Spring Bean ID:
    discountService
    • Method Detail

      • getDiscountForCode

        DiscountModel getDiscountForCode​(java.lang.String code)
        Gets the DiscountModel with the specified code.
        Parameters:
        code - the discount code
        Returns:
        the found DiscountModel with the specified code
      • getDiscountsForCode

        java.util.Collection<DiscountModel> getDiscountsForCode​(java.lang.String matchedCode)
        Gets all DiscountModels which match the specified code.
        Parameters:
        matchedCode - an SQL-Like statement as String, such as %discountCode%
        Returns:
        the Collection of all DiscountModels which match the specified code
      • getDiscountsForCurrency

        java.util.Collection<DiscountModel> getDiscountsForCurrency​(CurrencyModel currency)
        Gets all DiscountModels which match the specified currency.
        Parameters:
        currency - target CurrencyModel
        Returns:
        the Collection of all DiscountModels which matching currency. If no matching discounts were found, an empty collection is returned.
        Throws:
        java.lang.IllegalArgumentException - if currency is null