Subversion Repositories SmartDukaan

Rev

Rev 14639 | Rev 14642 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14639 Rev 14641
Line 24... Line 24...
24
import org.apache.http.client.ClientProtocolException;
24
import org.apache.http.client.ClientProtocolException;
25
import org.apache.http.client.HttpClient;
25
import org.apache.http.client.HttpClient;
26
import org.apache.http.client.entity.UrlEncodedFormEntity;
26
import org.apache.http.client.entity.UrlEncodedFormEntity;
27
import org.apache.http.client.methods.HttpGet;
27
import org.apache.http.client.methods.HttpGet;
28
import org.apache.http.client.methods.HttpPost;
28
import org.apache.http.client.methods.HttpPost;
29
import org.apache.http.entity.StringEntity;
-
 
30
import org.apache.http.impl.client.DefaultHttpClient;
29
import org.apache.http.impl.client.DefaultHttpClient;
31
import org.apache.http.message.BasicNameValuePair;
30
import org.apache.http.message.BasicNameValuePair;
32
import org.json.JSONArray;
31
import org.json.JSONArray;
33
import org.json.JSONObject;
32
import org.json.JSONObject;
34
import org.slf4j.LoggerFactory;
33
import org.slf4j.LoggerFactory;
Line 276... Line 275...
276
					}
275
					}
277
				}*/
276
				}*/
278
 
277
 
279
				logger.info("Getting Delivery Information for OneShip Snapdeal Orders");
278
				logger.info("Getting Delivery Information for OneShip Snapdeal Orders");
280
				//statusCode=CLD&dispatchCategoryId=0&startDate=2013%2F11%2F01&endDate=2013%2F11%2F07&statusColumn=cancelledOn
279
				//statusCode=CLD&dispatchCategoryId=0&startDate=2013%2F11%2F01&endDate=2013%2F11%2F07&statusColumn=cancelledOn
-
 
280
				String oneShipUrl = "http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch/?startDate="+startDate+"&endDate="+endDate+"&statusCode=COURIER_DELIVERED&statusColumn=deliveredOn&dispatchCategoryId=0";
-
 
281
				logger.info("One Ship Url "+oneShipUrl);
281
				
282
				
282
				post = new HttpPost("http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch");
283
				post = new HttpPost("http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch");
283
				/*nameValuePairs = new ArrayList<NameValuePair>();
284
				nameValuePairs = new ArrayList<NameValuePair>();
284
				nameValuePairs.add(new BasicNameValuePair("startDate",startDate));
285
				nameValuePairs.add(new BasicNameValuePair("startDate",startDate));
285
				nameValuePairs.add(new BasicNameValuePair("endDate",endDate));
286
				nameValuePairs.add(new BasicNameValuePair("endDate",endDate));
286
				nameValuePairs.add(new BasicNameValuePair("statusColumn","deliveredOn"));
287
				nameValuePairs.add(new BasicNameValuePair("statusColumn","deliveredOn"));
287
				nameValuePairs.add(new BasicNameValuePair("queryType","CREATED"));*/
288
				nameValuePairs.add(new BasicNameValuePair("queryType","CREATED"));
288
				String paramVal = "startDate="+startDate+"&endDate="+endDate+"&statusColumn=deliveredOn&queryType=CREATED";
289
				nameValuePairs.add(new BasicNameValuePair("statusCode","COURIER_DELIVERED"));
289
				System.out.println(paramVal);
-
 
290
				StringEntity entity = new StringEntity(paramVal, "utf-8");
290
				post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
291
 
291
				
292
				post.setEntity(entity);
-
 
293
 
292
 
294
				try {
293
				try {
295
					response = client.execute(post);
294
					response = client.execute(post);
296
				} catch (Exception e) {
295
				} catch (Exception e) {
297
					logger.error("Unable to get Http Response for snapdeal oneship delivered orders", e);
296
					logger.error("Unable to get Http Response for snapdeal oneship delivered orders", e);
Line 403... Line 402...
403
				nameValuePairs = new ArrayList<NameValuePair>();
402
				nameValuePairs = new ArrayList<NameValuePair>();
404
				nameValuePairs.add(new BasicNameValuePair("startDate",startDate));
403
				nameValuePairs.add(new BasicNameValuePair("startDate",startDate));
405
				nameValuePairs.add(new BasicNameValuePair("endDate",endDate));
404
				nameValuePairs.add(new BasicNameValuePair("endDate",endDate));
406
				nameValuePairs.add(new BasicNameValuePair("statusColumn","cancelledOn"));
405
				nameValuePairs.add(new BasicNameValuePair("statusColumn","cancelledOn"));
407
				nameValuePairs.add(new BasicNameValuePair("queryType","CREATED"));
406
				nameValuePairs.add(new BasicNameValuePair("queryType","CREATED"));
-
 
407
				nameValuePairs.add(new BasicNameValuePair("statusCode","CLD"));
408
				post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
408
				post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
409
 
409
 
410
				try {
410
				try {
411
					response = client.execute(post);
411
					response = client.execute(post);
412
				} catch (Exception e) {
412
				} catch (Exception e) {