Package de.hybris.platform.voucher.impl
Class DefaultVoucherService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.voucher.impl.AbstractVoucherService
-
- de.hybris.platform.voucher.impl.DefaultVoucherService
-
- All Implemented Interfaces:
VoucherService,java.io.Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
CouponVoucherService
public class DefaultVoucherService extends AbstractVoucherService implements VoucherService
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManager
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant
-
-
Constructor Summary
Constructors Constructor Description DefaultVoucherService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterOrderCreation(OrderModel order, CartModel cart)Transfers vouchers form cart to newly created order.booleancreateVoucherInvalidation(java.lang.String voucherCode, OrderModel order)CreatesVoucherInvalidationafter the voucher is redeemed for the ordervoiddelete(VoucherModel voucher)java.util.Collection<VoucherModel>getAllVouchers()java.util.Collection<java.lang.String>getAppliedVoucherCodes(CartModel cart)Searches for all applied vouchers for the specific cartjava.util.Collection<java.lang.String>getAppliedVoucherCodes(OrderModel order)java.util.Collection<DiscountModel>getAppliedVouchers(AbstractOrderModel order)Given the order get a list of applied vouchersjava.util.Collection<PromotionVoucherModel>getPromotionVouchers(java.lang.String voucherCode)given the voucher code get a collection of related promotion vouchersjava.util.Collection<SerialVoucherModel>getSerialVouchers(java.lang.String voucherCode)given the voucher code get a collection of related serial vouchersVoucherModelgetVoucher(java.lang.String voucherCode)Get a voucher for a given voucher codebooleanredeemVoucher(java.lang.String voucherCode, CartModel cart)VoucherInvalidationModelredeemVoucher(java.lang.String voucherCode, OrderModel order)protected voidrefresh(AbstractOrderModel order)voidreleaseVoucher(java.lang.String voucherCode, CartModel cart)Releases the voucher for the cartvoidreleaseVoucher(java.lang.String voucherCode, OrderModel order)VoucherInvalidationModelreserveVoucher(java.lang.String voucherCode, OrderModel order)voidsave(VoucherModel voucher)protected voidsaveIfModified(AbstractOrderModel order)-
Methods inherited from class de.hybris.platform.voucher.impl.AbstractVoucherService
getAbstractOrder, getCart, getOrder, getProduct, getRestriction, getUser, getVoucher
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManager
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
-
-
-
Method Detail
-
afterOrderCreation
public void afterOrderCreation(OrderModel order, CartModel cart)
Description copied from interface:VoucherServiceTransfers vouchers form cart to newly created order. Please make sure to call this always afterOrderManager.createOrder(de.hybris.platform.jalo.order.AbstractOrder).- Specified by:
afterOrderCreationin interfaceVoucherService- Parameters:
order- the newly created ordercart- the cart which this order has been created from
-
createVoucherInvalidation
public boolean createVoucherInvalidation(java.lang.String voucherCode, OrderModel order)Description copied from interface:VoucherServiceCreatesVoucherInvalidationafter the voucher is redeemed for the order- Specified by:
createVoucherInvalidationin interfaceVoucherService- Parameters:
voucherCode- voucher code to be redeemedorder- order for which the voucher will be redeemed- Returns:
- true if the voucher has been redeemed for the given order
-
getAllVouchers
public java.util.Collection<VoucherModel> getAllVouchers()
- Specified by:
getAllVouchersin interfaceVoucherService- Returns:
- a Collection with all found
Vouchers
-
getAppliedVoucherCodes
public java.util.Collection<java.lang.String> getAppliedVoucherCodes(CartModel cart)
Description copied from interface:VoucherServiceSearches for all applied vouchers for the specific cart- Specified by:
getAppliedVoucherCodesin interfaceVoucherService- Parameters:
cart- cart for which the vouchers are applied- Returns:
- all applied voucher codes
-
getAppliedVoucherCodes
public java.util.Collection<java.lang.String> getAppliedVoucherCodes(OrderModel order)
- Specified by:
getAppliedVoucherCodesin interfaceVoucherService
-
getAppliedVouchers
public java.util.Collection<DiscountModel> getAppliedVouchers(AbstractOrderModel order)
Description copied from interface:VoucherServiceGiven the order get a list of applied vouchers- Specified by:
getAppliedVouchersin interfaceVoucherService- Parameters:
order- the given order- Returns:
- a Collection with all applied
Vouchers for this order
-
getPromotionVouchers
public java.util.Collection<PromotionVoucherModel> getPromotionVouchers(java.lang.String voucherCode)
Description copied from interface:VoucherServicegiven the voucher code get a collection of related promotion vouchers- Specified by:
getPromotionVouchersin interfaceVoucherService- Parameters:
voucherCode- the code- Returns:
- a Collection of
PromotionVouchers
-
getSerialVouchers
public java.util.Collection<SerialVoucherModel> getSerialVouchers(java.lang.String voucherCode)
Description copied from interface:VoucherServicegiven the voucher code get a collection of related serial vouchers- Specified by:
getSerialVouchersin interfaceVoucherService- Parameters:
voucherCode- the code- Returns:
- a Collection of
SerialVouchers
-
getVoucher
public VoucherModel getVoucher(java.lang.String voucherCode)
Description copied from interface:VoucherServiceGet a voucher for a given voucher code- Specified by:
getVoucherin interfaceVoucherService- Parameters:
voucherCode- the code- Returns:
- the first
Voucherfor the given code. This includesPromotionVoucherandSerialVoucher.
-
redeemVoucher
public boolean redeemVoucher(java.lang.String voucherCode, CartModel cart) throws JaloPriceFactoryExceptionDescription copied from interface:VoucherService- Specified by:
redeemVoucherin interfaceVoucherService- Parameters:
voucherCode- code of the Vouchercart- the cart- Returns:
- true if the redemption was successful
- Throws:
JaloPriceFactoryException- in the case of exception on Jalo layer
-
redeemVoucher
public VoucherInvalidationModel redeemVoucher(java.lang.String voucherCode, OrderModel order)
- Specified by:
redeemVoucherin interfaceVoucherService
-
releaseVoucher
public void releaseVoucher(java.lang.String voucherCode, CartModel cart) throws JaloPriceFactoryExceptionDescription copied from interface:VoucherServiceReleases the voucher for the cart- Specified by:
releaseVoucherin interfaceVoucherService- Parameters:
voucherCode- voucher code to be releasedcart- cart for which the voucher will be released- Throws:
JaloPriceFactoryException- in the case of exception on jalo layer
-
releaseVoucher
public void releaseVoucher(java.lang.String voucherCode, OrderModel order) throws ConsistencyCheckException- Specified by:
releaseVoucherin interfaceVoucherService- Throws:
ConsistencyCheckException
-
reserveVoucher
public VoucherInvalidationModel reserveVoucher(java.lang.String voucherCode, OrderModel order)
- Specified by:
reserveVoucherin interfaceVoucherService
-
delete
public void delete(VoucherModel voucher)
- Specified by:
deletein interfaceVoucherService
-
save
public void save(VoucherModel voucher)
- Specified by:
savein interfaceVoucherService
-
saveIfModified
protected void saveIfModified(AbstractOrderModel order)
-
refresh
protected void refresh(AbstractOrderModel order)
-
-