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