| Line 39... |
Line 39... |
| 39 |
import java.text.SimpleDateFormat;
|
39 |
import java.text.SimpleDateFormat;
|
| 40 |
import java.util.ArrayList;
|
40 |
import java.util.ArrayList;
|
| 41 |
import java.util.Calendar;
|
41 |
import java.util.Calendar;
|
| 42 |
import java.util.Collections;
|
42 |
import java.util.Collections;
|
| 43 |
import java.util.Date;
|
43 |
import java.util.Date;
|
| - |
|
44 |
import java.util.GregorianCalendar;
|
| 44 |
import java.util.List;
|
45 |
import java.util.List;
|
| 45 |
import org.apache.http.client.HttpClient;
|
46 |
import org.apache.http.client.HttpClient;
|
| 46 |
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
47 |
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
| 47 |
import org.apache.http.client.methods.HttpGet;
|
48 |
import org.apache.http.client.methods.HttpGet;
|
| 48 |
import org.apache.http.client.methods.HttpPost;
|
49 |
import org.apache.http.client.methods.HttpPost;
|
| Line 169... |
Line 170... |
| 169 |
}
|
170 |
}
|
| 170 |
else{
|
171 |
else{
|
| 171 |
sku = order.getSku();
|
172 |
sku = order.getSku();
|
| 172 |
logger.info(orderId+" "+subOrderId + " Processing sku " + sku);
|
173 |
logger.info(orderId+" "+subOrderId + " Processing sku " + sku);
|
| 173 |
}
|
174 |
}
|
| 174 |
if(order.getStatus().length()!=0 && order.getStatus().equalsIgnoreCase("Approved")){
|
175 |
/*if(order.getStatus().length()!=0 && order.getStatus().equalsIgnoreCase("Approved")){
|
| 175 |
String status = order.getStatus();
|
176 |
String status = order.getStatus();
|
| 176 |
}
|
177 |
}
|
| 177 |
else{
|
178 |
else{
|
| 178 |
if(order.getStatus().length()==0){
|
179 |
if(order.getStatus().length()==0){
|
| 179 |
sb.append(orderId+" "+subOrderId + " Could not parse status " + "\n");
|
180 |
sb.append(orderId+" "+subOrderId + " Could not parse status " + "\n");
|
| Line 182... |
Line 183... |
| 182 |
else{
|
183 |
else{
|
| 183 |
sb.append(orderId+" "+subOrderId + " Order not Approved" +"\n");
|
184 |
sb.append(orderId+" "+subOrderId + " Order not Approved" +"\n");
|
| 184 |
logger.info(orderId+" "+subOrderId + " Order not Approved" +"\n");
|
185 |
logger.info(orderId+" "+subOrderId + " Order not Approved" +"\n");
|
| 185 |
}
|
186 |
}
|
| 186 |
continue;
|
187 |
continue;
|
| 187 |
}
|
188 |
}*/
|
| 188 |
double unitSellingPrice,shippingPrice,octroiFee,emiFee;
|
189 |
double unitSellingPrice,shippingPrice,octroiFee,emiFee;
|
| 189 |
if(order.getListPrice()!=0 ){
|
190 |
if(order.getListPrice()!=0 ){
|
| 190 |
if(order.getListPrice() > 0){
|
191 |
if(order.getListPrice() > 0){
|
| 191 |
unitSellingPrice = order.getListPrice();
|
192 |
unitSellingPrice = order.getListPrice();
|
| 192 |
}
|
193 |
}
|
| Line 580... |
Line 581... |
| 580 |
order_string = "Order";
|
581 |
order_string = "Order";
|
| 581 |
}
|
582 |
}
|
| 582 |
else{
|
583 |
else{
|
| 583 |
order_string = "Orders";
|
584 |
order_string = "Orders";
|
| 584 |
}
|
585 |
}
|
| - |
|
586 |
/*java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
| - |
|
587 |
Calendar cal=GregorianCalendar.getInstance();
|
| - |
|
588 |
String emailFromAddress = "build@shop2020.in";
|
| - |
|
589 |
String password = "cafe@nes";
|
| - |
|
590 |
GmailUtils mailer = new GmailUtils();
|
| - |
|
591 |
//String sendTo[] = new String[]{"vikram.raghav@shop2020.in"};
|
| - |
|
592 |
String sendTo[] = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
|
| - |
|
593 |
"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
|
| - |
|
594 |
"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
|
| - |
|
595 |
try {
|
| - |
|
596 |
logger.info("Before Sending Emails");
|
| - |
|
597 |
|
| - |
|
598 |
if(sb.toString().equalsIgnoreCase("")){
|
| - |
|
599 |
if(orders_processed!=0){
|
| - |
|
600 |
String emailSubjectTxt = orders_processed + " Flipkart " + order_string + " Created "+sdf.format(cal.getTime());
|
| - |
|
601 |
mailer.sendSSLMessage(sendTo, emailSubjectTxt,"Orders Created Successfully (No Alerts)", emailFromAddress, password, new ArrayList<File>());
|
| - |
|
602 |
logger.info("Sending Email Flipkart Orders Created Successfully (No Alerts)");
|
| - |
|
603 |
}
|
| - |
|
604 |
}
|
| - |
|
605 |
else{
|
| - |
|
606 |
if(orders_processed!=0){
|
| - |
|
607 |
String emailSubjectTxt = orders_processed + " Flipkart " + order_string + " Created (Check Alerts) "+sdf.format(cal.getTime());
|
| - |
|
608 |
mailer.sendSSLMessage(sendTo, emailSubjectTxt,sb.toString(), emailFromAddress, password, new ArrayList<File>());
|
| - |
|
609 |
logger.info("Sending Email Flipkart Orders Created Successfully (Check Alerts)");
|
| - |
|
610 |
}
|
| - |
|
611 |
else{
|
| - |
|
612 |
String emailSubjectTxt = "No new Flipkart orders created "+sdf.format(cal.getTime());
|
| - |
|
613 |
mailer.sendSSLMessage(sendTo, emailSubjectTxt,sb.toString(), emailFromAddress, password, new ArrayList<File>());
|
| - |
|
614 |
logger.info("Sending Email Flipkart Orders Created Successfully (Check Alerts)");
|
| - |
|
615 |
}
|
| - |
|
616 |
}
|
| - |
|
617 |
}
|
| - |
|
618 |
catch (Exception e) {
|
| - |
|
619 |
e.printStackTrace();
|
| - |
|
620 |
logger.error("Exception ",e);
|
| - |
|
621 |
}
|
| - |
|
622 |
*/
|
| 585 |
|
623 |
|
| 586 |
}
|
624 |
}
|
| 587 |
|
625 |
|
| 588 |
public static LineItem createLineItem(long itemId, double amount) throws CatalogServiceException, TException {
|
626 |
public static LineItem createLineItem(long itemId, double amount) throws CatalogServiceException, TException {
|
| 589 |
LineItem lineItem = new LineItem();
|
627 |
LineItem lineItem = new LineItem();
|