Class DefaultCouponService
java.lang.Object
de.hybris.platform.couponservices.services.impl.DefaultCouponService
- All Implemented Interfaces:
CouponService
- Direct Known Subclasses:
DefaultCustomerCouponService
Default CouponService implementation
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CouponResponseassertCouponCodeInOrder(String couponCode, AbstractOrderModel order) checkMatch(AbstractCouponModel coupon, String couponCode) protected StringclearCouponCode(String couponCode) protected booleancontainsCouponCode(String couponCode, AbstractOrderModel order) returns true if the given couponCode is part of the given orderprotected BaseSiteServiceprotected CalculationServiceprotected CouponCodeGenerationServicegetCouponForCode(String couponCode) Returns Coupon Model object for a given coupon codeprotected CouponManagementServiceprotected ModelServiceprotected Collection<PromotionGroupModel>protected PromotionsServicegetValidatedCouponForCode(String couponCode) Returns Coupon Model object for a given coupon code with validationprotected voidRecalculates the given order and updates the promotions.redeemCoupon(String couponCode, CartModel cart) Redeem the coupon code associated with the cart.redeemCoupon(String couponCode, OrderModel order) Create a coupon redemption instance for the coupon redeemed for the order.protected voidredeemCouponCode(CartModel cart, String clearedCouponCode, CouponResponse response) voidreleaseCouponCode(String couponCode, AbstractOrderModel order) Release the coupon code from given cart.protected voidremoveCouponAndTriggerCalculation(String couponCode, AbstractOrderModel order) voidsetBaseSiteService(BaseSiteService baseSiteService) voidsetCalculationService(CalculationService calculationService) voidsetCouponCodeGenerationService(CouponCodeGenerationService couponCodeGenerationService) voidsetCouponManagementService(CouponManagementService couponManagementService) voidsetModelService(ModelService modelService) voidsetPromotionsService(PromotionsService promotionsService) validateCouponCode(String couponCode, UserModel user) Validate if providedcouponCodeis valid.verifyCouponCode(String couponCode, AbstractOrderModel order) Verify if providedcouponCodeis valid.
-
Field Details
-
COUPON_CODE
- See Also:
-
ORDER
- See Also:
-
-
Constructor Details
-
DefaultCouponService
public DefaultCouponService()
-
-
Method Details
-
verifyCouponCode
Description copied from interface:CouponServiceVerify if providedcouponCodeis valid.- Specified by:
verifyCouponCodein interfaceCouponService- Parameters:
couponCode- coupon code to validateorder- order for which coupon should be validated- Returns:
- CouponResponse containing true if coupon code is valid or false if not.
-
validateCouponCode
Description copied from interface:CouponServiceValidate if providedcouponCodeis valid.- Specified by:
validateCouponCodein interfaceCouponService- Parameters:
couponCode- coupon code to validateuser- user for which coupon should be validated- Returns:
- CouponResponse containing true if coupon code is valid or false if not.
-
redeemCoupon
Description copied from interface:CouponServiceRedeem the coupon code associated with the cart.- Specified by:
redeemCouponin interfaceCouponService- Parameters:
couponCode- Coupon code to redeemcart-CartModelto redeem coupon- Returns:
- CouponResponse containing true if coupon code has been redeem at cart or false if not.
-
redeemCouponCode
-
redeemCoupon
Description copied from interface:CouponServiceCreate a coupon redemption instance for the coupon redeemed for the order.- Specified by:
redeemCouponin interfaceCouponService- Parameters:
couponCode- Coupon code to redeemorder-OrderModelto redeem coupon- Returns:
- CouponResponse containing true when coupon redemption instance has been created if a coupon has been redeemed successfully.
-
clearCouponCode
-
assertCouponCodeInOrder
-
containsCouponCode
returns true if the given couponCode is part of the given order- Parameters:
couponCode- the couponCode to checkorder- the abstract order to check
-
checkMatch
-
recalculateOrder
Recalculates the given order and updates the promotions. (callsCalculationService.calculate(AbstractOrderModel)andPromotionsService.updatePromotions(Collection, AbstractOrderModel)- Throws:
CouponServiceException- if any errors happen during recalculation
-
getCouponForCode
Description copied from interface:CouponServiceReturns Coupon Model object for a given coupon code- Specified by:
getCouponForCodein interfaceCouponService- Parameters:
couponCode- Coupon code to get coupon details for- Returns:
AbstractCouponModel
-
getValidatedCouponForCode
Description copied from interface:CouponServiceReturns Coupon Model object for a given coupon code with validation- Specified by:
getValidatedCouponForCodein interfaceCouponService- Parameters:
couponCode- Coupon code to get coupon details for- Returns:
AbstractCouponModel
-
releaseCouponCode
Description copied from interface:CouponServiceRelease the coupon code from given cart.- Specified by:
releaseCouponCodein interfaceCouponService- Parameters:
couponCode- Coupon code to releaseorder-AbstractOrderModelto release the coupon from
-
removeCouponAndTriggerCalculation
-
getPromotionGroups
-
getCouponManagementService
-
setCouponManagementService
-
getCalculationService
-
setCalculationService
-
getPromotionsService
-
setPromotionsService
-
getBaseSiteService
-
setBaseSiteService
-
getModelService
-
setModelService
-
getCouponCodeGenerationService
-
setCouponCodeGenerationService
-