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