Subversion Repositories SmartDukaan

Rev

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

Rev 8526 Rev 8528
Line 34... Line 34...
34
import com.amazonaws.mws.model.RequestReportRequest;
34
import com.amazonaws.mws.model.RequestReportRequest;
35
import com.amazonaws.mws.samples.GetReportSample;
35
import com.amazonaws.mws.samples.GetReportSample;
36
 
36
 
37
public class FeedbackRequestEmailSender {
37
public class FeedbackRequestEmailSender {
38
 
38
 
39
	//protected static Logger log = Logger.getLogger(FeedbackRequestEmailSender.class);
39
	protected static Logger log = Logger.getLogger(FeedbackRequestEmailSender.class);
40
	public static void main(String... args){
40
	public static void main(String... args){
41
		/************************************************************************
41
		/************************************************************************
42
		 * Access Key ID and Secret Access Key ID, obtained from:
42
		 * Access Key ID and Secret Access Key ID, obtained from:
43
		 * http://aws.amazon.com
43
		 * http://aws.amazon.com
44
		 ***********************************************************************/
44
		 ***********************************************************************/
Line 172... Line 172...
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
 
176
 
177
		String shipmentReportRequestId = null;	
177
		String shipmentReportRequestId = null;		
178
		int i=1;
-
 
179
		while(true){
178
		while(true){
180
 
179
 
181
			try {
180
			try {
182
				shipmentReportRequestId = RequestReportSample.invokeRequestReport(service, fullfilledShipmentReportRequest);
181
				shipmentReportRequestId = RequestReportSample.invokeRequestReport(service, fullfilledShipmentReportRequest);
183
				break;
182
				break;
184
			} catch (MarketplaceWebServiceException e1) {
183
			} catch (MarketplaceWebServiceException e1) {
185
				// TODO Auto-generated catch block
184
				// TODO Auto-generated catch block
186
				e1.printStackTrace();
185
				e1.printStackTrace();
187
			}
186
			}
188
			i =i +1;
-
 
189
		}
187
		}
190
		System.out.println("i's Value.... "+i);
-
 
191
		String returnsReportRequestId = null;
188
		String returnsReportRequestId = null;
192
		int j=1;
-
 
193
		while(true){
189
		while(true){
194
			try {
190
			try {
195
				returnsReportRequestId = RequestReportSample.invokeRequestReport(service, returnsReportRequest);
191
				returnsReportRequestId = RequestReportSample.invokeRequestReport(service, returnsReportRequest);
196
				break;
192
				break;
197
			} catch (MarketplaceWebServiceException e1) {
193
			} catch (MarketplaceWebServiceException e1) {
198
				// TODO Auto-generated catch block
194
				// TODO Auto-generated catch block
199
				e1.printStackTrace();
195
				e1.printStackTrace();
200
			}
196
			}
201
			j =j +1;
-
 
202
		}
197
		}
203
		System.out.println("j's Value.... "+j);
-
 
204
		int m=0;
-
 
205
		while(true){
198
		while(true){
206
			GetReportListRequest requestShipmentReportList = new GetReportListRequest();
199
			GetReportListRequest requestShipmentReportList = new GetReportListRequest();
207
			requestShipmentReportList.setMerchant( merchantId );
200
			requestShipmentReportList.setMerchant( merchantId );
208
 
201
 
209
			GetReportListRequest requestReturnsReportList = new GetReportListRequest();
202
			GetReportListRequest requestReturnsReportList = new GetReportListRequest();
Line 230... Line 223...
230
				requestShipmentReport.setReportId( requestIdShipmentReportIdmap.get(shipmentReportRequestId) );
223
				requestShipmentReport.setReportId( requestIdShipmentReportIdmap.get(shipmentReportRequestId) );
231
				OutputStream shipmentReport=null;
224
				OutputStream shipmentReport=null;
232
				try {
225
				try {
233
					shipmentReport = new FileOutputStream( "/tmp/AmazonFullFilledShipmentReport.txt" );
226
					shipmentReport = new FileOutputStream( "/tmp/AmazonFullFilledShipmentReport.txt" );
234
				} catch (FileNotFoundException e) {
227
				} catch (FileNotFoundException e) {
235
					//log.error("Error Getting Shipment Report :- ", e);
228
					log.error("Error Getting Shipment Report :- ", e);
236
				}
229
				}
237
				requestShipmentReport.setReportOutputStream( shipmentReport );
230
				requestShipmentReport.setReportOutputStream( shipmentReport );
238
				GetReportSample.invokeGetReport(service, requestShipmentReport);
231
				GetReportSample.invokeGetReport(service, requestShipmentReport);
239
 
232
 
240
				System.out.println("Shipment Report ready please check\n");
233
				System.out.println("Shipment Report ready please check\n");
241
				CSVReader shipmentReportReader = null; 
234
				CSVReader shipmentReportReader = null; 
242
				try {
235
				try {
243
					shipmentReportReader = new CSVReader(new FileReader("/tmp/AmazonFullFilledShipmentReport.txt"),'\t');
236
					shipmentReportReader = new CSVReader(new FileReader("/tmp/AmazonFullFilledShipmentReport.txt"),'\t');
244
				} catch (FileNotFoundException e) {
237
				} catch (FileNotFoundException e) {
245
					//log.error("Error Reading Shipment Report :- ", e);
238
					log.error("Error Reading Shipment Report :- ", e);
246
				}
239
				}
247
 
240
 
248
				requestReturnsReport.setReportId( requestIdReturnsReportIdmap.get(returnsReportRequestId) );
241
				requestReturnsReport.setReportId( requestIdReturnsReportIdmap.get(returnsReportRequestId) );
249
				OutputStream returnsReport=null;
242
				OutputStream returnsReport=null;
250
				try {
243
				try {
251
					returnsReport = new FileOutputStream( "/tmp/AmazonReturnsReport.txt" );
244
					returnsReport = new FileOutputStream( "/tmp/AmazonReturnsReport.txt" );
252
				} catch (FileNotFoundException e) {
245
				} catch (FileNotFoundException e) {
253
					//log.error("Error Getting Returns Report :- ", e);
246
					log.error("Error Getting Returns Report :- ", e);
254
				}
247
				}
255
				requestReturnsReport.setReportOutputStream( returnsReport );
248
				requestReturnsReport.setReportOutputStream( returnsReport );
256
				GetReportSample.invokeGetReport(service, requestReturnsReport);
249
				GetReportSample.invokeGetReport(service, requestReturnsReport);
257
 
250
 
258
				System.out.println("Return Report ready please check\n");
251
				System.out.println("Return Report ready please check\n");
259
				CSVReader returnsReportReader = null; 
252
				CSVReader returnsReportReader = null; 
260
				try {
253
				try {
261
					returnsReportReader = new CSVReader(new FileReader("/tmp/AmazonReturnsReport.txt"),'\t');
254
					returnsReportReader = new CSVReader(new FileReader("/tmp/AmazonReturnsReport.txt"),'\t');
262
				} catch (FileNotFoundException e) {
255
				} catch (FileNotFoundException e) {
263
					//log.error("Error Reading Returns Report :- ", e);
256
					log.error("Error Reading Returns Report :- ", e);
264
				}
257
				}
265
 
258
 
266
 
259
 
267
				String [] shipmentReportData;
260
				String [] shipmentReportData;
268
				String [] returnsReportData;
261
				String [] returnsReportData;
Line 292... Line 285...
292
						}
285
						}
293
						}
286
						}
294
 
287
 
295
					}
288
					}
