Subversion Repositories SmartDukaan

Rev

Rev 689 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 689 Rev 693
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
 
2
 
3
import java.io.IOException;
3
import java.io.IOException;
4
import java.util.ArrayList;
-
 
5
import java.util.Date;
-
 
6
import java.util.HashMap;
-
 
7
import java.util.List;
4
import java.util.List;
8
import java.util.Map;
-
 
9
import java.util.Set;
-
 
10
 
5
 
11
import org.apache.struts2.rest.DefaultHttpHeaders;
-
 
12
import org.apache.struts2.rest.HttpHeaders;
-
 
13
import org.apache.thrift.TException;
6
import org.apache.thrift.TException;
14
 
7
 
15
import in.shop2020.logistics.LogisticsInfo;
-
 
16
import in.shop2020.logistics.LogisticsServiceException;
-
 
17
import in.shop2020.model.v1.catalog.InventoryServiceException;
-
 
18
import in.shop2020.model.v1.catalog.Item;
-
 
19
import in.shop2020.model.v1.order.BillingInfo;
-
 
20
import in.shop2020.model.v1.order.Order;
8
import in.shop2020.model.v1.order.Order;
21
import in.shop2020.model.v1.order.LineItem;
-
 
22
import in.shop2020.model.v1.order.OrderInfo;
-
 
23
import in.shop2020.model.v1.order.OrderStatus;
-
 
24
import in.shop2020.model.v1.order.Payment;
-
 
25
import in.shop2020.model.v1.order.PaymentInfo;
-
 
26
import in.shop2020.model.v1.order.PaymentStatus;
-
 
27
import in.shop2020.model.v1.order.Shipment;
-
 
28
import in.shop2020.model.v1.order.ShipmentInfo;
-
 
29
import in.shop2020.model.v1.order.Transaction;
-
 
30
import in.shop2020.model.v1.order.TransactionServiceException;
9
import in.shop2020.model.v1.order.TransactionServiceException;
31
import in.shop2020.model.v1.order.TransactionStatus;
-
 
32
import in.shop2020.model.v1.user.Cart;
-
 
33
import in.shop2020.model.v1.user.LineStatus;
-
 
34
import in.shop2020.model.v1.user.ShoppingCartException;
-
 
35
import in.shop2020.model.v1.user.Address;
-
 
36
import in.shop2020.model.v1.user.User;
-
 
37
import in.shop2020.model.v1.user.UserContextException;
-
 
38
import in.shop2020.payments.PaymentException;
10
import in.shop2020.payments.PaymentException;
39
import in.shop2020.thrift.clients.CatalogServiceClient;
11
import in.shop2020.payments.PaymentStatus;
40
import in.shop2020.thrift.clients.LogisticsServiceClient;
-
 
41
import in.shop2020.thrift.clients.PaymentServiceClient;
12
import in.shop2020.thrift.clients.PaymentServiceClient;
42
import in.shop2020.thrift.clients.TransactionServiceClient;
13
import in.shop2020.thrift.clients.TransactionServiceClient;
43
import in.shop2020.thrift.clients.UserContextServiceClient;
-
 
44
import in.shop2020.utils.Logger;
14
import in.shop2020.utils.Logger;
45
 
15
 
-
 
16
 
