KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > lp > samples > RETAIL_PARTIAL_AVS


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 RETAIL_PARTIAL_AVS extends JLinkPointSample {
20   public RETAIL_PARTIAL_AVS() {
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
35        // Build 'merchantinfo'
36
op.clear();
37        op.put("configfile",configfile);
38    // add 'merchantinfo to order
39
order.addPart("merchantinfo", op );
40
41        // Build 'transactiondetails'
42
op.clear();
43        // set terminaltype to POS for an electronic
44
// cash register or integrated POS system,
45
// STANDALONE for a point-of-sale credit card terminal,
46
// UNATTENDED for a self-service station, or
47
// UNSPECIFIED for e-commerce or other applications
48
op.put("terminaltype","UNATTENDED");
49        op.put("transactionorigin","RETAIL");
50        // add 'transactiondetails to order
51
order.addPart("transactiondetails", op );
52
53        // Build 'billing'
54
op.clear();
55        //For an UNATTENDED terminaltype,
56
// do a partial AVS: zip code only.
57
op.put("zip","12345");
58        // add 'billing to order
59
order.addPart("billing", op );
60
61        // Build 'creditcard'
62
op.clear();
63        op.put("cardnumber","4111-1111-1111-1111");
64        op.put("cardexpmonth","03");
65        op.put("cardexpyear","05");
66    // add 'creditcard to order
67
order.addPart("creditcard", op );
68
69         // Build 'payment'
70
op.clear();
71        op.put("chargetotal","12.99");
72    // add 'payment to order
73
order.addPart("payment", op );
74
75
76 return order.toXML();
77 }
78
79 }
Popular Tags