| Line 1... |
Line 1... |
| 1 |
package in.shop2020.support.utils;
|
1 |
package in.shop2020.support.utils;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
3 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
| 4 |
import in.shop2020.model.v1.catalog.Item;
|
4 |
import in.shop2020.model.v1.catalog.Item;
|
| - |
|
5 |
import in.shop2020.support.controllers.SnapdealListController;
|
| 5 |
import in.shop2020.thrift.clients.CatalogClient;
|
6 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 6 |
import in.shop2020.utils.GmailUtils;
|
7 |
import in.shop2020.utils.GmailUtils;
|
| 7 |
|
8 |
|
| 8 |
import java.io.BufferedReader;
|
9 |
import java.io.BufferedReader;
|
| 9 |
import java.io.File;
|
10 |
import java.io.File;
|
| Line 23... |
Line 24... |
| 23 |
import org.apache.http.client.methods.HttpPost;
|
24 |
import org.apache.http.client.methods.HttpPost;
|
| 24 |
import org.apache.http.impl.client.DefaultHttpClient;
|
25 |
import org.apache.http.impl.client.DefaultHttpClient;
|
| 25 |
import org.apache.http.message.BasicNameValuePair;
|
26 |
import org.apache.http.message.BasicNameValuePair;
|
| 26 |
import org.apache.thrift.TException;
|
27 |
import org.apache.thrift.TException;
|
| 27 |
import org.apache.thrift.transport.TTransportException;
|
28 |
import org.apache.thrift.transport.TTransportException;
|
| - |
|
29 |
import org.slf4j.Logger;
|
| - |
|
30 |
import org.slf4j.LoggerFactory;
|
| 28 |
|
31 |
|
| 29 |
public class UpdateSDPricingUsingPanel extends Thread{
|
32 |
public class UpdateSDPricingUsingPanel extends Thread{
|
| 30 |
private static DefaultHttpClient client = new DefaultHttpClient();
|
33 |
private static DefaultHttpClient client = new DefaultHttpClient();
|
| 31 |
private Float price;
|
34 |
private Float price;
|
| 32 |
private String supc;
|
35 |
private String supc;
|
| 33 |
private Item item;
|
36 |
private Item item;
|
| 34 |
private Long timestamp;
|
37 |
private Long timestamp;
|
| 35 |
public String[] sendTo = new String[]{"vikram.raghav@shop2020.in"};
|
38 |
public String[] sendTo = new String[]{"vikram.raghav@shop2020.in"};
|
| - |
|
39 |
private static Logger logger = LoggerFactory.getLogger(UpdateSDPricingUsingPanel.class);
|
| 36 |
/*public String[] sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
|
40 |
/*public String[] sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
|
| 37 |
"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
|
41 |
"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
|
| 38 |
"yukti.jain@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in"};
|
42 |
"yukti.jain@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in"};
|
| 39 |
*/public String emailFromAddress = "build@shop2020.in";
|
43 |
*/public String emailFromAddress = "build@shop2020.in";
|
| 40 |
public String password = "cafe@nes";
|
44 |
public String password = "cafe@nes";
|
| 41 |
public UpdateSDPricingUsingPanel(Float price,String supc,Item item,Long timestamp){
|
45 |
public UpdateSDPricingUsingPanel(Float price,String supc,Item item,Long timestamp){
|
| - |
|
46 |
logger.info("Calling Update Snapdeal Price Constructor --" + " Price :" +price + " Supc :"+supc +" Item ID:" +item.getId());
|
| 42 |
this.price = price;
|
47 |
this.price = price;
|
| 43 |
this.supc = supc;
|
48 |
this.supc = supc;
|
| 44 |
this.item = item;
|
49 |
this.item = item;
|
| 45 |
this.timestamp = timestamp;
|
50 |
this.timestamp = timestamp;
|
| 46 |
}
|
51 |
}
|
| Line 50... |
Line 55... |
| 50 |
UpdateSDPricingUsingPanel UDSI = new UpdateSDPricingUsingPanel();
|
55 |
UpdateSDPricingUsingPanel UDSI = new UpdateSDPricingUsingPanel();
|
| 51 |
//UDSI.updatePricing(10131f,"SDL668125910","");
|
56 |
//UDSI.updatePricing(10131f,"SDL668125910","");
|
| 52 |
|
57 |
|
| 53 |
}
|
58 |
}
|
| 54 |
int updatePricing(Float price,String supc,Item item,Long timestamp) throws ClientProtocolException, IOException{
|
59 |
int updatePricing(Float price,String supc,Item item,Long timestamp) throws ClientProtocolException, IOException{
|
| - |
|
60 |
logger.info("Calling Update Snapdeal Price Constructor --" + " Price :" +price + " Supc :"+supc +" Item ID:" +item.getId());
|
| 55 |
HttpPost post = new HttpPost("http://seller.snapdeal.com/pricing/update");
|
61 |
HttpPost post = new HttpPost("http://seller.snapdeal.com/pricing/update");
|
| 56 |
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
|
62 |
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
|
| 57 |
nameValuePairs.add(new BasicNameValuePair("sellingPrice",
|
63 |
nameValuePairs.add(new BasicNameValuePair("sellingPrice",
|
| 58 |
String.valueOf(price)));
|
64 |
String.valueOf(price)));
|
| 59 |
nameValuePairs.add(new BasicNameValuePair("id",
|
65 |
nameValuePairs.add(new BasicNameValuePair("id",
|
| Line 68... |
Line 74... |
| 68 |
}
|
74 |
}
|
| 69 |
return 1;
|
75 |
return 1;
|
| 70 |
}
|
76 |
}
|
| 71 |
|
77 |
|
| 72 |
public void handleLogin() throws ClientProtocolException, IOException{
|
78 |
public void handleLogin() throws ClientProtocolException, IOException{
|
| - |
|
79 |
logger.info("----Inside Handle Login ----" );
|
| 73 |
HttpGet get = new HttpGet("http://selleraccounts.snapdeal.com/keymaker/login");
|
80 |
HttpGet get = new HttpGet("http://selleraccounts.snapdeal.com/keymaker/login");
|
| 74 |
HttpResponse response = null;
|
81 |
HttpResponse response = null;
|
| 75 |
try {
|
82 |
try {
|
| 76 |
response = client.execute(get);
|
83 |
response = client.execute(get);
|
| 77 |
} catch (ClientProtocolException e) {
|
84 |
} catch (ClientProtocolException e) {
|
| Line 144... |
Line 151... |
| 144 |
response = client.execute(get);
|
151 |
response = client.execute(get);
|
| 145 |
rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|
152 |
rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|
| 146 |
while ((line = rd.readLine()) != null) {
|
153 |
while ((line = rd.readLine()) != null) {
|
| 147 |
//System.out.println(line);
|
154 |
//System.out.println(line);
|
| 148 |
}
|
155 |
}
|
| - |
|
156 |
logger.info("Login Successful");
|
| 149 |
}
|
157 |
}
|
| 150 |
public void run()
|
158 |
public void run()
|
| 151 |
{
|
159 |
{
|
| 152 |
try {
|
160 |
try {
|
| 153 |
this.handleLogin();
|
161 |
this.handleLogin();
|