296
				} catch (IOException e) {
289
				} catch (IOException e) {
297
					//log.error("Error Reading IO operations :- ", e);
290
					log.error("Error Reading IO operations :- ", e);
298
				} 
291
				} 
299
 
292
 
300
				break;
293
				break;
301
			}
294
			}
302
			else{ 
295
			else{ 
303
				System.out.println("Report not ready\n");
296
				log.info("Report not ready\n");
304
				try {
297
				try {
305
					Thread.sleep(5*60*1000);
298
					Thread.sleep(5*60*1000);
306
				} catch (InterruptedException e) {
299
				} catch (InterruptedException e) {
307
					//log.error("Error During getting Response :- ", e);
300
					log.error("Error During getting Response :- ", e);
308
				}
301
				}
309
			}
302
			}
310
			m=m+1;
-
 
311
		}
303
		}
312
		System.out.println("m's Value.... "+m);
-
 
313
 
304
 
314
		//HelperClient helperServiceClient;
305
		HelperClient helperServiceClient;
315
		try {
306
		try {
316
			//helperServiceClient = new HelperClient("helper_service_server_host_prod", "helper_service_server_port_prod");
307
			helperServiceClient = new HelperClient("helper_service_server_host_prod", "helper_service_server_port_prod");
317
			//in.shop2020.utils.HelperService.Client client = helperServiceClient.getClient();
308
			in.shop2020.utils.HelperService.Client client = helperServiceClient.getClient();
318
			System.out.print("Email Id List: \n");
309
			System.out.print("Email Id List: \n");
319
			for(int k=0; k<fbaCustomersEmails.size();i++){
310
			for(int i=0; i<fbaCustomersEmails.size();i++){
320
				System.out.print(fbaCustomersEmails.get(i)+"\n");
311
				System.out.print(fbaCustomersEmails.get(i)+"\n");
321
				//client.saveUserEmailForSending(Arrays.asList(new String[] {fbaCustomersEmails.get(i)}), emailIdFrom, "Feedback Request", emailBody, "AmazonMFN", "AmazonFeedback", null, Arrays.asList(new String[] {"amit.sirohi@shop2020.in"}), 1);
312
				client.saveUserEmailForSending(Arrays.asList(new String[] {fbaCustomersEmails.get(i)}), emailIdFrom, "Feedback Request", emailBody, "AmazonMFN", "AmazonFeedback", null, Arrays.asList(new String[] {"amit.sirohi@shop2020.in"}), 1);
322
			}
313
			}
323
		} catch (Exception e) {
314
		} catch (Exception e) {
324
			//log.error("Error Getting Helper Client :- ", e);
315
			log.error("Error Getting Helper Client :- ", e);
325
		}
316
		}
326
 
317
 
327
 
318
 
328
 
319
 
329
		// Note that depending on the type of report being downloaded, a report can reach 
320
		// Note that depending on the type of report being downloaded, a report can reach