1 8 package lp.samples; 9 import lp.order.*; 10 18 19 public class ITEMS_W_ESD extends JLinkPointSample { 20 public ITEMS_W_ESD() { 21 } 22 protected String getOrderXML() { 23 LPOrderPart order = LPOrderFactory.createOrderPart("order"); 25 26 LPOrderPart op = LPOrderFactory.createOrderPart(); 28 29 op.put("ordertype","SALE"); 31 op.put("result","LIVE"); 33 order.addPart("orderoptions", op ); 35 36 op.clear(); 38 op.put("configfile",configfile); 39 order.addPart("merchantinfo", op ); 41 42 43 op.clear(); 45 op.put("cardnumber","4111-1111-1111-1111"); 46 op.put("cardexpmonth","03"); 47 op.put("cardexpyear","05"); 48 order.addPart("creditcard", op ); 50 51 op.clear(); 53 op.put("subtotal","45.98"); 54 op.put("tax","0.32"); 55 op.put("shipping","1.02"); 56 op.put("chargetotal","47.32"); 57 order.addPart("payment", op ); 59 60 op.clear(); 64 op.put("zip","12345"); 65 op.put("addrnum","123"); 66 op.put("name","Joe Customer"); 68 order.addPart("billing", op ); 70 71 72 LPOrderPart items = LPOrderFactory.createOrderPart(); 74 LPOrderPart item = LPOrderFactory.createOrderPart(); 75 LPOrderPart options = LPOrderFactory.createOrderPart(); 76 77 item.put("id","123456-A98765"); 79 item.put("description","Logo T-Shirt"); 80 item.put("quantity","1"); 81 item.put("price","12.99"); 82 item.put("serial","0987654321"); 83 84 op.clear(); 86 op.put("name","Color"); 87 op.put("value","Red"); 88 options.addPart("option",op,1); 89 90 op.clear(); 91 op.put("name","Size"); 92 op.put("value","XL"); 93 options.addPart("option",op,2); 94 95 item.addPart("options", options ); 97 items.addPart("item", item, 1 ); 99 item.clear(); 101 item.put("id","123456-A98767"); 102 item.put("description","Blast-Em Software"); 103 item.put("price","32.99"); 104 item.put("quantity","1"); 105 item.put("serial","0987654321"); 106 item.put("esdtype","softgood"); 107 item.put("softfile","blastem.exe"); 108 109 items.addPart("item", item, 2 ); 111 112 order.addPart("items", items ); 114 115 return order.toXML(); 116 } 117 118 } | Popular Tags |