| 7935 |
manish.sha |
1 |
package in.shop2020.utils;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.config.ConfigException;
|
| 9338 |
manish.sha |
4 |
import in.shop2020.model.v1.inventory.WarehouseLocation;
|
| 7935 |
manish.sha |
5 |
import in.shop2020.thrift.clients.config.ConfigClient;
|
|
|
6 |
|
|
|
7 |
import com.fedex.ship.stub.ClientDetail;
|
|
|
8 |
import com.fedex.ship.stub.WebAuthenticationCredential;
|
|
|
9 |
import com.fedex.ship.stub.WebAuthenticationDetail;
|
|
|
10 |
|
|
|
11 |
public class FedExShipAccountInfo {
|
|
|
12 |
private ClientDetail clientDetail;
|
|
|
13 |
private WebAuthenticationDetail wad;
|
|
|
14 |
private String endPointAddress;
|
|
|
15 |
|
|
|
16 |
public FedExShipAccountInfo(){
|
|
|
17 |
clientDetail = new ClientDetail();
|
|
|
18 |
wad = new WebAuthenticationDetail();
|
|
|
19 |
endPointAddress = new String();
|
|
|
20 |
}
|
| 9338 |
manish.sha |
21 |
public static FedExShipAccountInfo getFedExInfo(WarehouseLocation location){
|
| 7935 |
manish.sha |
22 |
FedExShipAccountInfo fedexAccountInfo = new FedExShipAccountInfo();
|
|
|
23 |
ClientDetail cd= new ClientDetail();
|
|
|
24 |
String accountNumber ="";
|
|
|
25 |
String meterNumber ="";
|
| 9783 |
manish.sha |
26 |
String key="";
|
|
|
27 |
String password="";
|
| 7935 |
manish.sha |
28 |
try {
|
| 9338 |
manish.sha |
29 |
if(WarehouseLocation.Mumbai==location){
|
|
|
30 |
accountNumber = ConfigClient.getClient().get("fedex_account_number_mumbai");
|
| 9783 |
manish.sha |
31 |
meterNumber = ConfigClient.getClient().get("fedex_meter_number_mumbai");
|
|
|
32 |
key = ConfigClient.getClient().get("fedex_authenication_key_mumbai");
|
|
|
33 |
password = ConfigClient.getClient().get("fedex_authenication_password_mumbai");
|
| 9338 |
manish.sha |
34 |
}
|
|
|
35 |
else{
|
|
|
36 |
accountNumber = ConfigClient.getClient().get("fedex_account_number");
|
| 9783 |
manish.sha |
37 |
meterNumber = ConfigClient.getClient().get("fedex_meter_number");
|
|
|
38 |
key = ConfigClient.getClient().get("fedex_authenication_key");
|
|
|
39 |
password = ConfigClient.getClient().get("fedex_authenication_password");
|
| 9338 |
manish.sha |
40 |
}
|
| 9774 |
manish.sha |
41 |
System.out.println("accountNumber .... "+accountNumber);
|
|
|
42 |
System.out.println("meterNumber .... "+meterNumber);
|
| 7935 |
manish.sha |
43 |
} catch (ConfigException e) {
|
|
|
44 |
e.printStackTrace();
|
|
|
45 |
}
|
|
|
46 |
cd.setAccountNumber(accountNumber);
|
|
|
47 |
cd.setMeterNumber(meterNumber);
|
|
|
48 |
WebAuthenticationCredential wac = new WebAuthenticationCredential();
|
| 9783 |
manish.sha |
49 |
|
| 7935 |
manish.sha |
50 |
wac.setKey(key);
|
|
|
51 |
wac.setPassword(password);
|
|
|
52 |
WebAuthenticationDetail wa_details= new WebAuthenticationDetail(wac);
|
|
|
53 |
String endPoint="";
|
|
|
54 |
try {
|
| 9783 |
manish.sha |
55 |
endPoint = ConfigClient.getClient().get("fedex_endpoint_address_ship");
|
| 7935 |
manish.sha |
56 |
} catch (ConfigException e) {
|
|
|
57 |
e.printStackTrace();
|
|
|
58 |
}
|
|
|
59 |
fedexAccountInfo.setClientDetail(cd);
|
|
|
60 |
fedexAccountInfo.setWad(wa_details);
|
|
|
61 |
fedexAccountInfo.setEndPointAddress(endPoint);
|
|
|
62 |
return fedexAccountInfo;
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
public ClientDetail getClientDetail() {
|
|
|
66 |
return clientDetail;
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
public void setClientDetail(ClientDetail clientDetail) {
|
|
|
70 |
this.clientDetail = clientDetail;
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
public WebAuthenticationDetail getWad() {
|
|
|
74 |
return wad;
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
public void setWad(WebAuthenticationDetail wad) {
|
|
|
78 |
this.wad = wad;
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
public String getEndPointAddress() {
|
|
|
82 |
return endPointAddress;
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
public void setEndPointAddress(String endPointAddress) {
|
|
|
86 |
this.endPointAddress = endPointAddress;
|
|
|
87 |
}
|
|
|
88 |
}
|