| Line 104... |
Line 104... |
| 104 |
writer.close();
|
104 |
writer.close();
|
| 105 |
reader.close();
|
105 |
reader.close();
|
| 106 |
}
|
106 |
}
|
| 107 |
try {
|
107 |
try {
|
| 108 |
SubmitPromotionFeed(promotionFilename,amazonPromotions);
|
108 |
SubmitPromotionFeed(promotionFilename,amazonPromotions);
|
| 109 |
} catch (TException e) {
|
109 |
} catch (Exception e) {
|
| 110 |
logger.error("TException in subit promtiono feed ",e);
|
110 |
logger.error("TException in subit promtiono feed ",e);
|
| 111 |
GmailUtils mailer = new GmailUtils();
|
111 |
GmailUtils mailer = new GmailUtils();
|
| 112 |
try{
|
112 |
try{
|
| 113 |
//mailer.sendSSLMessage(sendTo, "Amazon Promotion ( Submission Id " + feedSubmissionId + " )","", emailFromAddress , password, new ArrayList<File>(), tempFile);
|
113 |
//mailer.sendSSLMessage(sendTo, "Amazon Promotion ( Submission Id " + feedSubmissionId + " )","", emailFromAddress , password, new ArrayList<File>(), tempFile);
|
| 114 |
mailer.sendSSLMessage(engineering,"Thrift Exception in configuring amazon promotion",emailFromAddress, password, "");
|
114 |
mailer.sendSSLMessage(engineering,"Thrift Exception in configuring amazon promotion",emailFromAddress, password, "");
|
| Line 129... |
Line 129... |
| 129 |
} catch (MarketplaceWebServiceException e) {
|
129 |
} catch (MarketplaceWebServiceException e) {
|
| 130 |
logger.error("MWS exception while creating promo",e);
|
130 |
logger.error("MWS exception while creating promo",e);
|
| 131 |
}
|
131 |
}
|
| 132 |
}
|
132 |
}
|
| 133 |
|
133 |
|
| 134 |
public void SubmitPromotionFeed(String file,List<AmazonPromotion> amazonPromotions) throws InterruptedException, MarketplaceWebServiceException, IOException, TException{
|
134 |
public void SubmitPromotionFeed(String file,List<AmazonPromotion> amazonPromotions) throws InterruptedException, MarketplaceWebServiceException, IOException, TException, CatalogServiceException{
|
| 135 |
MarketplaceWebService service = getMarketplaceServiceInstance();
|
135 |
MarketplaceWebService service = getMarketplaceServiceInstance();
|
| 136 |
SubmitFeedRequest requestPromotion = new SubmitFeedRequest();
|
136 |
SubmitFeedRequest requestPromotion = new SubmitFeedRequest();
|
| 137 |
requestPromotion.setMerchant("AF6E3O0VE0X4D");
|
137 |
requestPromotion.setMerchant("AF6E3O0VE0X4D");
|
| 138 |
requestPromotion.setMarketplaceIdList(new IdList(Arrays.asList("A21TJRUUN4KGV")));
|
138 |
requestPromotion.setMarketplaceIdList(new IdList(Arrays.asList("A21TJRUUN4KGV")));
|
| 139 |
requestPromotion.setFeedType("_POST_FLAT_FILE_LISTINGS_DATA_");
|
139 |
requestPromotion.setFeedType("_POST_FLAT_FILE_LISTINGS_DATA_");
|
| 140 |
FileInputStream promotionfis = new FileInputStream(file);
|
140 |
FileInputStream promotionfis = new FileInputStream(file);
|
| 141 |
requestPromotion.setContentMD5(computeContentMD5HeaderValue(promotionfis));
|
141 |
requestPromotion.setContentMD5(computeContentMD5HeaderValue(promotionfis));
|
| 142 |
requestPromotion.setFeedContent(promotionfis);
|
142 |
requestPromotion.setFeedContent(promotionfis);
|
| 143 |
String feedSubmissionId = invokeSubmitFeed(service,requestPromotion);
|
143 |
String feedSubmissionId = invokeSubmitFeed(service,requestPromotion);
|
| - |
|
144 |
Thread.sleep(180000);
|
| 144 |
sendPromotionConfigurationEmail(feedSubmissionId);
|
145 |
sendPromotionConfigurationEmail(feedSubmissionId);
|
| 145 |
CheckPromoFeedSubmission ck = new CheckPromoFeedSubmission();
|
146 |
CheckPromoFeedSubmission ck = new CheckPromoFeedSubmission();
|
| 146 |
int checkResultCount=0;
|
147 |
int checkResultCount=0;
|
| 147 |
List<String> failedSkus=null;
|
148 |
List<String> failedSkus=null;
|
| 148 |
List<AmazonPromotion> successfulPromo = new ArrayList<AmazonPromotion>();
|
149 |
List<AmazonPromotion> successfulPromo = new ArrayList<AmazonPromotion>();
|
| Line 179... |
Line 180... |
| 179 |
catalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
|
180 |
catalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
|
| 180 |
} catch (TTransportException e) {
|
181 |
} catch (TTransportException e) {
|
| 181 |
logger.error("Catalog Service ex ",e);
|
182 |
logger.error("Catalog Service ex ",e);
|
| 182 |
return;
|
183 |
return;
|
| 183 |
}
|
184 |
}
|
| - |
|
185 |
|
| 184 |
catalogClient.updateAmazonPromotion(successfulPromo);
|
186 |
if(!catalogClient.updateAmazonPromotion(successfulPromo)){
|
| - |
|
187 |
throw new CatalogServiceException();
|
| - |
|
188 |
}
|
| 185 |
if (failedSkus.size()>0){
|
189 |
if (failedSkus.size()>0){
|
| 186 |
sendFailerMail(failedSkus,feedSubmissionId);
|
190 |
sendFailerMail(failedSkus,feedSubmissionId);
|
| 187 |
}
|
191 |
}
|
| 188 |
else{
|
192 |
else{
|
| 189 |
sendSuccessMail(feedSubmissionId);
|
193 |
sendSuccessMail(feedSubmissionId);
|