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