001
014
015 package com.liferay.portlet.shopping.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.security.permission.ActionKeys;
020 import com.liferay.portal.service.ServiceContext;
021 import com.liferay.portlet.shopping.model.ShoppingCoupon;
022 import com.liferay.portlet.shopping.service.base.ShoppingCouponServiceBaseImpl;
023 import com.liferay.portlet.shopping.service.permission.ShoppingPermission;
024
025 import java.util.List;
026
027
030 public class ShoppingCouponServiceImpl extends ShoppingCouponServiceBaseImpl {
031
032 @Override
033 public ShoppingCoupon addCoupon(
034 String code, boolean autoCode, String name, String description,
035 int startDateMonth, int startDateDay, int startDateYear,
036 int startDateHour, int startDateMinute, int endDateMonth,
037 int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
038 boolean neverExpire, boolean active, String limitCategories,
039 String limitSkus, double minOrder, double discount,
040 String discountType, ServiceContext serviceContext)
041 throws PortalException, SystemException {
042
043 ShoppingPermission.check(
044 getPermissionChecker(), serviceContext.getScopeGroupId(),
045 ActionKeys.MANAGE_COUPONS);
046
047 return shoppingCouponLocalService.addCoupon(
048 getUserId(), code, autoCode, name, description, startDateMonth,
049 startDateDay, startDateYear, startDateHour, startDateMinute,
050 endDateMonth, endDateDay, endDateYear, endDateHour, endDateMinute,
051 neverExpire, active, limitCategories, limitSkus, minOrder, discount,
052 discountType, serviceContext);
053 }
054
055 @Override
056 public void deleteCoupon(long groupId, long couponId)
057 throws PortalException, SystemException {
058
059 ShoppingPermission.check(
060 getPermissionChecker(), groupId, ActionKeys.MANAGE_COUPONS);
061
062 shoppingCouponLocalService.deleteCoupon(couponId);
063 }
064
065 @Override
066 public ShoppingCoupon getCoupon(long groupId, long couponId)
067 throws PortalException, SystemException {
068
069 ShoppingPermission.check(
070 getPermissionChecker(), groupId, ActionKeys.MANAGE_COUPONS);
071
072 return shoppingCouponLocalService.getCoupon(couponId);
073 }
074
075 @Override
076 public List<ShoppingCoupon> search(
077 long groupId, long companyId, String code, boolean active,
078 String discountType, boolean andOperator, int start, int end)
079 throws PortalException, SystemException {
080
081 ShoppingPermission.check(
082 getPermissionChecker(), groupId, ActionKeys.MANAGE_COUPONS);
083
084 return shoppingCouponLocalService.search(
085 groupId, companyId, code, active, discountType, andOperator, start,
086 end);
087 }
088
089 @Override
090 public ShoppingCoupon updateCoupon(
091 long couponId, String name, String description, int startDateMonth,
092 int startDateDay, int startDateYear, int startDateHour,
093 int startDateMinute, int endDateMonth, int endDateDay,
094 int endDateYear, int endDateHour, int endDateMinute,
095 boolean neverExpire, boolean active, String limitCategories,
096 String limitSkus, double minOrder, double discount,
097 String discountType, ServiceContext serviceContext)
098 throws PortalException, SystemException {
099
100 ShoppingPermission.check(
101 getPermissionChecker(), serviceContext.getScopeGroupId(),
102 ActionKeys.MANAGE_COUPONS);
103
104 return shoppingCouponLocalService.updateCoupon(
105 getUserId(), couponId, name, description, startDateMonth,
106 startDateDay, startDateYear, startDateHour, startDateMinute,
107 endDateMonth, endDateDay, endDateYear, endDateHour, endDateMinute,
108 neverExpire, active, limitCategories, limitSkus, minOrder, discount,
109 discountType, serviceContext);
110 }
111
112 }