KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > lp > samples > PB_NEW


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 PB_NEW extends JLinkPointSample {
20   public PB_NEW() {
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
30   // Build 'orderoptions'
31
// For a test, set result to GOOD, DECLINE, or DUPLICATE
32
op.put("result","GOOD");
33       op.put("ordertype","SALE");
34   // add 'orderoptions to order
35
order.addPart("orderoptions", op );
36
37
38       // Build 'merchantinfo'
39
op.clear();
40       op.put("configfile",configfile);
41   // add 'merchantinfo to order
42
order.addPart("merchantinfo", op );
43
44
45       // Build 'creditcard'
46
op.clear();
47       op.put("cardnumber","4111-1111-1111-1111");
48       op.put("cardexpmonth","03");
49       op.put("cardexpyear","05");
50   // add 'creditcard to order
51
order.addPart("creditcard", op );
52
53       // Build 'billing'
54
op.clear();
55       op.put("addrnum","123");
56       op.put("zip","12345");
57       // add 'billing to order
58
order.addPart("billing", op );
59
60        // Build 'payment'
61
op.clear();
62       op.put("chargetotal","12.99");
63   // add 'payment to order
64
order.addPart("payment", op );
65
66        // build 'periodic' part
67
op.clear();
68       op.put("action","SUBMIT");
69       op.put("startdate","immediate");
70       op.put("periodicity","monthly");
71       op.put("installments","3");
72       op.put("threshold","3");
73
74   // add 'periodic' to order
75
order.addPart("periodic", op );
76
77  return order.toXML();
78 }
79
80 }
Popular Tags