Subversion Repositories SmartDukaan

Rev

Rev 9338 | Go to most recent revision | Details | Last modification | View Log | RSS feed

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