1
22
23 package com.liferay.portlet.shopping.service.http;
24
25 import com.liferay.portal.kernel.json.JSONArray;
26 import com.liferay.portal.kernel.json.JSONObject;
27
28 import com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil;
29
30
76 public class ShoppingCouponServiceJSON {
77 public static JSONObject addCoupon(java.lang.String code, boolean autoCode,
78 java.lang.String name, java.lang.String description,
79 int startDateMonth, int startDateDay, int startDateYear,
80 int startDateHour, int startDateMinute, int endDateMonth,
81 int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
82 boolean neverExpire, boolean active, java.lang.String limitCategories,
83 java.lang.String limitSkus, double minOrder, double discount,
84 java.lang.String discountType,
85 com.liferay.portal.service.ServiceContext serviceContext)
86 throws com.liferay.portal.PortalException,
87 com.liferay.portal.SystemException {
88 com.liferay.portlet.shopping.model.ShoppingCoupon returnValue = ShoppingCouponServiceUtil.addCoupon(code,
89 autoCode, name, description, startDateMonth, startDateDay,
90 startDateYear, startDateHour, startDateMinute, endDateMonth,
91 endDateDay, endDateYear, endDateHour, endDateMinute,
92 neverExpire, active, limitCategories, limitSkus, minOrder,
93 discount, discountType, serviceContext);
94
95 return ShoppingCouponJSONSerializer.toJSONObject(returnValue);
96 }
97
98 public static void deleteCoupon(long groupId, long couponId)
99 throws com.liferay.portal.PortalException,
100 com.liferay.portal.SystemException {
101 ShoppingCouponServiceUtil.deleteCoupon(groupId, couponId);
102 }
103
104 public static JSONObject getCoupon(long groupId, long couponId)
105 throws com.liferay.portal.PortalException,
106 com.liferay.portal.SystemException {
107 com.liferay.portlet.shopping.model.ShoppingCoupon returnValue = ShoppingCouponServiceUtil.getCoupon(groupId,
108 couponId);
109
110 return ShoppingCouponJSONSerializer.toJSONObject(returnValue);
111 }
112
113 public static JSONArray search(long groupId, long companyId,
114 java.lang.String code, boolean active, java.lang.String discountType,
115 boolean andOperator, int start, int end)
116 throws com.liferay.portal.PortalException,
117 com.liferay.portal.SystemException {
118 java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> returnValue =
119 ShoppingCouponServiceUtil.search(groupId, companyId, code, active,
120 discountType, andOperator, start, end);
121
122 return ShoppingCouponJSONSerializer.toJSONArray(returnValue);
123 }
124
125 public static JSONObject updateCoupon(long couponId, java.lang.String name,
126 java.lang.String description, int startDateMonth, int startDateDay,
127 int startDateYear, int startDateHour, int startDateMinute,
128 int endDateMonth, int endDateDay, int endDateYear, int endDateHour,
129 int endDateMinute, boolean neverExpire, boolean active,
130 java.lang.String limitCategories, java.lang.String limitSkus,
131 double minOrder, double discount, java.lang.String discountType,
132 com.liferay.portal.service.ServiceContext serviceContext)
133 throws com.liferay.portal.PortalException,
134 com.liferay.portal.SystemException {
135 com.liferay.portlet.shopping.model.ShoppingCoupon returnValue = ShoppingCouponServiceUtil.updateCoupon(couponId,
136 name, description, startDateMonth, startDateDay, startDateYear,
137 startDateHour, startDateMinute, endDateMonth, endDateDay,
138 endDateYear, endDateHour, endDateMinute, neverExpire, active,
139 limitCategories, limitSkus, minOrder, discount, discountType,
140 serviceContext);
141
142 return ShoppingCouponJSONSerializer.toJSONObject(returnValue);
143 }
144 }