Subversion Repositories SmartDukaan

Rev

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

Rev 8365 Rev 8505
Line 136... Line 136...
136
			throw new RuntimeException(e);
136
			throw new RuntimeException(e);
137
		}
137
		}
138
		Calendar start_Date= new GregorianCalendar();
138
		Calendar start_Date= new GregorianCalendar();
139
 
139
 
140
		XMLGregorianCalendar endDate2 = df.newXMLGregorianCalendar(new GregorianCalendar(start_Date.get(Calendar.YEAR),start_Date.get(Calendar.MONTH),start_Date.get(Calendar.DAY_OF_MONTH)));
140
		XMLGregorianCalendar endDate2 = df.newXMLGregorianCalendar(new GregorianCalendar(start_Date.get(Calendar.YEAR),start_Date.get(Calendar.MONTH),start_Date.get(Calendar.DAY_OF_MONTH)));
141
		
141
 
142
		start_Date.add(Calendar.DAY_OF_MONTH, -21);
142
		start_Date.add(Calendar.DAY_OF_MONTH, -21);
143
 
143
 
144
		XMLGregorianCalendar startDate = df.newXMLGregorianCalendar(new GregorianCalendar(start_Date.get(Calendar.YEAR),start_Date.get(Calendar.MONTH),start_Date.get(Calendar.DAY_OF_MONTH)));
144
		XMLGregorianCalendar startDate = df.newXMLGregorianCalendar(new GregorianCalendar(start_Date.get(Calendar.YEAR),start_Date.get(Calendar.MONTH),start_Date.get(Calendar.DAY_OF_MONTH)));
145
		start_Date.add(Calendar.DAY_OF_MONTH, 1);
145
		start_Date.add(Calendar.DAY_OF_MONTH, 1);
146
 
146
 
147
		XMLGregorianCalendar endDate1 = df.newXMLGregorianCalendar(new GregorianCalendar(start_Date.get(Calendar.YEAR),start_Date.get(Calendar.MONTH),start_Date.get(Calendar.DAY_OF_MONTH)));
147
		XMLGregorianCalendar endDate1 = df.newXMLGregorianCalendar(new GregorianCalendar(start_Date.get(Calendar.YEAR),start_Date.get(Calendar.MONTH),start_Date.get(Calendar.DAY_OF_MONTH)));
148
		
148
 
149
		fullfilledShipmentReportRequest.setStartDate(startDate);
149
		fullfilledShipmentReportRequest.setStartDate(startDate);
150
		fullfilledShipmentReportRequest.setEndDate(endDate1);
150
		fullfilledShipmentReportRequest.setEndDate(endDate1);
151
 
151
 
152
		// @TODO: set additional request parameters here
152
		// @TODO: set additional request parameters here
153
		Map<String,String> requestIdShipmentReportIdmap;
153
		Map<String,String> requestIdShipmentReportIdmap;
Line 171... Line 171...
171
		"Please do not leave any negative feedback. If you have any problems or concerns about your recent purchase, please get in touch with our customer service as soon as possible and we will do everything we can to help.<br><br>" +
171
		"Please do not leave any negative feedback. If you have any problems or concerns about your recent purchase, please get in touch with our customer service as soon as possible and we will do everything we can to help.<br><br>" +
172
		"Yours Sincerely,<br>" +
172
		"Yours Sincerely,<br>" +
173
		"Saholic Team<br>";
173
		"Saholic Team<br>";
174
 
174
 
175
		String emailIdFrom= "help@saholic.com";
175
		String emailIdFrom= "help@saholic.com";
176
		
-
 
177
		
-
 
178
 
176
 
179
		String shipmentReportRequestId = null;
177
		String shipmentReportRequestId = null;		
-
 
178
		while(true){
-
 
179
 
180
		try {
180
			try {
181
			shipmentReportRequestId = RequestReportSample.invokeRequestReport(service, fullfilledShipmentReportRequest);
181
				shipmentReportRequestId = RequestReportSample.invokeRequestReport(service, fullfilledShipmentReportRequest);
-
 
182
				break;
182
		} catch (MarketplaceWebServiceException e1) {
183
			} catch (MarketplaceWebServiceException e1) {
183
			// TODO Auto-generated catch block
184
				// TODO Auto-generated catch block
184
			e1.printStackTrace();
185
				e1.printStackTrace();
-
 
186
			}
185
		}
187
		}