46
public class PayResponseController extends BaseController{
17
public class PayResponseController extends BaseController{
-
 
18
	private static final long serialVersionUID = 1L;
-
 
19
 
47
	public static String AMOUNT = "amount";
20
	public static String AMOUNT = "amount";
48
	public static String TRACKID = "trackid";
21
	public static String TRACKID = "trackid";
49
	public static String TRACKID_CANCELLED = "trackId";
22
	public static String TRACKID_CANCELLED = "trackId";
50
	public static String RESULT = "result";
23
	public static String RESULT = "result";
51
	public static String AUTH = "auth";
24
	public static String AUTH = "auth";
Line 56... Line 29...
56
	public static String CANCELED = "CANCELED";
29
	public static String CANCELED = "CANCELED";
57
	public static String APPROVED = "APPROVED";
30
	public static String APPROVED = "APPROVED";
58
	public static String CAPTURED = "CAPTURED";
31
	public static String CAPTURED = "CAPTURED";
59
 
32
 
60
	PaymentServiceClient pclient = null;
33
	PaymentServiceClient pclient = null;
61
	LogisticsServiceClient lsc = null;
-
 
62
	UserContextServiceClient usc = null;
-
 
63
	CatalogServiceClient csc = null;
-
 
64
	TransactionServiceClient tsc = null;
34
	TransactionServiceClient tsc = null;
65
	
35
	
66
	String amount;
36
	String amount;
67
	String trackId;
37
	String trackId;
68
	String result;
38
	String result;
69
	String postdate;
39
	String postdate;
70
	String auth;
40
	String auth;
71
	String ref;
41
	String ref;
72
	String tranId;
42
	String tranId;
73
	String paymentId;
43
	String paymentId;
74
	long transaction_id = 0;
44
	String sessionId;
-
 
45
 
75
	String message = "Unable to process the payment. PLease try Again.";
46
	String message = "Unable to process the payment. PLease try Again.";
76
	
47
	
77
	in.shop2020.payments.Payment pmnt = null;
-
 
78
	
-
 
79
	public PayResponseController(){
48
	public PayResponseController(){
80
		super();
49
		super();
81
		try {
50
		try {
82
			pclient = new PaymentServiceClient();
51
			pclient = new PaymentServiceClient();
83
			lsc = new LogisticsServiceClient();
-
 
84
			usc = new UserContextServiceClient();
-
 
85
			csc = new CatalogServiceClient();
-
 
86
			tsc = new TransactionServiceClient();
52
			tsc = new TransactionServiceClient();
87
			
-
 
88
		} catch (Exception e) {
53
		} catch (Exception e) {
89
			Logger.log("Could not initialize the paymentservice client", this);
54
			Logger.log("Could not initialize the paymentservice client", this);
90
		}
55
		}
91
	}
56
	}
92
	
57
	
93
	public HttpHeaders show() throws IOException, SecurityException{
58
	public String index() throws IOException, SecurityException{
94
		//need to ignore id here.
-
 
95
		
-
 
96
		amount = this.request.getParameter(AMOUNT);
59
		amount = this.request.getParameter(AMOUNT);
97
		paymentId = this.request.getParameter(PAYMENTID);
60
		paymentId = this.request.getParameter(PAYMENTID);
98
		tranId = this.request.getParameter(TRANID);
61
		tranId = this.request.getParameter(TRANID);
99
		result = this.request.getParameter(RESULT);
62
		result = this.request.getParameter(RESULT);
100
		if (result.equalsIgnoreCase(CANCELED)){
63
		if (result.equalsIgnoreCase(CANCELED)){
Line 103... Line 66...
103
			trackId = this.request.getParameter(TRACKID);
66
			trackId = this.request.getParameter(TRACKID);
104
		}
67
		}
105
		auth = this.request.getParameter(AUTH);
68
		auth = this.request.getParameter(AUTH);
106
		ref = this.request.getParameter(REF);
69
		ref = this.request.getParameter(REF);
107
		postdate = this.request.getParameter(POSTDATE);
70
		postdate = this.request.getParameter(POSTDATE);
-
 
71
		sessionId = this.request.getSession().getId();
108
		
72
 
109
		//update the payment info object
73
		//update the payment info object
110
		try {
74
		try {
-
 
75
			if(result.trim().equals(CAPTURED)){
111
			pclient.getClient().addBankDetails(Long.parseLong(trackId), paymentId, tranId, "", "", postdate, auth, ref);
76
				String message = "Payment successful";
112
			message = "Payment processed. Creating transaction. In case you see this message, please call us with ref no "+ trackId;
77
				pclient.getClient().updatePaymentDetails(Long.parseLong(trackId), paymentId, sessionId, result, message, tranId, auth, ref, null, PaymentStatus.SUCCESS, null);
113
			Transaction t = getTransaction();
78
				return "index";
114
			transaction_id = tsc.getClient().createTransaction(t);
79
			}else{
115
			message = "Your order id is "+ transaction_id;
80
				String message = "Unable to process the payment.";
116
			usc.getClient().createOrders(pmnt.getCart_id());
81
				addActionError("Previous payment failed. Try again.");
117
			message = "Error commiting the cart, but your order has been placed. Please refer to "+ transaction_id;
82
				pclient.getClient().updatePaymentDetails(Long.parseLong(trackId), paymentId, sessionId, result, message, tranId, auth, ref, null, PaymentStatus.FAILED, null);
-
 
83
				return "failure";
-
 
84
			}
118
			
85
			
119
		} catch (NumberFormatException e) {
86
		} catch (NumberFormatException e) {
120
			
-
 
121
			Logger.log(e.toString(), this);
87
			Logger.log(e.toString(), this);
122
		} catch (PaymentException e) {
88
		} catch (PaymentException e) {
123
			
89
			
124
			Logger.log(e.toString(), this);
90
			Logger.log(e.toString(), this);
125
		} catch (TException e) {
91
		} catch (TException e) {
126
			
92
			
127
			Logger.log(e.toString(), this);
93
			Logger.log(e.toString(), this);
128
		} catch (TransactionServiceException e) {
-
 
129
			// TODO Auto-generated catch block
-
 
130
			e.printStackTrace();
-
 
131
		} catch (ShoppingCartException e) {
-
 
132
			// TODO Auto-generated catch block
-
 
133
			e.printStackTrace();
-
 
134
		}
94
		}
135
		return new DefaultHttpHeaders("show");
95
		return "index";
136
	}
96
	}
137
 
-
 
138
	
97
	
139
	private Transaction getTransaction(){
98
	public List<Order> getOrders() throws TransactionServiceException, TException{
140
		try {
99
		//FIXME
141
			pmnt = pclient.getClient().getPayment(Long.parseLong(trackId));
-
 
142
		} catch (NumberFormatException e1) {
-
 
143
			// TODO Auto-generated catch block
-
 
144
			e1.printStackTrace();
-
 
145
		} catch (PaymentException e1) {
-
 
146
			// TODO Auto-generated catch block
-
 
147
			e1.printStackTrace();
-
 
148
		} catch (TException e1) {
-
 
149
			// TODO Auto-generated catch block
-
 
150
			e1.printStackTrace();
-
 
151
		}
-
 
152
		Transaction t = new Transaction();
100
		return tsc.getClient().getOrdersForTransaction(1);
153
		t.setShoppingCartid(pmnt.getCart_id());
-
 
154
		t.setCustomer_id(pmnt.getUser_id());
-
 
155
		t.setCreatedOn(pmnt.getBank_ack_timestamp());
-
 
156
		t.setTransactionStatus(TransactionStatus.INIT);
-
 
157
		t.setStatusDescription("New order");
-
 
158
		
-
 
159
		//create payment
-
 
160
		Payment payment = new Payment();
-
 
161
		payment.setAmount(Double.parseDouble(amount));
-
 
162
		payment.setBank_tx_id(tranId);
-
 
163
		payment.setMerchant_tx_id(trackId);
-
 
164
		payment.setStatus(PaymentStatus.SUCCESS);
-
 
165
		payment.setMode("credit card");
-
 
166
		payment.setCompletionTimestamp(pmnt.getBank_ack_timestamp());
-
 
167
		payment.setSubmissionTimestamp(pmnt.getInit_timestamp());
-
 
168
		
-
 
169
		Map<Long, Payment> paymentMap = new HashMap<Long, Payment>();
-
 
170
		paymentMap.put(payment.getCompletionTimestamp(), payment);
-
 
171
		
101
		
172
		t.setOrders(getOrders());
-
 
173
		
102
		
174
		return t;
-
 
175
	}
-
 
176
 
-
 
177
private List<Order> getOrders(){
-
 
178
	List<Order> orders = new ArrayList<Order>();
-
 
179
	
-
 
180
	Cart c = null;
-
 
181
	try {
-
 
182
		c = usc.getClient().getCart(pmnt.getCart_id());
-
 
183
	} catch (ShoppingCartException e) {
-
 
184
		// TODO Auto-generated catch block
-
 
185
		e.printStackTrace();
-
 
186
	} catch (TException e) {
-
 
187
		// TODO Auto-generated catch block
-
 
188
		e.printStackTrace();
-
 
189
	} catch (Exception e) {
-
 
190
		// TODO Auto-generated catch block
-
 
191
		e.printStackTrace();
-
 
192
	}
-
 
193
	List<in.shop2020.model.v1.user.Line> lines = c.getLines();
-
 
194
	
-
 
195
	for(in.shop2020.model.v1.user.Line line : lines){
-
 
196
		if(line.getLineStatus() == LineStatus.LINE_ACTIVE){
-
 
197
			//line is active
-
 
198
			LineItem lineItem = getLineItem(line.getItemId());
-
 
199
			// create orders equivalent to quantity. Create one order per item.
-
 
200
			for(int i= 0; i<line.getQuantity(); i++){
-
 
201
				//  set order
-
 
202
				Order order = getOrder(c.getAddressId(), lineItem);
-
 
203
				order.addToLineitems(lineItem);
-
 
204
				orders.add(order);
-
 
205
			}
-
 
206
		}
-
 
207
	}
-
 
208
	return orders;
-
 
209
}
-
 
210
 
-
 
211
 
-
 
212
private Order getOrder(long addressId, LineItem lineItem){
-
 
213
	String sku_id = lineItem.getSku_id();
-
 
214
	double total_amount = lineItem.getTotal_price();
-
 
215
	double total_weight = lineItem.getTotal_weight();
-
 
216
	
-
 
217
	long customer_id = pmnt.getUser_id();
-
 
218
	Address address = getAddress(addressId);
-
 
219
	String customer_email = getEmail(customer_id);
-
 
220
	String customer_name = address.getName();
-
 
221
	String customer_address = getAddressString(address);
-
 
222
	String customer_mobilenumber = address.getPhone();
-
 
223
	String customer_pincode = address.getPin();
-
 
224
	
-
 
225
	
-
 
226
	
-
 
227
	// get logistics information
-
 
228
	LogisticsInfo logistics_info = null;
-
 
229
	try {
-
 
230
		logistics_info = lsc.getClient().getLogisticsInfo(customer_pincode, sku_id);
-
 
231
	} catch (TException e) {
-
 
232
		// TODO Auto-generated catch block
-
 
233
		e.printStackTrace();
-
 
234
	} catch (LogisticsServiceException e) {
-
 
235
		// TODO Auto-generated catch block
-
 
236
		e.printStackTrace();
-
 
237
	}
-
 
238
 
-
 
239
	long warehouse_id = logistics_info.getWarehouseId();
-
 
240
	long logistics_provider_id= logistics_info.getProviderId();
-
 
241
	String airwaybill_no = String.valueOf(logistics_info.getAirway_billno()); // should it be really long ?
-
 
242
	String tracking_id = airwaybill_no; //right now both are same
-
 
243
	long expected_delivery_time = (new Date()).getTime() + 60*60*1000*24*logistics_info.getDeliveryTime(); 
-
 
244
	
-
 
245
	long created_timestamp = (new Date()).getTime();
-
 
246
	OrderStatus status = OrderStatus.INIT; // to get from orderstatus file
-
 
247
	String statusDescription = "New Order";
-
 
248
	
-
 
249
	Order order = new Order();
-
 
250
	order.setLogistics_provider_id(logistics_provider_id);
-
 
251
	order.setAirwaybill_no(airwaybill_no);
-
 
252
	order.setExpected_delivery_time(expected_delivery_time);
-
 
253
	order.setTracking_id(tracking_id);
-
 
254
	
-
 
255
	order.setWarehouse_id(warehouse_id);
-
 
256
	order.setCreated_timestamp(created_timestamp);
-
 
257
	order.setStatus(status);
-
 
258
	order.setStatusDescription(statusDescription);
-
 
259
	
-
 
260
	order.setCustomer_id(customer_id);
-
 
261
	order.setCustomer_name(customer_name);
-
 
262
	order.setCustomer_address(customer_address);
-
 
263
	order.setCustomer_email(customer_email);
-
 
264
	order.setCustomer_mobilenumber(customer_mobilenumber);
-
 
265
	order.setCustomer_pincode(customer_pincode);
-
 
266
	
-
 
267
	order.setTotal_amount(total_amount);
-
 
268
	order.setTotal_weight(total_weight);
-
 
269
	
-
 
270
	return order;
-
 
271
}
-
 
272
 
-
 
273
private String getEmail(long userId){
-
 
274
	String email = null;
-
 
275
	try {
-
 
276
		email = usc.getClient().getUserById(userId).getEmail();
-
 
277
	} catch (UserContextException e) {
-
 
278
		// TODO Auto-generated catch block
-
 
279
		e.printStackTrace();
-
 
280
	} catch (TException e) {
-
 
281
		// TODO Auto-generated catch block
-
 
282
		e.printStackTrace();
-
 
283
	}
-
 
284
	return email;
-
 
285
}
-
 
286
 
-
 
287
private Address getAddress(long addressId){
-
 
288
	List<Address> addresses = null;
-
 
289
	try {
-
 
290
		addresses = usc.getClient().getUserById(pmnt.getUser_id()).getAddresses();
-
 
291
	} catch (UserContextException e) {
-
 
292
		// TODO Auto-generated catch block
-
 
293
		e.printStackTrace();
-
 
294
	} catch (TException e) {
-
 
295
		// TODO Auto-generated catch block
-
 
296
		e.printStackTrace();
-
 
297
	}
-
 
298
	Address address = null;
-
 
299
	for(Address a : addresses){
-
 
300
		if(a.getId() == addressId){
-
 
301
			address = a;
-
 
302
		}
-
 
303
	}
-
 
304
	return address;
-
 
305
}
-
 
306
 
-
 
307
	private LineItem getLineItem(long itemId){ 
-
 
308
	LineItem lineItem = new LineItem();
-
 
309
	Item item = null;
-
 
310
	try {
-
 
311
		item = csc.getClient().getItem(itemId);
-
 
312
	} catch (InventoryServiceException e) {
-
 
313
		// TODO Auto-generated catch block
-
 
314
		e.printStackTrace();
-
 
315
	} catch (TException e) {
-
 
316
		// TODO Auto-generated catch block
-
 
317
		e.printStackTrace();
-
 
318
	}
-
 
319
 
-
 
320
	String model_name = item.getModelName();
-
 
321
	String model_number = item.getModelNumber();
-
 
322
	String brand = item.getManufacturerName();
-
 
323
	String sku_id = item.getVendorItemId();
-
 
324
	double unit_price = item.getSellingPrice();
-
 
325
	double unit_weight = item.getWeight();
-
 
326
	double total_price = item.getSellingPrice();
-
 
327
	double total_weight = item.getWeight();
-
 
328
	String  extra_info = item.getFeatureDescription();
-
 
329
	double quantity = 1; // because now we will create one order per item
-
 
330
	
-
 
331
	lineItem.setSku_id(sku_id);
-
 
332
	lineItem.setBrand(brand);
-
 
333
	lineItem.setExtra_info(extra_info);
-
 
334
	lineItem.setModel_name(model_name);
-
 
335
	lineItem.setModel_number(model_number);
-
 
336
	lineItem.setQuantity(quantity);
-
 
337
	lineItem.setSku_id(sku_id);
-
 
338
	lineItem.setUnit_price(unit_price);
-
 
339
	lineItem.setUnit_weight(unit_weight);
-
 
340
	lineItem.setTotal_price(total_price);
-
 
341
	lineItem.setTotal_weight(total_weight);
-
 
342
	return lineItem;
-
 
343
}
-
 
344
 
-
 
345
	private String getAddressString(Address a){
-
 
346
		String add = a.getLine1()+",\n"+a.getLine2()+",\n Landmark"+a.getLandmark()+",/n"+a.getCity()+",\n"+a.getState()+",\n"+a.getCountry();
-
 
347
		return add;
-
 
348
	}
-
 
349
	
-
 
350
	private String getAddress(Set<Address> address, long id){
-
 
351
		for(Address a : address){
-
 
352
			if(a.getId() == id){
-
 
353
				//Prepare String
-
 
354
				String add = a.getName()+",\n"+a.getLine1()+",\n"+a.getLine2()+",\n Landmark"+a.getLandmark()+",/n"+a.getCity()+",\n"+a.getState()+",\n"+a.getCountry()+",\n"+a.getPin()+",\n Phone :- "+a.getPhone();
-
 
355
				return add;
-
 
356
			}
-
 
357
		}
-
 
358
		return "";
-
 
359
	}
103
	}
360
	
104
	
361
	public String getMessage(){
105
	public String getMessage(){
362
		return this.message;
106
		return this.message;
363
	}
107
	}
364
	
108
	
365
	public long getTransactionId(){
-
 
366
		return this.transaction_id;
-
 
367
	}
-
 
368
	
-
 
369
	
-
 
370
}
109
}
371
 
