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