Subversion Repositories SmartDukaan

Rev

Rev 9338 | Rev 9783 | 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");
9774 manish.sha 34
			System.out.println("accountNumber .... "+accountNumber);
35
			System.out.println("meterNumber .... "+meterNumber);
7935 manish.sha 36
		} catch (ConfigException e) {
37
			e.printStackTrace();
38
		}
39
		cd.setAccountNumber(accountNumber);
40
		cd.setMeterNumber(meterNumber);
41
		WebAuthenticationCredential wac = new WebAuthenticationCredential();
42
        String key="";
43
        String password="";
44
		try {
45
			key = ConfigClient.getClient().get("fedex_authenication_key");
46
			password = ConfigClient.getClient().get("fedex_authenication_password");
47
		} catch (ConfigException e) {
48
			e.printStackTrace();
49
		}
50
        wac.setKey(key);
51
        wac.setPassword(password);
52
        WebAuthenticationDetail wa_details= new WebAuthenticationDetail(wac);
53
        String endPoint="";
54
		try {
55
				endPoint = ConfigClient.getClient().get("fedex_endpoint_address_ship");
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
}