Class DefaultCouponService

    • Constructor Detail

      • DefaultCouponService

        public DefaultCouponService()
    • Method Detail

      • verifyCouponCode

        public CouponResponse verifyCouponCode​(java.lang.String couponCode,
                                               AbstractOrderModel order)
        Description copied from interface: CouponService
        Verify if provided couponCode is valid.
        Specified by:
        verifyCouponCode in interface CouponService
        Parameters:
        couponCode - coupon code to validate
        order - order for which coupon should be validated
        Returns:
        CouponResponse containing true if coupon code is valid or false if not.
      • validateCouponCode

        public CouponResponse validateCouponCode​(java.lang.String couponCode,
                                                 UserModel user)
        Description copied from interface: CouponService
        Validate if provided couponCode is valid.
        Specified by:
        validateCouponCode in interface CouponService
        Parameters:
        couponCode - coupon code to validate
        user - user for which coupon should be validated
        Returns:
        CouponResponse containing true if coupon code is valid or false if not.
      • redeemCoupon

        public CouponResponse redeemCoupon​(java.lang.String couponCode,
                                           CartModel cart)
        Description copied from interface: CouponService
        Redeem the coupon code associated with the cart.
        Specified by:
        redeemCoupon in interface CouponService
        Parameters:
        couponCode - Coupon code to redeem
        cart - CartModel to redeem coupon
        Returns:
        CouponResponse containing true if coupon code has been redeem at cart or false if not.
      • redeemCouponCode

        protected void redeemCouponCode​(CartModel cart,
                                        java.lang.String clearedCouponCode,
                                        CouponResponse response)
      • redeemCoupon

        public CouponResponse redeemCoupon​(java.lang.String couponCode,
                                           OrderModel order)
        Description copied from interface: CouponService
        Create a coupon redemption instance for the coupon redeemed for the order.
        Specified by:
        redeemCoupon in interface CouponService
        Parameters:
        couponCode - Coupon code to redeem
        order - OrderModel to redeem coupon
        Returns:
        CouponResponse containing true when coupon redemption instance has been created if a coupon has been redeemed successfully.
      • clearCouponCode

        protected java.lang.String clearCouponCode​(java.lang.String couponCode)
      • containsCouponCode

        protected boolean containsCouponCode​(java.lang.String couponCode,
                                             AbstractOrderModel order)
        returns true if the given couponCode is part of the given order
        Parameters:
        couponCode - the couponCode to check
        order - the abstract order to check
      • checkMatch

        protected java.util.function.Predicate<java.lang.String> checkMatch​(AbstractCouponModel coupon,
                                                                            java.lang.String couponCode)
      • removeCouponAndTriggerCalculation

        protected void removeCouponAndTriggerCalculation​(java.lang.String couponCode,
                                                         AbstractOrderModel order)
      • getPromotionGroups

        protected java.util.Collection<PromotionGroupModel> getPromotionGroups()
      • setCouponManagementService

        public void setCouponManagementService​(CouponManagementService couponManagementService)
      • setCalculationService

        public void setCalculationService​(CalculationService calculationService)
      • setPromotionsService

        public void setPromotionsService​(PromotionsService promotionsService)
      • setBaseSiteService

        public void setBaseSiteService​(BaseSiteService baseSiteService)
      • getModelService

        protected ModelService getModelService()
      • setModelService

        public void setModelService​(ModelService modelService)
      • setCouponCodeGenerationService

        public void setCouponCodeGenerationService​(CouponCodeGenerationService couponCodeGenerationService)