1
14
15 package com.liferay.portlet.shopping.service.impl;
16
17 import com.liferay.portal.kernel.exception.PortalException;
18 import com.liferay.portal.kernel.exception.SystemException;
19 import com.liferay.portal.security.permission.ActionKeys;
20 import com.liferay.portal.service.ServiceContext;
21 import com.liferay.portlet.shopping.model.ShoppingCoupon;
22 import com.liferay.portlet.shopping.service.base.ShoppingCouponServiceBaseImpl;
23 import com.liferay.portlet.shopping.service.permission.ShoppingPermission;
24
25 import java.util.List;
26
27
32 public class ShoppingCouponServiceImpl extends ShoppingCouponServiceBaseImpl {
33
34 public ShoppingCoupon addCoupon(
35 String code, boolean autoCode, String name, String description,
36 int startDateMonth, int startDateDay, int startDateYear,
37 int startDateHour, int startDateMinute, int endDateMonth,
38 int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
39 boolean neverExpire, boolean active, String limitCategories,
40 String limitSkus, double minOrder, double discount,
41 String discountType, ServiceContext serviceContext)
42 throws PortalException, SystemException {
43
44 ShoppingPermission.check(
45 getPermissionChecker(), serviceContext.getScopeGroupId(),
46 ActionKeys.MANAGE_COUPONS);
47
48 return shoppingCouponLocalService.addCoupon(
49 getUserId(), code, autoCode, name, description,
50 startDateMonth, startDateDay, startDateYear, startDateHour,
51 startDateMinute, endDateMonth, endDateDay, endDateYear, endDateHour,
52 endDateMinute, neverExpire, active, limitCategories, limitSkus,
53 minOrder, discount, discountType, serviceContext);
54 }
55
56 public void deleteCoupon(long groupId, long couponId)
57 throws PortalException, SystemException {
58
59 ShoppingPermission.check(
60 getPermissionChecker(), groupId, ActionKeys.MANAGE_COUPONS);
61
62 shoppingCouponLocalService.deleteCoupon(couponId);
63 }
64
65 public ShoppingCoupon getCoupon(long groupId, long couponId)
66 throws PortalException, SystemException {
67
68 ShoppingPermission.check(
69 getPermissionChecker(), groupId, ActionKeys.MANAGE_COUPONS);
70
71 return shoppingCouponLocalService.getCoupon(couponId);
72 }
73
74 public List<ShoppingCoupon> search(
75 long groupId, long companyId, String code, boolean active,
76 String discountType, boolean andOperator, int start, int end)
77 throws PortalException, SystemException {
78
79 ShoppingPermission.check(
80 getPermissionChecker(), groupId, ActionKeys.MANAGE_COUPONS);
81
82 return shoppingCouponLocalService.search(
83 groupId, companyId, code, active, discountType, andOperator, start,
84 end);
85 }
86
87 public ShoppingCoupon updateCoupon(
88 long couponId, String name, String description, int startDateMonth,
89 int startDateDay, int startDateYear, int startDateHour,
90 int startDateMinute, int endDateMonth, int endDateDay,
91 int endDateYear, int endDateHour, int endDateMinute,
92 boolean neverExpire, boolean active, String limitCategories,
93 String limitSkus, double minOrder, double discount,
94 String discountType, ServiceContext serviceContext)
95 throws PortalException, SystemException {
96
97 ShoppingPermission.check(
98 getPermissionChecker(), serviceContext.getScopeGroupId(),
99 ActionKeys.MANAGE_COUPONS);
100
101 return shoppingCouponLocalService.updateCoupon(
102 getUserId(), couponId, name, description, startDateMonth,
103 startDateDay, startDateYear, startDateHour, startDateMinute,
104 endDateMonth, endDateDay, endDateYear, endDateHour, endDateMinute,
105 neverExpire, active, limitCategories, limitSkus, minOrder, discount,
106 discountType, serviceContext);
107 }
108
109 }