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