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 public ShoppingCoupon addCoupon(
033 String code, boolean autoCode, String name, String description,
034 int startDateMonth, int startDateDay, int startDateYear,
035 int startDateHour, int startDateMinute, int endDateMonth,
036 int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
037 boolean neverExpire, boolean active, String limitCategories,
038 String limitSkus, double minOrder, double discount,
039 String discountType, ServiceContext serviceContext)
040 throws PortalException, SystemException {
041
042 ShoppingPermission.check(
043 getPermissionChecker(), serviceContext.getScopeGroupId(),
044 ActionKeys.MANAGE_COUPONS);
045
046 return shoppingCouponLocalService.addCoupon(
047 getUserId(), code, autoCode, name, description,
048 startDateMonth, startDateDay, startDateYear, startDateHour,
049 startDateMinute, endDateMonth, endDateDay, endDateYear, endDateHour,
050 endDateMinute, neverExpire, active, limitCategories, limitSkus,
051 minOrder, discount, discountType, serviceContext);
052 }
053
054 public void deleteCoupon(long groupId, long couponId)
055 throws PortalException, SystemException {
056
057 ShoppingPermission.check(
058 getPermissionChecker(), groupId, ActionKeys.MANAGE_COUPONS);
059
060 shoppingCouponLocalService.deleteCoupon(couponId);
061 }
062
063 public ShoppingCoupon getCoupon(long groupId, long couponId)
064 throws PortalException, SystemException {
065
066 ShoppingPermission.check(
067 getPermissionChecker(), groupId, ActionKeys.MANAGE_COUPONS);
068
069 return shoppingCouponLocalService.getCoupon(couponId);
070 }
071
072 public List<ShoppingCoupon> search(
073 long groupId, long companyId, String code, boolean active,
074 String discountType, boolean andOperator, int start, int end)
075 throws PortalException, SystemException {
076
077 ShoppingPermission.check(
078 getPermissionChecker(), groupId, ActionKeys.MANAGE_COUPONS);
079
080 return shoppingCouponLocalService.search(
081 groupId, companyId, code, active, discountType, andOperator, start,
082 end);
083 }
084
085 public ShoppingCoupon updateCoupon(
086 long couponId, String name, String description, int startDateMonth,
087 int startDateDay, int startDateYear, int startDateHour,
088 int startDateMinute, int endDateMonth, int endDateDay,
089 int endDateYear, int endDateHour, int endDateMinute,
090 boolean neverExpire, boolean active, String limitCategories,
091 String limitSkus, double minOrder, double discount,
092 String discountType, ServiceContext serviceContext)
093 throws PortalException, SystemException {
094
095 ShoppingPermission.check(
096 getPermissionChecker(), serviceContext.getScopeGroupId(),
097 ActionKeys.MANAGE_COUPONS);
098
099 return shoppingCouponLocalService.updateCoupon(
100 getUserId(), couponId, name, description, startDateMonth,
101 startDateDay, startDateYear, startDateHour, startDateMinute,
102 endDateMonth, endDateDay, endDateYear, endDateHour, endDateMinute,
103 neverExpire, active, limitCategories, limitSkus, minOrder, discount,
104 discountType, serviceContext);
105 }
106
107 }