-
 
372
/*
-
 
373
	private Transaction getTransaction(){
-
 
374
		
-
 
375
		try {
-
 
376
			pmnt = pclient.getClient().getPayment(Long.parseLong(trackId));
-
 
377
		} catch (NumberFormatException e1) {
-
 
378
			// TODO Auto-generated catch block
-
 
379
			e1.printStackTrace();
-
 
380
		} catch (PaymentException e1) {
-
 
381
			// TODO Auto-generated catch block
-
 
382
			e1.printStackTrace();
-
 
383
		} catch (TException e1) {
-
 
384
			// TODO Auto-generated catch block
-
 
385
			e1.printStackTrace();
-
 
386
		}
-
 
387
		Transaction t = new Transaction();
-
 
388
		PaymentInfo paymentInfo = new PaymentInfo();
-
 
389
		t.setPaymentInfo(paymentInfo);
-
 
390
		t.setShoppingCartid(pmnt.getCart_id());
-
 
391
		t.setCustomer_id(pmnt.getUser_id());
-
 
392
		t.setCreatedOn(pmnt.getBank_ack_timestamp());
-
 
393
		t.setTransactionStatus(TransactionStatus.INIT);
-
 
394
		t.setStatusDescription("New order");
-
 
395
		//create payment
-
 
396
		Payment payment = new Payment();
-
 
397
		payment.setAmount(Double.parseDouble(amount));
-
 
398
		payment.setBank_tx_id(tranId);
-
 
399
		payment.setMerchant_tx_id(trackId);
-
 
400
		payment.setStatus(PaymentStatus.SUCCESS);
-
 
401
		payment.setMode("credit card");
-
 
402
		payment.setCompletionTimestamp(pmnt.getBank_ack_timestamp());
-
 
403
		payment.setSubmissionTimestamp(pmnt.getInit_timestamp());
-
 
404
		
-
 
405
		Map<Long, Payment> paymentMap = new HashMap<Long, Payment>();
-
 
406
		paymentMap.put(payment.getCompletionTimestamp(), payment);
-
 
407
		
-
 
408
		paymentInfo.setPayments(paymentMap);
-
 
409
		
-
 
410
		Cart c = null;
-
 
411
		try {
-
 
412
			c = cl.getClient().getCart(pmnt.getCart_id());
-
 
413
		} catch (ShoppingCartException e) {
-
 
414
			// TODO Auto-generated catch block
-
 
415
			e.printStackTrace();
-
 
416
		} catch (TException e) {
-
 
417
			// TODO Auto-generated catch block
-
 
418
			e.printStackTrace();
-
 
419
		} catch (Exception e) {
-
 
420
			// TODO Auto-generated catch block
-
 
421
			e.printStackTrace();
-
 
422
		}
-
 
423
		
-
 
424
		//Shipping info
-
 
425
		
-
 
426
		ShipmentInfo shipmentInfo = new ShipmentInfo();
-
 
427
		t.setShipmentInfo(shipmentInfo);
-
 
428
		
-
 
429
		Shipment shipment = new Shipment();
-
 
430
		try {
-
 
431
			shipment.setAirwayBillNo(lsc.getClient().getEmptyAWB(1));
-
 
432
		} catch (TException e) {
-
 
433
			// TODO Auto-generated catch block
-
 
434
			e.printStackTrace();
-
 
435
		}
-
 
436
		try {
-
 
437
			shipment.setAddress(getAddress(usc.getClient().getPrimaryInfo(pmnt.getUser_id(), false).getAddresses(),c.getAddressId()));
-
 
438
		} catch (UserContextException e) {
-
 
439
			// TODO Auto-generated catch block
-
 
440
			e.printStackTrace();
-
 
441
		} catch (TException e) {
-
 
442
			// TODO Auto-generated catch block
-
 
443
			e.printStackTrace();
-
 
444
		}
-
 
445
		
-
 
446
		shipment.setInsurance(0.0);
-
 
447
		shipment.setProvider("Aramex");
-
 
448
		shipment.setTrackingId(shipment.getAirwayBillNo());
-
 
449
		shipment.setWeight(0.0);
-
 
450
		shipment.setValue(Double.parseDouble(amount));
-
 
451
		shipment.setLineItems(null);
-
 
452
		shipmentInfo.addToShipments(shipment);
-
 
453
		
-
 
454
		
-
 
455
		//billinginfo will be added later by warehouse
-
 
456
		
-
 
457
		
-
 
458
		OrderInfo orderInfo = new OrderInfo();
-
 
459
		t.setOrderInfo(orderInfo);
-
 
460
		
-
 
461
		List<LineItem> lines = c.getLines();
-
 
462
		
-
 
463
		for(in.shop2020.model.v1.user.LineItem line : lines){
-
 
464
			if(line.getLineStatus() == LineStatus.LINE_ACTIVE){
-
 
465
				//line is active
-
 
466
				LineItem lineItem = new LineItem();
-
 
467
				Item item = null;
-
 
468
				try {
-
 
469
					item = csc.getClient().getItemByCatalogId(line.getItemId());
-
 
470
				} catch (InventoryServiceException e) {
-
 
471
					// TODO Auto-generated catch block
-
 
472
					e.printStackTrace();
-
 
473
				} catch (TException e) {
-
 
474
					// TODO Auto-generated catch block
-
 
475
					e.printStackTrace();
-
 
476
				}
-
 
477
				in.shop2020.model.v1.order.Item oitem = new in.shop2020.model.v1.order.Item();
-
 
478
				oitem.setId(item.getCatalogItemId());
-
 
479
				//get price for it 
-
 
480
				long warehouse = getWarehouse();
-
 
481
				oitem.setPrice(item.getPrice().get(warehouse));
-
 
482
				oitem.setWeight(item.getWeight());
-
 
483
				lineItem.setItem(oitem);
-
 
484
				lineItem.setAddedOn(pmnt.getBank_ack_timestamp());
-
 
485
				orderInfo.addToLineitems(lineItem);
-
 
486
			}
-
 
487
		}
-
 
488
		return t;
-
 
489
		
-
 
490
	}
-
 
491
	*/
-