Subversion Repositories SmartDukaan

Rev

Rev 7935 | Rev 9774 | Go to most recent revision | Details | Compare with Previous | 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;
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 ="";
26
		try {
9338 manish.sha 27
			if(WarehouseLocation.Mumbai==location){
28
				accountNumber = ConfigClient.getClient().get("fedex_account_number_mumbai");
29
			}
30
			else{
31
				accountNumber = ConfigClient.getClient().get("fedex_account_number");
32
			}
7935 manish.sha 33
			meterNumber = ConfigClient.getClient().get("fedex_meter_number");
34
		} catch (ConfigException e) {
35
			e.printStackTrace();
36
		}
37
		cd.setAccountNumber(accountNumber);
38
		cd.setMeterNumber(meterNumber);
39
		WebAuthenticationCredential wac = new WebAuthenticationCredential();
40
        String key="";
41
        String password="";
42
		try {
43
			key = ConfigClient.getClient().get("fedex_authenication_key");
44
			password = ConfigClient.getClient().get("fedex_authenication_password");
45
		} catch (ConfigException e) {
46
			e.printStackTrace();
47
		}
48
        wac.setKey(key);
49
        wac.setPassword(password);
50
        WebAuthenticationDetail wa_details= new WebAuthenticationDetail(wac);
51
        String endPoint="";
52
		try {
53
				endPoint = ConfigClient.getClient().get("fedex_endpoint_address_ship");
54
		} catch (ConfigException e) {
55
			e.printStackTrace();
56
		}
57
		fedexAccountInfo.setClientDetail(cd);
58
		fedexAccountInfo.setWad(wa_details);
59
		fedexAccountInfo.setEndPointAddress(endPoint);
60
		return fedexAccountInfo;
61
	}
62
 
63
	public ClientDetail getClientDetail() {
64
		return clientDetail;
65
	}
66
 
67
	public void setClientDetail(ClientDetail clientDetail) {
68
		this.clientDetail = clientDetail;
69
	}
70
 
71
	public WebAuthenticationDetail getWad() {
72
		return wad;
73
	}
74
 
75
	public void setWad(WebAuthenticationDetail wad) {
76
		this.wad = wad;
77
	}
78
 
79
	public String getEndPointAddress() {
80
		return endPointAddress;
81
	}
82
 
83
	public void setEndPointAddress(String endPointAddress) {
84
		this.endPointAddress = endPointAddress;
85
	}
86
}