KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > lp > samples > L2PURCHASING_CARD


1 /*****************************************************************************
2 ' Copyright 2003 LinkPoint International, Inc. All Rights Reserved.
3 '
4 ' This software is the proprietary information of LinkPoint International, Inc.
5 ' Use is subject to license terms.
6 '
7 '******************************************************************************/

8 package lp.samples;
9 import lp.order.*;
10 /**
11  * <p>Title: </p>
12  * <p>Description: </p>
13  * <p>Copyright: Copyright (c) 2003</p>
14  * <p>Company: LinkPoint International</p>
15  * @author Sergey Chudnovsky
16  * @version 1.0
17  */

18
19 public class L2PURCHASING_CARD extends JLinkPointSample {
20   public L2PURCHASING_CARD() {
21   }
22   protected String JavaDoc getOrderXML() {
23     // Create an empty order
24
LPOrderPart order = LPOrderFactory.createOrderPart("order");
25
26     // Create a part we will use to build the order
27
LPOrderPart op = LPOrderFactory.createOrderPart();
28
29     // Build 'orderoptions'
30
op.put("ordertype","SALE");
31     // add 'orderoptions to order
32
order.addPart("orderoptions", op );
33
34         // Build 'merchantinfo'
35
op.clear();
36         op.put("configfile",configfile);
37     // add 'merchantinfo to order
38
order.addPart("merchantinfo", op );
39
40         // Build 'transactiondetails'
41
op.clear();
42         // If there is no PO Number for this order,
43
// pass a department code or other value, but make sure the value you pass is supplied by the customer
44
op.put("ponumber","1203A-G4567");
45         // If the purchase is tax exempt,
46
// pass a value of Y for taxexempt
47
op.put("taxexempt","N");
48         // add 'billing to order
49
order.addPart("transactiondetails", op );
50
51         // Build 'creditcard'
52
op.clear();
53         op.put("cardnumber","4111-1111-1111-1111");
54         op.put("cardexpmonth","03");
55         op.put("cardexpyear","05");
56     // add 'creditcard to order
57
order.addPart("creditcard", op );
58
59          // Build 'payment'
60
op.clear();
61         op.put("chargetotal","12.99");
62         // Tax is required for purchasing cards.
63
// If the tax is $0.00, pass a value of 0 for tax
64
op.put("tax","0.32");
65
66     // add 'payment to order
67
order.addPart("payment", op );
68
69   // Process the order
70
return order.toXML();
71 }
72
73 }
Popular Tags