Subversion Repositories SmartDukaan

Rev

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

Rev 8260 Rev 8267
Line 39... Line 39...
39
	public static void main(String... args){
39
	public static void main(String... args){
40
		/************************************************************************
40
		/************************************************************************
41
		 * Access Key ID and Secret Access Key ID, obtained from:
41
		 * Access Key ID and Secret Access Key ID, obtained from:
42
		 * http://aws.amazon.com
42
		 * http://aws.amazon.com
43
		 ***********************************************************************/
43
		 ***********************************************************************/
44
		final String accessKeyId = "AKIAII3SGRXBJDPCHSGQ";
44
		/*final String accessKeyId = "AKIAII3SGRXBJDPCHSGQ";
45
		final String secretAccessKey = "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";
45
		final String secretAccessKey = "B92xTbNBTYygbGs98w01nFQUhbec1pNCkCsKVfpg";
46
 
46
 
47
		final String appName = "Test";
47
		final String appName = "Test";
48
		final String appVersion = "1.0";
48
		final String appVersion = "1.0";
49
		final String merchantId = "AF6E3O0VE0X4D";
49
		final String merchantId = "AF6E3O0VE0X4D";
50
 
50
 
51
		MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();
51
		MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();
52
 
52
 
53
		/************************************************************************
53
		*//************************************************************************
54
		 * Uncomment to set the appropriate MWS endpoint.
54
		 * Uncomment to set the appropriate MWS endpoint.
55
		 ************************************************************************/
55
		 ************************************************************************//*
56
		// US
56
		// US
57
		// config.setServiceURL("https://mws.amazonservices.com");
57
		// config.setServiceURL("https://mws.amazonservices.com");
58
		// UK
58
		// UK
59
		// config.setServiceURL("https://mws.amazonservices.co.uk");
59
		// config.setServiceURL("https://mws.amazonservices.co.uk");
60
		// Germany
60
		// Germany
Line 70... Line 70...
70
		// Canada
70
		// Canada
71
		// config.setServiceURL("https://mws.amazonservices.ca");
71
		// config.setServiceURL("https://mws.amazonservices.ca");
72
		// India
72
		// India
73
		config.setServiceURL("https://mws.amazonservices.in");
73
		config.setServiceURL("https://mws.amazonservices.in");
74
 
74
 
75
		/************************************************************************
75
		*//************************************************************************
76
		 * You can also try advanced configuration options. Available options are:
76
		 * You can also try advanced configuration options. Available options are:
77
		 *
77
		 *
78
		 *  - Signature Version
78
		 *  - Signature Version
79
		 *  - Proxy Host and Proxy Port
79
		 *  - Proxy Host and Proxy Port
80
		 *  - User Agent String to be sent to Marketplace Web Service
80
		 *  - User Agent String to be sent to Marketplace Web Service
81
		 *
81
		 *
82
		 ***********************************************************************/
82
		 ***********************************************************************//*
83
 
83
 
84
		/************************************************************************
84
		*//************************************************************************
85
		 * Instantiate Http Client Implementation of Marketplace Web Service        
85
		 * Instantiate Http Client Implementation of Marketplace Web Service        
86
		 ***********************************************************************/
86
		 ***********************************************************************//*
87
 
87
 
88
		MarketplaceWebService service = new MarketplaceWebServiceClient(
88
		MarketplaceWebService service = new MarketplaceWebServiceClient(
89
				accessKeyId, secretAccessKey, appName, appVersion, config);
89
				accessKeyId, secretAccessKey, appName, appVersion, config);
90
 
90
 
91
		/************************************************************************
91
		*//************************************************************************
92
		 * Uncomment to try out Mock Service that simulates Marketplace Web Service 
92
		 * Uncomment to try out Mock Service that simulates Marketplace Web Service 
93
		 * responses without calling Marketplace Web Service  service.
93
		 * responses without calling Marketplace Web Service  service.
94
		 *
94
		 *
95
		 * Responses are loaded from local XML files. You can tweak XML files to
95
		 * Responses are loaded from local XML files. You can tweak XML files to
96
		 * experiment with various outputs during development
96
		 * experiment with various outputs during development
97
		 *
97
		 *
98
		 * XML files available under com/amazonaws/mws/mock tree
98
		 * XML files available under com/amazonaws/mws/mock tree
99
		 *
99
		 *
100
		 ***********************************************************************/
100
		 ***********************************************************************//*
101
		// MarketplaceWebService service = new MarketplaceWebServiceMock();
101
		// MarketplaceWebService service = new MarketplaceWebServiceMock();
102
 
102
 
103
		/************************************************************************
103
		*//************************************************************************
104
		 * Setup request parameters and uncomment invoke to try out 
104
		 * Setup request parameters and uncomment invoke to try out 
105
		 * sample for Request Report 
105
		 * sample for Request Report 
106
		 ***********************************************************************/
106
		 ***********************************************************************//*
107
 
107
 
108
		/************************************************************************
108
		*//************************************************************************
109
		 * Marketplace and Merchant IDs are required parameters for all 
109
		 * Marketplace and Merchant IDs are required parameters for all 
110
		 * Marketplace Web Service calls.
110
		 * Marketplace Web Service calls.
111
		 ***********************************************************************/
111
		 ***********************************************************************//*
112
		// marketplaces from which data should be included in the report; look at the
112
		// marketplaces from which data should be included in the report; look at the
113
		// API reference document on the MWS website to see which marketplaces are
113
		// API reference document on the MWS website to see which marketplaces are
114
		// included if you do not specify the list yourself
114
		// included if you do not specify the list yourself
115
		final IdList marketplaces = new IdList(Arrays.asList(
115
		final IdList marketplaces = new IdList(Arrays.asList(
116
		"A21TJRUUN4KGV"));        
116
		"A21TJRUUN4KGV"));        
Line 154... Line 154...
154
		returnsReportRequest.setStartDate(startDate);
154
		returnsReportRequest.setStartDate(startDate);
155
		returnsReportRequest.setEndDate(endDate2);
155
		returnsReportRequest.setEndDate(endDate2);
156
 
156
 
157
		Map<String,String> requestIdReturnsReportIdmap;
157
		Map<String,String> requestIdReturnsReportIdmap;
158
 
158
 
159
		List<String> fbaCustomersEmails  = new ArrayList<String>();
159
		List<String> fbaCustomersEmails  = new ArrayList<String>();*/
160
		///Request report
160
		///Request report
161
 
161
 
162
		String emailBody= "Dear Customer, <br><br>" +
162
		String emailBody= "Dear Customer, <br><br>" +
163
		"Thank you very much for shopping with Saholic at Amazon.in .<br><br>"+
163
		"Thank you very much for shopping with Saholic at Amazon.in .<br><br>"+
164
		"We hope that you are happy with your purchase and if you are, please spare some time to leave positive feedback for us.<br><br>" +
164
		"We hope that you are happy with your purchase and if you are, please spare some time to leave positive feedback for us.<br><br>" +
Line 170... Line 170...
170
		"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>" +
170
		"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
		"Yours Sincerely,<br>" +
171
		"Yours Sincerely,<br>" +
172
		"Saholic Team<br>";
172
		"Saholic Team<br>";
173
 
173
 
174
		String emailIdFrom= "help@saholic.com";
174
		String emailIdFrom= "help@saholic.com";
175
		TransactionClient transactionServiceClient = null;
-
 
176
		
-
 
177
		try{
-
 
178
			transactionServiceClient= new TransactionClient();
-
 
179
		}
175
				
180
		catch(Exception e){
-
 
181
			log.error("Error While initializing Transaction Client :- ", e);
-
 
182
		}
176
		/*
183
		
-
 
184
 
-
 
185
		String shipmentReportRequestId = RequestReportSample.invokeRequestReport(service, fullfilledShipmentReportRequest);
177
		String shipmentReportRequestId = RequestReportSample.invokeRequestReport(service, fullfilledShipmentReportRequest);
186
		String returnsReportRequestId = RequestReportSample.invokeRequestReport(service, returnsReportRequest);
178
		String returnsReportRequestId = RequestReportSample.invokeRequestReport(service, returnsReportRequest);
187
		while(true){
179
		while(true){
188
			GetReportListRequest requestShipmentReportList = new GetReportListRequest();
180
			GetReportListRequest requestShipmentReportList = new GetReportListRequest();
189
			requestShipmentReportList.setMerchant( merchantId );
181
			requestShipmentReportList.setMerchant( merchantId );
Line 218... Line 210...
218
					log.error("Error Getting Shipment Report :- ", e);
210
					log.error("Error Getting Shipment Report :- ", e);
219
				}
211
				}
220
				requestShipmentReport.setReportOutputStream( shipmentReport );
212
				requestShipmentReport.setReportOutputStream( shipmentReport );
221
				GetReportSample.invokeGetReport(service, requestShipmentReport);
213
				GetReportSample.invokeGetReport(service, requestShipmentReport);
222
 
214
 
223
				log.info("Shipment Report ready please check\n");
215
				System.out.println("Shipment Report ready please check\n");
224
				CSVReader shipmentReportReader = null; 
216
				CSVReader shipmentReportReader = null; 
225
				try {
217
				try {
226
					shipmentReportReader = new CSVReader(new FileReader("/tmp/AmazonFullFilledShipmentReport.txt"),'\t');
218
					shipmentReportReader = new CSVReader(new FileReader("/tmp/AmazonFullFilledShipmentReport.txt"),'\t');
227
				} catch (FileNotFoundException e) {
219
				} catch (FileNotFoundException e) {
228
					log.error("Error Reading Shipment Report :- ", e);
220
					log.error("Error Reading Shipment Report :- ", e);
Line 236... Line 228...
236
					log.error("Error Getting Returns Report :- ", e);
228
					log.error("Error Getting Returns Report :- ", e);
237
				}
229
				}
238
				requestReturnsReport.setReportOutputStream( returnsReport );
230
				requestReturnsReport.setReportOutputStream( returnsReport );
239
				GetReportSample.invokeGetReport(service, requestReturnsReport);
231
				GetReportSample.invokeGetReport(service, requestReturnsReport);
240
 
232
 
241
				log.info("Return Report ready please check\n");
233
				System.out.println("Return Report ready please check\n");
242
				CSVReader returnsReportReader = null; 
234
				CSVReader returnsReportReader = null; 
243
				try {
235
				try {
244
					returnsReportReader = new CSVReader(new FileReader("/tmp/AmazonReturnsReport.txt"),'\t');
236
					returnsReportReader = new CSVReader(new FileReader("/tmp/AmazonReturnsReport.txt"),'\t');
245
				} catch (FileNotFoundException e) {
237
				} catch (FileNotFoundException e) {
246
					log.error("Error Reading Returns Report :- ", e);
238
					log.error("Error Reading Returns Report :- ", e);
Line 288... Line 280...
288
					Thread.sleep(5*60*1000);
280
					Thread.sleep(5*60*1000);
289
				} catch (InterruptedException e) {
281
				} catch (InterruptedException e) {
290
					log.error("Error During getting Response :- ", e);
282
					log.error("Error During getting Response :- ", e);
291
				}
283
				}
292
			}
284
			}
293
		}
285
		}*/
294
 
286
 
295
		HelperClient helperServiceClient;
287
		HelperClient helperServiceClient;
296
		try {
288
		try {
297
			helperServiceClient = new HelperClient();
289
			helperServiceClient = new HelperClient();
298
			in.shop2020.utils.HelperService.Client client = helperServiceClient.getClient();
290
			in.shop2020.utils.HelperService.Client client = helperServiceClient.getClient();
299
			log.info("Email Id List: \n");
291
			System.out.print("Email Id List: \n");
300
			for(int i=0; i<fbaCustomersEmails.size();i++){
292
			//for(int i=0; i<fbaCustomersEmails.size();i++){
301
				log.info(fbaCustomersEmails.get(i)+"\n");
293
				//System.out.print(fbaCustomersEmails.get(i)+"\n");
302
				client.saveUserEmailForSending(Arrays.asList(new String[] {fbaCustomersEmails.get(i)}), emailIdFrom, "Feedback Request", emailBody, "AmazonMFN", "AmazonFeedback", Arrays.asList(new String[] {" "}), Arrays.asList(new String[] {"amit.sirohi@shop2020.in"}), 1);
294
				client.saveUserEmailForSending(Arrays.asList(new String[] {"manish.sharma@shop2020.in"}), emailIdFrom, "Feedback Request", emailBody, "AmazonMFN", "AmazonFeedback", Arrays.asList(new String[] {" "}), Arrays.asList(new String[] {"manish.sharma@shop2020.in"}), 1);
303
			}
295
			//}
304
		} catch (Exception e) {
296
		} catch (Exception e) {
305
			log.error("Error Getting Helper Client :- ", e);
297
			log.error("Error Getting Helper Client :- ", e);
306
		}
298
		}
307
 
299
 
308
 
300