186
		String returnsReportRequestId = null;
188
		String returnsReportRequestId = null;
-
 
189
		while(true){
187
		try {
190
			try {
188
			returnsReportRequestId = RequestReportSample.invokeRequestReport(service, returnsReportRequest);
191
				returnsReportRequestId = RequestReportSample.invokeRequestReport(service, returnsReportRequest);
-
 
192
				break;
189
		} catch (MarketplaceWebServiceException e1) {
193
			} catch (MarketplaceWebServiceException e1) {
190
			// TODO Auto-generated catch block
194
				// TODO Auto-generated catch block
191
			e1.printStackTrace();
195
				e1.printStackTrace();
-
 
196
			}
192
		}
197
		}
193
		while(true){
198
		while(true){
194
			GetReportListRequest requestShipmentReportList = new GetReportListRequest();
199
			GetReportListRequest requestShipmentReportList = new GetReportListRequest();
195
			requestShipmentReportList.setMerchant( merchantId );
200
			requestShipmentReportList.setMerchant( merchantId );
196
 
201
 
Line 205... Line 210...
205
			final IdList returnsReportRequestIdList = new IdList(Arrays.asList(returnsReportRequestId));        
210
			final IdList returnsReportRequestIdList = new IdList(Arrays.asList(returnsReportRequestId));        
206
			requestReturnsReportList.setReportRequestIdList(returnsReportRequestIdList);
211
			requestReturnsReportList.setReportRequestIdList(returnsReportRequestIdList);
207
 
212
 
208
			requestIdReturnsReportIdmap= GetReportListSample.invokeGetReportList(service, requestReturnsReportList);
213
			requestIdReturnsReportIdmap= GetReportListSample.invokeGetReportList(service, requestReturnsReportList);
209
 
214
 
210
			GetReportRequest requestShipmentReport = new GetReportRequest();
-
 
211
			requestShipmentReport.setMerchant( merchantId );
-
 
212
 
-
 
213
			GetReportRequest requestReturnsReport = new GetReportRequest();
-
 
214
			requestReturnsReport.setMerchant( merchantId );
-
 
215
 
-
 
216
 
-
 
217
			///Fetch report only if it is ready
215
			///Fetch report only if it is ready
218
			if(requestIdShipmentReportIdmap.get(shipmentReportRequestId)!=null && requestIdReturnsReportIdmap.get(returnsReportRequestId)!=null){
216
			if(requestIdShipmentReportIdmap.get(shipmentReportRequestId)!=null && requestIdReturnsReportIdmap.get(returnsReportRequestId)!=null){
-
 
217
				GetReportRequest requestShipmentReport = new GetReportRequest();
-
 
218
				requestShipmentReport.setMerchant( merchantId );
-
 
219
 
-
 
220
				GetReportRequest requestReturnsReport = new GetReportRequest();
-
 
221
				requestReturnsReport.setMerchant( merchantId );
-
 
222
 
219
				requestShipmentReport.setReportId( requestIdShipmentReportIdmap.get(shipmentReportRequestId) );
223
				requestShipmentReport.setReportId( requestIdShipmentReportIdmap.get(shipmentReportRequestId) );
220
				OutputStream shipmentReport=null;
224
				OutputStream shipmentReport=null;
221
				try {
225
				try {
222
					shipmentReport = new FileOutputStream( "/tmp/AmazonFullFilledShipmentReport.txt" );
226
					shipmentReport = new FileOutputStream( "/tmp/AmazonFullFilledShipmentReport.txt" );
223
				} catch (FileNotFoundException e) {
227
				} catch (FileNotFoundException e) {
Line 283... Line 287...
283
 
287
 
284
					}
288
					}
285
				} catch (IOException e) {
289
				} catch (IOException e) {
286
					log.error("Error Reading IO operations :- ", e);
290
					log.error("Error Reading IO operations :- ", e);
287
				} 
291
				} 
288
				
292
 
289
				break;
293
				break;
290
			}
294
			}
291
			else{ 
295
			else{ 
292
				log.info("Report not ready\n");
296
				log.info("Report not ready\n");
293
				try {
297
				try {