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
40 public class ShoppingCouponServiceImpl extends ShoppingCouponServiceBaseImpl {
41
42 public ShoppingCoupon addCoupon(
43 long plid, String code, boolean autoCode, String name,
44 String description, int startDateMonth, int startDateDay,
45 int startDateYear, int startDateHour, int startDateMinute,
46 int endDateMonth, int endDateDay, int endDateYear, int endDateHour,
47 int endDateMinute, boolean neverExpire, boolean active,
48 String limitCategories, String limitSkus, double minOrder,
49 double discount, String discountType)
50 throws PortalException, SystemException {
51
52 PortletPermissionUtil.check(
53 getPermissionChecker(), plid, PortletKeys.SHOPPING,
54 ActionKeys.MANAGE_COUPONS);
55
56 return shoppingCouponLocalService.addCoupon(
57 getUserId(), plid, code, autoCode, name, description,
58 startDateMonth, startDateDay, startDateYear, startDateHour,
59 startDateMinute, endDateMonth, endDateDay, endDateYear, endDateHour,
60 endDateMinute, neverExpire, active, limitCategories, limitSkus,
61 minOrder, discount, discountType);
62 }
63
64 public void deleteCoupon(long plid, long couponId)
65 throws PortalException, SystemException {
66
67 PortletPermissionUtil.check(
68 getPermissionChecker(), plid, PortletKeys.SHOPPING,
69 ActionKeys.MANAGE_COUPONS);
70
71 shoppingCouponLocalService.deleteCoupon(couponId);
72 }
73
74 public ShoppingCoupon getCoupon(long plid, long couponId)
75 throws PortalException, SystemException {
76
77 PortletPermissionUtil.check(
78 getPermissionChecker(), plid, PortletKeys.SHOPPING,
79 ActionKeys.MANAGE_COUPONS);
80
81 return shoppingCouponLocalService.getCoupon(couponId);
82 }
83
84 public List<ShoppingCoupon> search(
85 long plid, long companyId, String code, boolean active,
86 String discountType, boolean andOperator, int start, int end)
87 throws PortalException, SystemException {
88
89 PortletPermissionUtil.check(
90 getPermissionChecker(), plid, PortletKeys.SHOPPING,
91 ActionKeys.MANAGE_COUPONS);
92
93 return shoppingCouponLocalService.search(
94 plid, companyId, code, active, discountType, andOperator, start,
95 end);
96 }
97
98 public ShoppingCoupon updateCoupon(
99 long plid, long couponId, String name, String description,
100 int startDateMonth, int startDateDay, int startDateYear,
101 int startDateHour, int startDateMinute, int endDateMonth,
102 int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
103 boolean neverExpire, boolean active, String limitCategories,
104 String limitSkus, double minOrder, double discount,
105 String discountType)
106 throws PortalException, SystemException {
107
108 PortletPermissionUtil.check(
109 getPermissionChecker(), plid, PortletKeys.SHOPPING,
110 ActionKeys.MANAGE_COUPONS);
111
112 return shoppingCouponLocalService.updateCoupon(
113 getUserId(), couponId, name, description, startDateMonth,
114 startDateDay, startDateYear, startDateHour, startDateMinute,
115 endDateMonth, endDateDay, endDateYear, endDateHour, endDateMinute,
116 neverExpire, active, limitCategories, limitSkus, minOrder, discount,
117 discountType);
118 }
119
120 }