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