1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.shopping.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.BooleanWrapper;
20  import com.liferay.portal.kernel.util.DoubleWrapper;
21  import com.liferay.portal.kernel.util.IntegerWrapper;
22  import com.liferay.portal.kernel.util.LongWrapper;
23  import com.liferay.portal.kernel.util.MethodWrapper;
24  import com.liferay.portal.kernel.util.NullWrapper;
25  import com.liferay.portal.security.auth.HttpPrincipal;
26  import com.liferay.portal.service.http.TunnelUtil;
27  
28  import com.liferay.portlet.shopping.service.ShoppingOrderServiceUtil;
29  
30  /**
31   * <a href="ShoppingOrderServiceHttp.java.html"><b><i>View Source</i></b></a>
32   *
33   * <p>
34   * ServiceBuilder generated this class. Modifications in this class will be
35   * overwritten the next time is generated.
36   * </p>
37   *
38   * <p>
39   * This class provides a HTTP utility for the
40   * {@link com.liferay.portlet.shopping.service.ShoppingOrderServiceUtil} service utility. The
41   * static methods of this class calls the same methods of the service utility.
42   * However, the signatures are different because it requires an additional
43   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
44   * </p>
45   *
46   * <p>
47   * The benefits of using the HTTP utility is that it is fast and allows for
48   * tunneling without the cost of serializing to text. The drawback is that it
49   * only works with Java.
50   * </p>
51   *
52   * <p>
53   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
54   * configure security.
55   * </p>
56   *
57   * <p>
58   * The HTTP utility is only generated for remote services.
59   * </p>
60   *
61   * @author    Brian Wing Shun Chan
62   * @see       ShoppingOrderServiceSoap
63   * @see       com.liferay.portal.security.auth.HttpPrincipal
64   * @see       com.liferay.portlet.shopping.service.ShoppingOrderServiceUtil
65   * @generated
66   */
67  public class ShoppingOrderServiceHttp {
68      public static void completeOrder(HttpPrincipal httpPrincipal, long groupId,
69          java.lang.String number, java.lang.String ppTxnId,
70          java.lang.String ppPaymentStatus, double ppPaymentGross,
71          java.lang.String ppReceiverEmail, java.lang.String ppPayerEmail)
72          throws com.liferay.portal.kernel.exception.PortalException,
73              com.liferay.portal.kernel.exception.SystemException {
74          try {
75              Object paramObj0 = new LongWrapper(groupId);
76  
77              Object paramObj1 = number;
78  
79              if (number == null) {
80                  paramObj1 = new NullWrapper("java.lang.String");
81              }
82  
83              Object paramObj2 = ppTxnId;
84  
85              if (ppTxnId == null) {
86                  paramObj2 = new NullWrapper("java.lang.String");
87              }
88  
89              Object paramObj3 = ppPaymentStatus;
90  
91              if (ppPaymentStatus == null) {
92                  paramObj3 = new NullWrapper("java.lang.String");
93              }
94  
95              Object paramObj4 = new DoubleWrapper(ppPaymentGross);
96  
97              Object paramObj5 = ppReceiverEmail;
98  
99              if (ppReceiverEmail == null) {
100                 paramObj5 = new NullWrapper("java.lang.String");
101             }
102 
103             Object paramObj6 = ppPayerEmail;
104 
105             if (ppPayerEmail == null) {
106                 paramObj6 = new NullWrapper("java.lang.String");
107             }
108 
109             MethodWrapper methodWrapper = new MethodWrapper(ShoppingOrderServiceUtil.class.getName(),
110                     "completeOrder",
111                     new Object[] {
112                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
113                         paramObj5, paramObj6
114                     });
115 
116             try {
117                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
118             }
119             catch (Exception e) {
120                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
121                     throw (com.liferay.portal.kernel.exception.PortalException)e;
122                 }
123 
124                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
125                     throw (com.liferay.portal.kernel.exception.SystemException)e;
126                 }
127 
128                 throw new com.liferay.portal.kernel.exception.SystemException(e);
129             }
130         }
131         catch (com.liferay.portal.kernel.exception.SystemException se) {
132             _log.error(se, se);
133 
134             throw se;
135         }
136     }
137 
138     public static void deleteOrder(HttpPrincipal httpPrincipal, long groupId,
139         long orderId)
140         throws com.liferay.portal.kernel.exception.PortalException,
141             com.liferay.portal.kernel.exception.SystemException {
142         try {
143             Object paramObj0 = new LongWrapper(groupId);
144 
145             Object paramObj1 = new LongWrapper(orderId);
146 
147             MethodWrapper methodWrapper = new MethodWrapper(ShoppingOrderServiceUtil.class.getName(),
148                     "deleteOrder", new Object[] { paramObj0, paramObj1 });
149 
150             try {
151                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
152             }
153             catch (Exception e) {
154                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
155                     throw (com.liferay.portal.kernel.exception.PortalException)e;
156                 }
157 
158                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
159                     throw (com.liferay.portal.kernel.exception.SystemException)e;
160                 }
161 
162                 throw new com.liferay.portal.kernel.exception.SystemException(e);
163             }
164         }
165         catch (com.liferay.portal.kernel.exception.SystemException se) {
166             _log.error(se, se);
167 
168             throw se;
169         }
170     }
171 
172     public static com.liferay.portlet.shopping.model.ShoppingOrder getOrder(
173         HttpPrincipal httpPrincipal, long groupId, long orderId)
174         throws com.liferay.portal.kernel.exception.PortalException,
175             com.liferay.portal.kernel.exception.SystemException {
176         try {
177             Object paramObj0 = new LongWrapper(groupId);
178 
179             Object paramObj1 = new LongWrapper(orderId);
180 
181             MethodWrapper methodWrapper = new MethodWrapper(ShoppingOrderServiceUtil.class.getName(),
182                     "getOrder", new Object[] { paramObj0, paramObj1 });
183 
184             Object returnObj = null;
185 
186             try {
187                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
188             }
189             catch (Exception e) {
190                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
191                     throw (com.liferay.portal.kernel.exception.PortalException)e;
192                 }
193 
194                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
195                     throw (com.liferay.portal.kernel.exception.SystemException)e;
196                 }
197 
198                 throw new com.liferay.portal.kernel.exception.SystemException(e);
199             }
200 
201             return (com.liferay.portlet.shopping.model.ShoppingOrder)returnObj;
202         }
203         catch (com.liferay.portal.kernel.exception.SystemException se) {
204             _log.error(se, se);
205 
206             throw se;
207         }
208     }
209 
210     public static void sendEmail(HttpPrincipal httpPrincipal, long groupId,
211         long orderId, java.lang.String emailType)
212         throws com.liferay.portal.kernel.exception.PortalException,
213             com.liferay.portal.kernel.exception.SystemException {
214         try {
215             Object paramObj0 = new LongWrapper(groupId);
216 
217             Object paramObj1 = new LongWrapper(orderId);
218 
219             Object paramObj2 = emailType;
220 
221             if (emailType == null) {
222                 paramObj2 = new NullWrapper("java.lang.String");
223             }
224 
225             MethodWrapper methodWrapper = new MethodWrapper(ShoppingOrderServiceUtil.class.getName(),
226                     "sendEmail",
227                     new Object[] { paramObj0, paramObj1, paramObj2 });
228 
229             try {
230                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
231             }
232             catch (Exception e) {
233                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
234                     throw (com.liferay.portal.kernel.exception.PortalException)e;
235                 }
236 
237                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
238                     throw (com.liferay.portal.kernel.exception.SystemException)e;
239                 }
240 
241                 throw new com.liferay.portal.kernel.exception.SystemException(e);
242             }
243         }
244         catch (com.liferay.portal.kernel.exception.SystemException se) {
245             _log.error(se, se);
246 
247             throw se;
248         }
249     }
250 
251     public static com.liferay.portlet.shopping.model.ShoppingOrder updateOrder(
252         HttpPrincipal httpPrincipal, long groupId, long orderId,
253         java.lang.String ppTxnId, java.lang.String ppPaymentStatus,
254         double ppPaymentGross, java.lang.String ppReceiverEmail,
255         java.lang.String ppPayerEmail)
256         throws com.liferay.portal.kernel.exception.PortalException,
257             com.liferay.portal.kernel.exception.SystemException {
258         try {
259             Object paramObj0 = new LongWrapper(groupId);
260 
261             Object paramObj1 = new LongWrapper(orderId);
262 
263             Object paramObj2 = ppTxnId;
264 
265             if (ppTxnId == null) {
266                 paramObj2 = new NullWrapper("java.lang.String");
267             }
268 
269             Object paramObj3 = ppPaymentStatus;
270 
271             if (ppPaymentStatus == null) {
272                 paramObj3 = new NullWrapper("java.lang.String");
273             }
274 
275             Object paramObj4 = new DoubleWrapper(ppPaymentGross);
276 
277             Object paramObj5 = ppReceiverEmail;
278 
279             if (ppReceiverEmail == null) {
280                 paramObj5 = new NullWrapper("java.lang.String");
281             }
282 
283             Object paramObj6 = ppPayerEmail;
284 
285             if (ppPayerEmail == null) {
286                 paramObj6 = new NullWrapper("java.lang.String");
287             }
288 
289             MethodWrapper methodWrapper = new MethodWrapper(ShoppingOrderServiceUtil.class.getName(),
290                     "updateOrder",
291                     new Object[] {
292                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
293                         paramObj5, paramObj6
294                     });
295 
296             Object returnObj = null;
297 
298             try {
299                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
300             }
301             catch (Exception e) {
302                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
303                     throw (com.liferay.portal.kernel.exception.PortalException)e;
304                 }
305 
306                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
307                     throw (com.liferay.portal.kernel.exception.SystemException)e;
308                 }
309 
310                 throw new com.liferay.portal.kernel.exception.SystemException(e);
311             }
312 
313             return (com.liferay.portlet.shopping.model.ShoppingOrder)returnObj;
314         }
315         catch (com.liferay.portal.kernel.exception.SystemException se) {
316             _log.error(se, se);
317 
318             throw se;
319         }
320     }
321 
322     public static com.liferay.portlet.shopping.model.ShoppingOrder updateOrder(
323         HttpPrincipal httpPrincipal, long groupId, long orderId,
324         java.lang.String billingFirstName, java.lang.String billingLastName,
325         java.lang.String billingEmailAddress, java.lang.String billingCompany,
326         java.lang.String billingStreet, java.lang.String billingCity,
327         java.lang.String billingState, java.lang.String billingZip,
328         java.lang.String billingCountry, java.lang.String billingPhone,
329         boolean shipToBilling, java.lang.String shippingFirstName,
330         java.lang.String shippingLastName,
331         java.lang.String shippingEmailAddress,
332         java.lang.String shippingCompany, java.lang.String shippingStreet,
333         java.lang.String shippingCity, java.lang.String shippingState,
334         java.lang.String shippingZip, java.lang.String shippingCountry,
335         java.lang.String shippingPhone, java.lang.String ccName,
336         java.lang.String ccType, java.lang.String ccNumber, int ccExpMonth,
337         int ccExpYear, java.lang.String ccVerNumber, java.lang.String comments)
338         throws com.liferay.portal.kernel.exception.PortalException,
339             com.liferay.portal.kernel.exception.SystemException {
340         try {
341             Object paramObj0 = new LongWrapper(groupId);
342 
343             Object paramObj1 = new LongWrapper(orderId);
344 
345             Object paramObj2 = billingFirstName;
346 
347             if (billingFirstName == null) {
348                 paramObj2 = new NullWrapper("java.lang.String");
349             }
350 
351             Object paramObj3 = billingLastName;
352 
353             if (billingLastName == null) {
354                 paramObj3 = new NullWrapper("java.lang.String");
355             }
356 
357             Object paramObj4 = billingEmailAddress;
358 
359             if (billingEmailAddress == null) {
360                 paramObj4 = new NullWrapper("java.lang.String");
361             }
362 
363             Object paramObj5 = billingCompany;
364 
365             if (billingCompany == null) {
366                 paramObj5 = new NullWrapper("java.lang.String");
367             }
368 
369             Object paramObj6 = billingStreet;
370 
371             if (billingStreet == null) {
372                 paramObj6 = new NullWrapper("java.lang.String");
373             }
374 
375             Object paramObj7 = billingCity;
376 
377             if (billingCity == null) {
378                 paramObj7 = new NullWrapper("java.lang.String");
379             }
380 
381             Object paramObj8 = billingState;
382 
383             if (billingState == null) {
384                 paramObj8 = new NullWrapper("java.lang.String");
385             }
386 
387             Object paramObj9 = billingZip;
388 
389             if (billingZip == null) {
390                 paramObj9 = new NullWrapper("java.lang.String");
391             }
392 
393             Object paramObj10 = billingCountry;
394 
395             if (billingCountry == null) {
396                 paramObj10 = new NullWrapper("java.lang.String");
397             }
398 
399             Object paramObj11 = billingPhone;
400 
401             if (billingPhone == null) {
402                 paramObj11 = new NullWrapper("java.lang.String");
403             }
404 
405             Object paramObj12 = new BooleanWrapper(shipToBilling);
406 
407             Object paramObj13 = shippingFirstName;
408 
409             if (shippingFirstName == null) {
410                 paramObj13 = new NullWrapper("java.lang.String");
411             }
412 
413             Object paramObj14 = shippingLastName;
414 
415             if (shippingLastName == null) {
416                 paramObj14 = new NullWrapper("java.lang.String");
417             }
418 
419             Object paramObj15 = shippingEmailAddress;
420 
421             if (shippingEmailAddress == null) {
422                 paramObj15 = new NullWrapper("java.lang.String");
423             }
424 
425             Object paramObj16 = shippingCompany;
426 
427             if (shippingCompany == null) {
428                 paramObj16 = new NullWrapper("java.lang.String");
429             }
430 
431             Object paramObj17 = shippingStreet;
432 
433             if (shippingStreet == null) {
434                 paramObj17 = new NullWrapper("java.lang.String");
435             }
436 
437             Object paramObj18 = shippingCity;
438 
439             if (shippingCity == null) {
440                 paramObj18 = new NullWrapper("java.lang.String");
441             }
442 
443             Object paramObj19 = shippingState;
444 
445             if (shippingState == null) {
446                 paramObj19 = new NullWrapper("java.lang.String");
447             }
448 
449             Object paramObj20 = shippingZip;
450 
451             if (shippingZip == null) {
452                 paramObj20 = new NullWrapper("java.lang.String");
453             }
454 
455             Object paramObj21 = shippingCountry;
456 
457             if (shippingCountry == null) {
458                 paramObj21 = new NullWrapper("java.lang.String");
459             }
460 
461             Object paramObj22 = shippingPhone;
462 
463             if (shippingPhone == null) {
464                 paramObj22 = new NullWrapper("java.lang.String");
465             }
466 
467             Object paramObj23 = ccName;
468 
469             if (ccName == null) {
470                 paramObj23 = new NullWrapper("java.lang.String");
471             }
472 
473             Object paramObj24 = ccType;
474 
475             if (ccType == null) {
476                 paramObj24 = new NullWrapper("java.lang.String");
477             }
478 
479             Object paramObj25 = ccNumber;
480 
481             if (ccNumber == null) {
482                 paramObj25 = new NullWrapper("java.lang.String");
483             }
484 
485             Object paramObj26 = new IntegerWrapper(ccExpMonth);
486 
487             Object paramObj27 = new IntegerWrapper(ccExpYear);
488 
489             Object paramObj28 = ccVerNumber;
490 
491             if (ccVerNumber == null) {
492                 paramObj28 = new NullWrapper("java.lang.String");
493             }
494 
495             Object paramObj29 = comments;
496 
497             if (comments == null) {
498                 paramObj29 = new NullWrapper("java.lang.String");
499             }
500 
501             MethodWrapper methodWrapper = new MethodWrapper(ShoppingOrderServiceUtil.class.getName(),
502                     "updateOrder",
503                     new Object[] {
504                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
505                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
506                         paramObj10, paramObj11, paramObj12, paramObj13,
507                         paramObj14, paramObj15, paramObj16, paramObj17,
508                         paramObj18, paramObj19, paramObj20, paramObj21,
509                         paramObj22, paramObj23, paramObj24, paramObj25,
510                         paramObj26, paramObj27, paramObj28, paramObj29
511                     });
512 
513             Object returnObj = null;
514 
515             try {
516                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
517             }
518             catch (Exception e) {
519                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
520                     throw (com.liferay.portal.kernel.exception.PortalException)e;
521                 }
522 
523                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
524                     throw (com.liferay.portal.kernel.exception.SystemException)e;
525                 }
526 
527                 throw new com.liferay.portal.kernel.exception.SystemException(e);
528             }
529 
530             return (com.liferay.portlet.shopping.model.ShoppingOrder)returnObj;
531         }
532         catch (com.liferay.portal.kernel.exception.SystemException se) {
533             _log.error(se, se);
534 
535             throw se;
536         }
537     }
538 
539     private static Log _log = LogFactoryUtil.getLog(ShoppingOrderServiceHttp.class);
540 }