public class DefaultCouponService extends java.lang.Object implements CouponService
| Constructor and Description |
|---|
DefaultCouponService() |
| Modifier and Type | Method and Description |
|---|---|
protected CouponResponse |
assertCouponCodeInOrder(java.lang.String couponCode,
AbstractOrderModel order) |
protected java.util.function.Predicate<java.lang.String> |
checkMatch(AbstractCouponModel coupon,
java.lang.String couponCode) |
protected java.lang.String |
clearCouponCode(java.lang.String couponCode) |
protected boolean |
containsCouponCode(java.lang.String couponCode,
AbstractOrderModel order)
returns true if the given couponCode is part of the given order
|
protected BaseSiteService |
getBaseSiteService() |
protected CalculationService |
getCalculationService() |
protected CouponCodeGenerationService |
getCouponCodeGenerationService() |
java.util.Optional<AbstractCouponModel> |
getCouponForCode(java.lang.String couponCode)
Returns Coupon Model object for a given coupon code
|
protected CouponManagementService |
getCouponManagementService() |
protected ModelService |
getModelService() |
protected java.util.Collection<PromotionGroupModel> |
getPromotionGroups() |
protected PromotionsService |
getPromotionsService() |
java.util.Optional<AbstractCouponModel> |
getValidatedCouponForCode(java.lang.String couponCode)
Returns Coupon Model object for a given coupon code with validation
|
protected void |
recalculateOrder(AbstractOrderModel order)
Recalculates the given order and updates the promotions.
|
CouponResponse |
redeemCoupon(java.lang.String couponCode,
CartModel cart)
Redeem the coupon code associated with the cart.
|
CouponResponse |
redeemCoupon(java.lang.String couponCode,
OrderModel order)
Create a coupon redemption instance for the coupon redeemed for the order.
|
protected void |
redeemCouponCode(CartModel cart,
java.lang.String clearedCouponCode,
CouponResponse response) |
void |
releaseCouponCode(java.lang.String couponCode,
AbstractOrderModel order)
Release the coupon code from given cart.
|
protected void |
removeCouponAndTriggerCalculation(java.lang.String couponCode,
AbstractOrderModel order) |
void |
setBaseSiteService(BaseSiteService baseSiteService) |
void |
setCalculationService(CalculationService calculationService) |
void |
setCouponCodeGenerationService(CouponCodeGenerationService couponCodeGenerationService) |
void |
setCouponManagementService(CouponManagementService couponManagementService) |
void |
setModelService(ModelService modelService) |
void |
setPromotionsService(PromotionsService promotionsService) |
CouponResponse |
validateCouponCode(java.lang.String couponCode,
UserModel user)
Validate if provided
couponCode is valid. |
CouponResponse |
verifyCouponCode(java.lang.String couponCode,
AbstractOrderModel order)
Verify if provided
couponCode is valid. |
public CouponResponse verifyCouponCode(java.lang.String couponCode, AbstractOrderModel order)
CouponServicecouponCode is valid.verifyCouponCode in interface CouponServicecouponCode - coupon code to validateorder - order for which coupon should be validatedpublic CouponResponse validateCouponCode(java.lang.String couponCode, UserModel user)
CouponServicecouponCode is valid.validateCouponCode in interface CouponServicecouponCode - coupon code to validateuser - user for which coupon should be validatedpublic CouponResponse redeemCoupon(java.lang.String couponCode, CartModel cart)
CouponServiceredeemCoupon in interface CouponServicecouponCode - Coupon code to redeemcart - CartModel to redeem couponprotected void redeemCouponCode(CartModel cart, java.lang.String clearedCouponCode, CouponResponse response)
public CouponResponse redeemCoupon(java.lang.String couponCode, OrderModel order)
CouponServiceredeemCoupon in interface CouponServicecouponCode - Coupon code to redeemorder - OrderModel to redeem couponprotected java.lang.String clearCouponCode(java.lang.String couponCode)
protected CouponResponse assertCouponCodeInOrder(java.lang.String couponCode, AbstractOrderModel order)
protected boolean containsCouponCode(java.lang.String couponCode,
AbstractOrderModel order)
couponCode - the couponCode to checkorder - the abstract order to checkprotected java.util.function.Predicate<java.lang.String> checkMatch(AbstractCouponModel coupon, java.lang.String couponCode)
protected void recalculateOrder(AbstractOrderModel order)
CalculationService.calculate(AbstractOrderModel) and
PromotionsService.updatePromotions(Collection, AbstractOrderModel)CouponServiceException - if any errors happen during recalculationpublic java.util.Optional<AbstractCouponModel> getCouponForCode(java.lang.String couponCode)
CouponServicegetCouponForCode in interface CouponServicecouponCode - Coupon code to get coupon details forAbstractCouponModelpublic java.util.Optional<AbstractCouponModel> getValidatedCouponForCode(java.lang.String couponCode)
CouponServicegetValidatedCouponForCode in interface CouponServicecouponCode - Coupon code to get coupon details forAbstractCouponModelpublic void releaseCouponCode(java.lang.String couponCode,
AbstractOrderModel order)
CouponServicereleaseCouponCode in interface CouponServicecouponCode - Coupon code to releaseorder - AbstractOrderModel to release the coupon fromprotected void removeCouponAndTriggerCalculation(java.lang.String couponCode,
AbstractOrderModel order)
protected java.util.Collection<PromotionGroupModel> getPromotionGroups()
protected CouponManagementService getCouponManagementService()
public void setCouponManagementService(CouponManagementService couponManagementService)
protected CalculationService getCalculationService()
public void setCalculationService(CalculationService calculationService)
protected PromotionsService getPromotionsService()
public void setPromotionsService(PromotionsService promotionsService)
protected BaseSiteService getBaseSiteService()
public void setBaseSiteService(BaseSiteService baseSiteService)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
protected CouponCodeGenerationService getCouponCodeGenerationService()
public void setCouponCodeGenerationService(CouponCodeGenerationService couponCodeGenerationService)
Copyright © 2018 SAP SE. All Rights Reserved.