Class DefaultCouponFacade
java.lang.Object
de.hybris.platform.couponfacades.facades.impl.DefaultCouponFacade
- All Implemented Interfaces:
VoucherFacade
Implementation of VoucherFacade that uses CouponService.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidacceptIfCartExists(String code, BiConsumer<String, AbstractOrderModel> orderConsumer) protected <R> RapplyIfCartExists(String code, BiFunction<String, CartModel, R> orderConsumer) protected <R> RapplyIfCartExists(Function<AbstractOrderModel, R> orderFunction) voidapplyVoucher(String voucherCode) Apply voucher to current session cartbooleancheckVoucherCode(String voucherCode) Check if voucher code is validprotected CartServiceprotected AbstractPopulatingConverter<String,VoucherData> protected Converter<AbstractCouponModel,VoucherData> protected CouponServiceprotected List<VoucherData>getVoucher(String voucherCode) Get voucher base on its codeGet vouchers applied for current session cartvoidreleaseVoucher(String voucherCode) Remove voucher from current session cartvoidsetCartService(CartService cartService) voidsetCouponCodeModelConverter(AbstractPopulatingConverter<String, VoucherData> couponCodeModelConverter) voidsetCouponModelConverter(Converter<AbstractCouponModel, VoucherData> couponModelConverter) voidsetCouponService(CouponService couponService)
-
Field Details
-
COUPON_CODE
- See Also:
-
-
Constructor Details
-
DefaultCouponFacade
public DefaultCouponFacade()
-
-
Method Details
-
checkVoucherCode
Description copied from interface:VoucherFacadeCheck if voucher code is valid- Specified by:
checkVoucherCodein interfaceVoucherFacade- Parameters:
voucherCode- voucher code- Returns:
- true when voucher code is valid, false when voucher code is invalid
-
getVoucher
Description copied from interface:VoucherFacadeGet voucher base on its code- Specified by:
getVoucherin interfaceVoucherFacade- Parameters:
voucherCode- voucher identifier- Returns:
- the
VoucherData - Throws:
VoucherOperationException- if no voucher with the specified code is found
-
applyVoucher
Description copied from interface:VoucherFacadeApply voucher to current session cart- Specified by:
applyVoucherin interfaceVoucherFacade- Parameters:
voucherCode- voucher identifier- Throws:
VoucherOperationException- if voucher wasn't applied due to some problems
-
releaseVoucher
Description copied from interface:VoucherFacadeRemove voucher from current session cart- Specified by:
releaseVoucherin interfaceVoucherFacade- Parameters:
voucherCode- voucher identifier- Throws:
VoucherOperationException- if voucher wasn't released due to some problems
-
getVouchersForCart
Description copied from interface:VoucherFacadeGet vouchers applied for current session cart- Specified by:
getVouchersForCartin interfaceVoucherFacade- Returns:
- list of vouchers applied for current session cart
-
getCouponsForOrder
-
acceptIfCartExists
protected void acceptIfCartExists(String code, BiConsumer<String, AbstractOrderModel> orderConsumer) throws VoucherOperationException- Throws:
VoucherOperationException
-
applyIfCartExists
protected <R> R applyIfCartExists(String code, BiFunction<String, CartModel, throws VoucherOperationExceptionR> orderConsumer) - Throws:
VoucherOperationException
-
applyIfCartExists
-
getCouponService
-
setCouponService
-
getCartService
-
setCartService
-
getCouponCodeModelConverter
-
setCouponCodeModelConverter
public void setCouponCodeModelConverter(AbstractPopulatingConverter<String, VoucherData> couponCodeModelConverter) -
getCouponModelConverter
-
setCouponModelConverter
public void setCouponModelConverter(Converter<AbstractCouponModel, VoucherData> couponModelConverter)
-