public class DefaultVoucherModelService extends AbstractVoucherService implements VoucherModelService
AbstractService.SerializableDTOmodelService, sessionService, txManagertenant| Constructor and Description |
|---|
DefaultVoucherModelService() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkVoucherCode(VoucherModel voucher,
java.lang.String voucherCode)
Returns true if the specified voucher code is valid for this voucher.
|
VoucherInvalidationModel |
createVoucherInvalidation(VoucherModel voucher,
java.lang.String voucherCode,
OrderModel order) |
java.lang.String |
generateVoucherCode(VoucherModel voucher) |
VoucherEntrySet |
getApplicableEntries(VoucherModel voucher,
AbstractOrderModel order)
Returns all positions or parts of positions of the specified abstract order that are eligible for this voucher.
|
VoucherValue |
getAppliedValue(VoucherModel voucher,
AbstractOrderModel order)
Returns a VoucherValue object representing the discount value of this voucher.
|
DiscountValue |
getDiscountValue(VoucherModel voucher,
AbstractOrderModel order) |
java.util.List<RestrictionModel> |
getViolatedRestrictions(VoucherModel voucher,
AbstractOrderModel order)
Returns all restrictions that are not fulfilled by the specified abstract order.
|
java.util.List<RestrictionModel> |
getViolatedRestrictions(VoucherModel voucher,
ProductModel product)
Returns all restrictions that are not fulfilled by the specified product.
|
java.util.List<java.lang.String> |
getViolationMessages(VoucherModel voucher,
AbstractOrderModel order) |
java.util.List<java.lang.String> |
getViolationMessages(VoucherModel voucher,
ProductModel product) |
VoucherValue |
getVoucherValue(VoucherModel voucher,
AbstractOrderModel order) |
boolean |
isApplicable(VoucherModel voucher,
AbstractOrderModel order)
Returns true if the specified abstract order is eligible for this voucher.
|
boolean |
isApplicable(VoucherModel voucher,
ProductModel product)
Returns true if the specified product is eligible for this voucher.
|
boolean |
isReservable(VoucherModel voucher,
java.lang.String voucherCode,
AbstractOrderModel order) |
boolean |
isReservable(VoucherModel voucher,
java.lang.String voucherCode,
UserModel user) |
boolean |
redeem(VoucherModel voucher,
java.lang.String voucherCode,
CartModel cart)
WARNING!
If some methods for checking voucher availability are called before this method, all these methods have to be in one synchronize block! Suggested synchronization object is cart. |
VoucherInvalidationModel |
redeem(VoucherModel voucher,
java.lang.String voucherCode,
OrderModel order) |
void |
release(VoucherModel voucher,
java.lang.String voucherCode,
CartModel cart) |
void |
release(VoucherModel voucher,
java.lang.String voucherCode,
OrderModel order) |
VoucherInvalidationModel |
reserve(VoucherModel voucher,
java.lang.String voucherCode,
OrderModel order) |
getAbstractOrder, getCart, getOrder, getProduct, getRestriction, getUser, getVouchergetModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManagerafterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplacepublic boolean checkVoucherCode(VoucherModel voucher, java.lang.String voucherCode)
VoucherModelServicecheckVoucherCode in interface VoucherModelServicevoucher - the vouchervoucherCode - the voucher code to check validity of.public VoucherInvalidationModel createVoucherInvalidation(VoucherModel voucher, java.lang.String voucherCode, OrderModel order)
createVoucherInvalidation in interface VoucherModelServicepublic java.lang.String generateVoucherCode(VoucherModel voucher) throws java.security.NoSuchAlgorithmException
generateVoucherCode in interface VoucherModelServicejava.security.NoSuchAlgorithmExceptionpublic VoucherEntrySet getApplicableEntries(VoucherModel voucher, AbstractOrderModel order)
VoucherModelServicegetApplicableEntries in interface VoucherModelServicevoucher - the voucherorder - the abstract order to get eligible positions of.public VoucherValue getAppliedValue(VoucherModel voucher, AbstractOrderModel order)
VoucherModelServicegetAppliedValue in interface VoucherModelServicevoucher - the voucherorder - the abstract order to get discount value of.public DiscountValue getDiscountValue(VoucherModel voucher, AbstractOrderModel order)
getDiscountValue in interface VoucherModelServicepublic java.util.List<RestrictionModel> getViolatedRestrictions(VoucherModel voucher, AbstractOrderModel order)
VoucherModelServicegetViolatedRestrictions in interface VoucherModelServicevoucher - the voucherorder - the abstract order to return violated restrictions for.public java.util.List<RestrictionModel> getViolatedRestrictions(VoucherModel voucher, ProductModel product)
VoucherModelServicegetViolatedRestrictions in interface VoucherModelServicevoucher - the voucherproduct - the product to return violated restrictions for.public java.util.List<java.lang.String> getViolationMessages(VoucherModel voucher, AbstractOrderModel order)
getViolationMessages in interface VoucherModelServicepublic java.util.List<java.lang.String> getViolationMessages(VoucherModel voucher, ProductModel product)
getViolationMessages in interface VoucherModelServicepublic VoucherValue getVoucherValue(VoucherModel voucher, AbstractOrderModel order)
getVoucherValue in interface VoucherModelServicepublic boolean isApplicable(VoucherModel voucher, AbstractOrderModel order)
VoucherModelServiceisApplicable in interface VoucherModelServicevoucher - the voucherorder - the abstract order to check whether it is eligible for this voucher.public boolean isApplicable(VoucherModel voucher, ProductModel product)
VoucherModelServiceisApplicable in interface VoucherModelServicevoucher - the voucherproduct - the product to check whether it is eligible for this voucher.public boolean isReservable(VoucherModel voucher, java.lang.String voucherCode, UserModel user)
isReservable in interface VoucherModelServicepublic boolean isReservable(VoucherModel voucher, java.lang.String voucherCode, AbstractOrderModel order)
isReservable in interface VoucherModelServicepublic boolean redeem(VoucherModel voucher, java.lang.String voucherCode, CartModel cart) throws JaloPriceFactoryException
VoucherModelService
WARNING!
If some methods for checking voucher availability are called before this method, all these methods have to be in
one synchronize block! Suggested synchronization object is cart.
redeem in interface VoucherModelServiceJaloPriceFactoryExceptionpublic VoucherInvalidationModel redeem(VoucherModel voucher, java.lang.String voucherCode, OrderModel order)
redeem in interface VoucherModelServicepublic void release(VoucherModel voucher, java.lang.String voucherCode, OrderModel order) throws ConsistencyCheckException
release in interface VoucherModelServiceConsistencyCheckExceptionpublic void release(VoucherModel voucher, java.lang.String voucherCode, CartModel cart) throws JaloPriceFactoryException
release in interface VoucherModelServiceJaloPriceFactoryExceptionpublic VoucherInvalidationModel reserve(VoucherModel voucher, java.lang.String voucherCode, OrderModel order)
reserve in interface VoucherModelServiceCopyright © 2018 SAP SE. All Rights Reserved.