KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > lp > samples > RETAIL_SWIPE


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_SWIPE extends JLinkPointSample {
20   public RETAIL_SWIPE() {
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","POS");
49       op.put("transactionorigin","RETAIL");
50       // add 'transactiondetails to order
51
order.addPart("transactiondetails", op );
52
53
54       // Build 'creditcard'
55
op.clear();
56       op.put("track","1298361023614908");
57   // add 'creditcard to order
58
order.addPart("creditcard", 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       // AVS
67
// You should not do AVS for a retail swiped transaction,
68
// unless it is an UNATTENDED terminaltype.
69

70  return order.toXML();
71 }
72
73 }
Popular Tags