1
22
23 package com.liferay.portlet.shopping.service.impl;
24
25 import com.liferay.portal.PortalException;
26 import com.liferay.portal.SystemException;
27 import com.liferay.portal.security.permission.ActionKeys;
28 import com.liferay.portal.service.permission.PortletPermissionUtil;
29 import com.liferay.portal.util.PortletKeys;
30 import com.liferay.portlet.shopping.model.ShoppingCoupon;
31 import com.liferay.portlet.shopping.service.base.ShoppingCouponServiceBaseImpl;
32
33 import java.util.List;
34
35
41 public class ShoppingCouponServiceImpl extends ShoppingCouponServiceBaseImpl {
42
43 public ShoppingCoupon addCoupon(
44 long plid, String code, boolean autoCode, String name,
45 String description, int startDateMonth, int startDateDay,
46 int startDateYear, int startDateHour, int startDateMinute,
47 int endDateMonth, int endDateDay, int endDateYear, int endDateHour,
48 int endDateMinute, boolean neverExpire, boolean active,
49 String limitCategories, String limitSkus, double minOrder,
50 double discount, String discountType)
51 throws PortalException, SystemException {
52
53 PortletPermissionUtil.check(
54 getPermissionChecker(), plid, PortletKeys.SHOPPING,
55 ActionKeys.MANAGE_COUPONS);
56
57 return shoppingCouponLocalService.addCoupon(
58 getUserId(), plid, code, autoCode, name, description,
59 startDateMonth, startDateDay, startDateYear, startDateHour,
60 startDateMinute, endDateMonth, endDateDay, endDateYear, endDateHour,
61 endDateMinute, neverExpire, active, limitCategories, limitSkus,
62 minOrder, discount, discountType);
63 }
64
65 public void deleteCoupon(long plid, long couponId)
66 throws PortalException, SystemException {
67
68 PortletPermissionUtil.check(
69 getPermissionChecker(), plid, PortletKeys.SHOPPING,
70 ActionKeys.MANAGE_COUPONS);
71
72 shoppingCouponLocalService.deleteCoupon(couponId);
73 }
74
75 public ShoppingCoupon getCoupon(long plid, long couponId)
76 throws PortalException, SystemException {
77
78 PortletPermissionUtil.check(
79 getPermissionChecker(), plid, PortletKeys.SHOPPING,
80 ActionKeys.MANAGE_COUPONS);
81
82 return shoppingCouponLocalService.getCoupon(couponId);
83 }
84
85 public List<ShoppingCoupon> search(
86 long plid, long companyId, String code, boolean active,
87 String discountType, boolean andOperator, int begin, int end)
88 throws PortalException, SystemException {
89
90 PortletPermissionUtil.check(
91 getPermissionChecker(), plid, PortletKeys.SHOPPING,
92 ActionKeys.MANAGE_COUPONS);
93
94 return shoppingCouponLocalService.search(
95 plid, companyId, code, active, discountType, andOperator, begin,
96 end);
97 }
98
99 public ShoppingCoupon updateCoupon(
100 long plid, long couponId, String name, String description,
101 int startDateMonth, int startDateDay, int startDateYear,
102 int startDateHour, int startDateMinute, int endDateMonth,
103 int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
104 boolean neverExpire, boolean active, String limitCategories,
105 String limitSkus, double minOrder, double discount,
106 String discountType)
107 throws PortalException, SystemException {
108
109 PortletPermissionUtil.check(
110 getPermissionChecker(), plid, PortletKeys.SHOPPING,
111 ActionKeys.MANAGE_COUPONS);
112
113 return shoppingCouponLocalService.updateCoupon(
114 getUserId(), couponId, name, description, startDateMonth,
115 startDateDay, startDateYear, startDateHour, startDateMinute,
116 endDateMonth, endDateDay, endDateYear, endDateHour, endDateMinute,
117 neverExpire, active, limitCategories, limitSkus, minOrder, discount,
118 discountType);
119 }
120
121 }