KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > lp > samples > PB_CANCEL


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_CANCEL extends JLinkPointSample {
20   public PB_CANCEL() {
21   }
22   public PB_CANCEL(String JavaDoc _oid) {
23   oid = _oid;
24   }
25   protected String JavaDoc getOrderXML() {
26     // Create an empty order
27
LPOrderPart order = LPOrderFactory.createOrderPart("order");
28
29 // Create a part we will use to build the order
30
LPOrderPart op = LPOrderFactory.createOrderPart();
31
32
33 // Build 'orderoptions'
34
// For a test, set result to GOOD, DECLINE, or DUPLICATE
35
op.put("result","GOOD");
36     op.put("ordertype","SALE");
37 // add 'orderoptions to order
38
order.addPart("orderoptions", op );
39
40
41     // Build 'merchantinfo'
42
op.clear();
43     op.put("configfile",configfile);
44 // add 'merchantinfo to order
45
order.addPart("merchantinfo", op );
46
47
48     // Build 'creditcard'
49
op.clear();
50     op.put("cardnumber","4111-1111-1111-1111");
51     op.put("cardexpmonth","03");
52     op.put("cardexpyear","05");
53 // add 'creditcard to order
54
order.addPart("creditcard", op );
55
56     // Build 'billing'
57
op.clear();
58     op.put("addrnum","123");
59     op.put("zip","12345");
60     // add 'billing to order
61
order.addPart("billing", op );
62
63      // Build 'payment'
64
op.clear();
65     op.put("chargetotal","14.99");
66 // add 'payment to order
67
order.addPart("payment", op );
68
69      // build 'periodic' part
70
op.clear();
71     op.put("action","CANCEL");
72     op.put("startdate","immediate");
73     op.put("periodicity","monthly");
74     op.put("installments","3");
75     op.put("threshold","3");
76     // add 'periodic' to order
77
order.addPart("periodic", op );
78
79     // Add oid
80
op.clear();
81     op.put("oid",oid);
82 // add 'transactiondetails to order
83
order.addPart("transactiondetails", op );
84
85   return order.toXML();
86  }
87
88 private String JavaDoc oid="";
89 }
Popular Tags