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 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.PortalException,
81              com.liferay.portal.SystemException {
82          try {
83              Object paramObj0 = new LongWrapper(plid);
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 plid,
147         long orderId)
148         throws com.liferay.portal.PortalException,
149             com.liferay.portal.SystemException {
150         try {
151             Object paramObj0 = new LongWrapper(plid);
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 plid, long orderId)
182         throws com.liferay.portal.PortalException,
183             com.liferay.portal.SystemException {
184         try {
185             Object paramObj0 = new LongWrapper(plid);
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 plid,
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(plid);
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 plid, long orderId,
261         java.lang.String billingFirstName, java.lang.String billingLastName,
262         java.lang.String billingEmailAddress, java.lang.String billingCompany,
263         java.lang.String billingStreet, java.lang.String billingCity,
264         java.lang.String billingState, java.lang.String billingZip,
265         java.lang.String billingCountry, java.lang.String billingPhone,
266         boolean shipToBilling, java.lang.String shippingFirstName,
267         java.lang.String shippingLastName,
268         java.lang.String shippingEmailAddress,
269         java.lang.String shippingCompany, java.lang.String shippingStreet,
270         java.lang.String shippingCity, java.lang.String shippingState,
271         java.lang.String shippingZip, java.lang.String shippingCountry,
272         java.lang.String shippingPhone, java.lang.String ccName,
273         java.lang.String ccType, java.lang.String ccNumber, int ccExpMonth,
274         int ccExpYear, java.lang.String ccVerNumber, java.lang.String comments)
275         throws com.liferay.portal.PortalException,
276             com.liferay.portal.SystemException {
277         try {
278             Object paramObj0 = new LongWrapper(plid);
279 
280             Object paramObj1 = new LongWrapper(orderId);
281 
282             Object paramObj2 = billingFirstName;
283 
284             if (billingFirstName == null) {
285                 paramObj2 = new NullWrapper("java.lang.String");
286             }
287 
288             Object paramObj3 = billingLastName;
289 
290             if (billingLastName == null) {
291                 paramObj3 = new NullWrapper("java.lang.String");
292             }
293 
294             Object paramObj4 = billingEmailAddress;
295 
296             if (billingEmailAddress == null) {
297                 paramObj4 = new NullWrapper("java.lang.String");
298             }
299 
300             Object paramObj5 = billingCompany;
301 
302             if (billingCompany == null) {
303                 paramObj5 = new NullWrapper("java.lang.String");
304             }
305 
306             Object paramObj6 = billingStreet;
307 
308             if (billingStreet == null) {
309                 paramObj6 = new NullWrapper("java.lang.String");
310             }
311 
312             Object paramObj7 = billingCity;
313 
314             if (billingCity == null) {
315                 paramObj7 = new NullWrapper("java.lang.String");
316             }
317 
318             Object paramObj8 = billingState;
319 
320             if (billingState == null) {
321                 paramObj8 = new NullWrapper("java.lang.String");
322             }
323 
324             Object paramObj9 = billingZip;
325 
326             if (billingZip == null) {
327                 paramObj9 = new NullWrapper("java.lang.String");
328             }
329 
330             Object paramObj10 = billingCountry;
331 
332             if (billingCountry == null) {
333                 paramObj10 = new NullWrapper("java.lang.String");
334             }
335 
336             Object paramObj11 = billingPhone;
337 
338             if (billingPhone == null) {
339                 paramObj11 = new NullWrapper("java.lang.String");
340             }
341 
342             Object paramObj12 = new BooleanWrapper(shipToBilling);
343 
344             Object paramObj13 = shippingFirstName;
345 
346             if (shippingFirstName == null) {
347                 paramObj13 = new NullWrapper("java.lang.String");
348             }
349 
350             Object paramObj14 = shippingLastName;
351 
352             if (shippingLastName == null) {
353                 paramObj14 = new NullWrapper("java.lang.String");
354             }
355 
356             Object paramObj15 = shippingEmailAddress;
357 
358             if (shippingEmailAddress == null) {
359                 paramObj15 = new NullWrapper("java.lang.String");
360             }
361 
362             Object paramObj16 = shippingCompany;
363 
364             if (shippingCompany == null) {
365                 paramObj16 = new NullWrapper("java.lang.String");
366             }
367 
368             Object paramObj17 = shippingStreet;
369 
370             if (shippingStreet == null) {
371                 paramObj17 = new NullWrapper("java.lang.String");
372             }
373 
374             Object paramObj18 = shippingCity;
375 
376             if (shippingCity == null) {
377                 paramObj18 = new NullWrapper("java.lang.String");
378             }
379 
380             Object paramObj19 = shippingState;
381 
382             if (shippingState == null) {
383                 paramObj19 = new NullWrapper("java.lang.String");
384             }
385 
386             Object paramObj20 = shippingZip;
387 
388             if (shippingZip == null) {
389                 paramObj20 = new NullWrapper("java.lang.String");
390             }
391 
392             Object paramObj21 = shippingCountry;
393 
394             if (shippingCountry == null) {
395                 paramObj21 = new NullWrapper("java.lang.String");
396             }
397 
398             Object paramObj22 = shippingPhone;
399 
400             if (shippingPhone == null) {
401                 paramObj22 = new NullWrapper("java.lang.String");
402             }
403 
404             Object paramObj23 = ccName;
405 
406             if (ccName == null) {
407                 paramObj23 = new NullWrapper("java.lang.String");
408             }
409 
410             Object paramObj24 = ccType;
411 
412             if (ccType == null) {
413                 paramObj24 = new NullWrapper("java.lang.String");
414             }
415 
416             Object paramObj25 = ccNumber;
417 
418             if (ccNumber == null) {
419                 paramObj25 = new NullWrapper("java.lang.String");
420             }
421 
422             Object paramObj26 = new IntegerWrapper(ccExpMonth);
423 
424             Object paramObj27 = new IntegerWrapper(ccExpYear);
425 
426             Object paramObj28 = ccVerNumber;
427 
428             if (ccVerNumber == null) {
429                 paramObj28 = new NullWrapper("java.lang.String");
430             }
431 
432             Object paramObj29 = comments;
433 
434             if (comments == null) {
435                 paramObj29 = new NullWrapper("java.lang.String");
436             }
437 
438             MethodWrapper methodWrapper = new MethodWrapper(ShoppingOrderServiceUtil.class.getName(),
439                     "updateOrder",
440                     new Object[] {
441                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
442                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
443                         paramObj10, paramObj11, paramObj12, paramObj13,
444                         paramObj14, paramObj15, paramObj16, paramObj17,
445                         paramObj18, paramObj19, paramObj20, paramObj21,
446                         paramObj22, paramObj23, paramObj24, paramObj25,
447                         paramObj26, paramObj27, paramObj28, paramObj29
448                     });
449 
450             Object returnObj = null;
451 
452             try {
453                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
454             }
455             catch (Exception e) {
456                 if (e instanceof com.liferay.portal.PortalException) {
457                     throw (com.liferay.portal.PortalException)e;
458                 }
459 
460                 if (e instanceof com.liferay.portal.SystemException) {
461                     throw (com.liferay.portal.SystemException)e;
462                 }
463 
464                 throw new com.liferay.portal.SystemException(e);
465             }
466 
467             return (com.liferay.portlet.shopping.model.ShoppingOrder)returnObj;
468         }
469         catch (com.liferay.portal.SystemException se) {
470             _log.error(se, se);
471 
472             throw se;
473         }
474     }
475 
476     public static com.liferay.portlet.shopping.model.ShoppingOrder updateOrder(
477         HttpPrincipal httpPrincipal, long plid, long orderId,
478         java.lang.String ppTxnId, java.lang.String ppPaymentStatus,
479         double ppPaymentGross, java.lang.String ppReceiverEmail,
480         java.lang.String ppPayerEmail)
481         throws com.liferay.portal.PortalException,
482             com.liferay.portal.SystemException {
483         try {
484             Object paramObj0 = new LongWrapper(plid);
485 
486             Object paramObj1 = new LongWrapper(orderId);
487 
488             Object paramObj2 = ppTxnId;
489 
490             if (ppTxnId == null) {
491                 paramObj2 = new NullWrapper("java.lang.String");
492             }
493 
494             Object paramObj3 = ppPaymentStatus;
495 
496             if (ppPaymentStatus == null) {
497                 paramObj3 = new NullWrapper("java.lang.String");
498             }
499 
500             Object paramObj4 = new DoubleWrapper(ppPaymentGross);
501 
502             Object paramObj5 = ppReceiverEmail;
503 
504             if (ppReceiverEmail == null) {
505                 paramObj5 = new NullWrapper("java.lang.String");
506             }
507 
508             Object paramObj6 = ppPayerEmail;
509 
510             if (ppPayerEmail == null) {
511                 paramObj6 = new NullWrapper("java.lang.String");
512             }
513 
514             MethodWrapper methodWrapper = new MethodWrapper(ShoppingOrderServiceUtil.class.getName(),
515                     "updateOrder",
516                     new Object[] {
517                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
518                         paramObj5, paramObj6
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 }