Subversion Repositories SmartDukaan

Rev

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

Rev 9730 Rev 9731
Line 70... Line 70...
70
 
70
 
71
		HttpClient client = new DefaultHttpClient();
71
		HttpClient client = new DefaultHttpClient();
72
		HttpPost post = new HttpPost("http://shipping.snapdeal.com/login_security_check?spring-security-redirect=http://shipping.snapdeal.com/vendor/product-shipment/shippingDashboard&");
72
		HttpPost post = new HttpPost("http://shipping.snapdeal.com/login_security_check?spring-security-redirect=http://shipping.snapdeal.com/vendor/product-shipment/shippingDashboard&");
73
		HttpGet get;
73
		HttpGet get;
74
		BufferedReader rd= null;
74
		BufferedReader rd= null;
75
		
75
 
76
		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
76
		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
77
		nameValuePairs.add(new BasicNameValuePair("j_username",
77
		nameValuePairs.add(new BasicNameValuePair("j_username",
78
		"khushal.bhatia@saholic.com"));
78
		"khushal.bhatia@saholic.com"));
79
		nameValuePairs.add(new BasicNameValuePair("j_password",
79
		nameValuePairs.add(new BasicNameValuePair("j_password",
80
		"s@h0l1c"));
80
		"s@h0l1c"));
Line 88... Line 88...
88
		try {
88
		try {
89
			rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
89
			rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
90
		} catch (Exception e1) {
90
		} catch (Exception e1) {
91
			logger.error("Unable to read Http Response for snapdeal seller portal login", e1);
91
			logger.error("Unable to read Http Response for snapdeal seller portal login", e1);
92
		} 
92
		} 
93
		
93
 
94
		String line = "";
94
		String line = "";
95
		try {
95
		try {
96
			while ((line = rd.readLine()) != null) {
96
			while ((line = rd.readLine()) != null) {
97
				System.out.println(line);
97
				System.out.println(line);
98
			}
98
			}
Line 103... Line 103...
103
		//http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch/?shippedStartDate=2014%2F01%2F01&shippedEndDate=2014%2F01%2F08&specialPanelAccess=&statusCode=COURIER_DELIVERED&statusColumn=deliveredOn&dispatchCategoryId=0&sCode=COURIER_DELIVERED
103
		//http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch/?shippedStartDate=2014%2F01%2F01&shippedEndDate=2014%2F01%2F08&specialPanelAccess=&statusCode=COURIER_DELIVERED&statusColumn=deliveredOn&dispatchCategoryId=0&sCode=COURIER_DELIVERED
104
 
104
 
105
		logger.info("Getting Delivery Information for DropShip Snapdeal Orders");
105
		logger.info("Getting Delivery Information for DropShip Snapdeal Orders");
106
		String dropshipUrl = "http://shipping.snapdeal.com/vendor/DROPSHIP/product-shipment/shippedData/fetch/?shippedStartDate="+startDate+"&shippedEndDate="+endDate+"&specialPanelAccess=&statusCode=COURIER_DELIVERED&statusColumn=deliveredOn&dispatchCategoryId=0&sCode=COURIER_DELIVERED";
106
		String dropshipUrl = "http://shipping.snapdeal.com/vendor/DROPSHIP/product-shipment/shippedData/fetch/?shippedStartDate="+startDate+"&shippedEndDate="+endDate+"&specialPanelAccess=&statusCode=COURIER_DELIVERED&statusColumn=deliveredOn&dispatchCategoryId=0&sCode=COURIER_DELIVERED";
107
		logger.info("Drop Ship Url "+dropshipUrl);
107
		logger.info("Drop Ship Url "+dropshipUrl);
108
		
108
 
109
		get = new HttpGet(dropshipUrl);
109
		get = new HttpGet(dropshipUrl);
110
 
110
 
111
		try {
111
		try {
112
			response = client.execute(get);
112
			response = client.execute(get);
113
		} catch (Exception e) {
113
		} catch (Exception e) {
Line 162... Line 162...
162
		}
162
		}
163
 
163
 
164
		logger.info("Getting Delivery Information for OneShip Snapdeal Orders");
164
		logger.info("Getting Delivery Information for OneShip Snapdeal Orders");
165
		String oneShipUrl = "http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch/?shippedStartDate="+startDate+"&shippedEndDate="+endDate+"&specialPanelAccess=&statusCode=COURIER_DELIVERED&statusColumn=deliveredOn&dispatchCategoryId=0&sCode=COURIER_DELIVERED";
165
		String oneShipUrl = "http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch/?shippedStartDate="+startDate+"&shippedEndDate="+endDate+"&specialPanelAccess=&statusCode=COURIER_DELIVERED&statusColumn=deliveredOn&dispatchCategoryId=0&sCode=COURIER_DELIVERED";
166
		logger.info("One Ship Url "+oneShipUrl);
166
		logger.info("One Ship Url "+oneShipUrl);
167
		
167
 
168
		get = new HttpGet(oneShipUrl);	
168
		get = new HttpGet(oneShipUrl);	
169
		
169
 
170
		try {
170
		try {
171
			response = client.execute(get);
171
			response = client.execute(get);
172
		} catch (Exception e) {
172
		} catch (Exception e) {
173
			logger.error("Unable to get Http Response for snapdeal oneship delivered orders", e);
173
			logger.error("Unable to get Http Response for snapdeal oneship delivered orders", e);
174
		} 
174
		} 
Line 189... Line 189...
189
				}
189
				}
190
			}
190
			}
191
		} catch (Exception e) {
191
		} catch (Exception e) {
192
			logger.error("Unable to extract Http Response for snapdeal oneship delivered orders", e);
192
			logger.error("Unable to extract Http Response for snapdeal oneship delivered orders", e);
193
		} 
193
		} 
194
		
194
 
195
		if(jsonDataShip!=null && jsonDataShip.length()>0){
195
		if(jsonDataShip!=null && jsonDataShip.length()>0){
196
			for(int i=0; i< jsonDataShip.length(); i++){
196
			for(int i=0; i< jsonDataShip.length(); i++){
197
				JSONObject jsonObj = null;
197
				JSONObject jsonObj = null;
198
				try {
198
				try {
199
					jsonObj = jsonDataShip.getJSONObject(i);
199
					jsonObj = jsonDataShip.getJSONObject(i);
Line 216... Line 216...
216
				} catch (Exception e) {
216
				} catch (Exception e) {
217
					logger.error("Unable to add delivered order details for updation regarding snapdeal oneship delivered orders", e);
217
					logger.error("Unable to add delivered order details for updation regarding snapdeal oneship delivered orders", e);
218
				}
218
				}
219
			}
219
			}
220
		}
220
		}
221
		if(tsc!=null){
-
 
-
 
221
 
222
			if(deliveredOrderDataList!=null && deliveredOrderDataList.size()>0){
222
		if(deliveredOrderDataList!=null && deliveredOrderDataList.size()>0){
223
				try{
223
			try{
224
					new TransactionClient().getClient().updateSnapdealOrdersStatus(deliveredOrderDataList);
224
				new TransactionClient().getClient().updateSnapdealOrdersStatus(deliveredOrderDataList);
225
				} catch(Exception e){
225
			} catch(Exception e){
226
					logger.error("Unable to update delivery information for snapdeal orders", e);
226
				logger.error("Unable to update delivery information for snapdeal orders", e);
227
				}
-
 
228
			}
227
			}
229
		}
228
		}
-
 
229
 
230
	}
230
	}
231
}
231
}
232
232