KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > lp > samples > RETAIL_KEYED


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 /**
12  * <p>Title: </p>
13  * <p>Description: </p>
14  * <p>Copyright: Copyright (c) 2003</p>
15  * <p>Company: LinkPoint International</p>
16  * @author Sergey Chudnovsky
17  * @version 1.0
18  */

19
20 public class RETAIL_KEYED extends JLinkPointSample {
21   public RETAIL_KEYED() {
22   }
23   protected String JavaDoc getOrderXML() {
24     // Create an empty order
25
LPOrderPart order = LPOrderFactory.createOrderPart("order");
26
27    // Create a part we will use to build the order
28
LPOrderPart op = LPOrderFactory.createOrderPart();
29
30    // Build 'orderoptions'
31
op.put("ordertype","SALE");
32    // add 'orderoptions to order
33
order.addPart("orderoptions", op );
34
35
36        // Build 'merchantinfo'
37
op.clear();
38        op.put("configfile",configfile);
39    // add 'merchantinfo to order
40
order.addPart("merchantinfo", op );
41
42        // Build 'transactiondetails'
43
op.clear();
44        // set terminaltype to POS for an electronic
45
// cash register or integrated POS system,
46
// STANDALONE for a point-of-sale credit card terminal,
47
// UNATTENDED for a self-service station, or
48
// UNSPECIFIED for e-commerce or other applications
49
op.put("terminaltype","POS");
50        op.put("transactionorigin","RETAIL");
51        // add 'transactiondetails to order
52
order.addPart("transactiondetails", op );
53
54
55        // Build 'creditcard'
56
op.clear();
57        op.put("cardnumber","4111-1111-1111-1111");
58        op.put("cardexpmonth","03");
59        op.put("cardexpyear","05");
60    // add 'creditcard to order
61
order.addPart("creditcard", op );
62
63         // Build 'payment'
64
op.clear();
65        op.put("chargetotal","12.99");
66    // add 'payment to order
67
order.addPart("payment", op );
68
69  // Process the order
70
return order.toXML();
71 }
72
73 }
Popular Tags