Subversion Repositories SmartDukaan

Rev

Rev 8832 | Rev 9784 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8832 Rev 9338
Line 1... Line 1...
1
package in.shop2020.serving.services;
1
package in.shop2020.serving.services;
2
 
2
 
3
import in.shop2020.config.ConfigException;
3
import in.shop2020.config.ConfigException;
-
 
4
import in.shop2020.model.v1.inventory.WarehouseLocation;
4
import in.shop2020.model.v1.order.Order;
5
import in.shop2020.model.v1.order.Order;
5
import in.shop2020.serving.model.ShipmentUpdate;
6
import in.shop2020.serving.model.ShipmentUpdate;
6
import in.shop2020.thrift.clients.config.ConfigClient;
7
import in.shop2020.thrift.clients.config.ConfigClient;
7
 
8
 
8
import java.text.SimpleDateFormat;
9
import java.text.SimpleDateFormat;
Line 30... Line 31...
30
	private String endPointAddress;
31
	private String endPointAddress;
31
	/**
32
	/**
32
	 * @param args
33
	 * @param args
33
	 */
34
	 */
34
	
35
	
35
	public FedExTrackingService(){
36
	public FedExTrackingService(WarehouseLocation location){
36
		clientDetails = getFedExClientDetails();
37
		clientDetails = getFedExClientDetails(location);
37
		waDetails = getFedExWebAuthenticationDetails();
38
		waDetails = getFedExWebAuthenticationDetails();
38
		endPointAddress = getFedExEndpointAddress();
39
		endPointAddress = getFedExEndpointAddress();
39
	}
40
	}
40
	
41
	
41
	public ClientDetail getFedExClientDetails(){
42
	public ClientDetail getFedExClientDetails(WarehouseLocation whlocation){
42
		ClientDetail clientDetail = new ClientDetail();
43
		ClientDetail clientDetail = new ClientDetail();
43
        String accountNumber ="";
44
        String accountNumber ="";
44
        String meterNumber ="";
45
        String meterNumber ="";
45
		try {
46
		try {
-
 
47
			if(WarehouseLocation.Mumbai==whlocation){
-
 
48
				accountNumber = ConfigClient.getClient().get("fedex_account_number_mumbai");
-
 
49
			}
-
 
50
			else{
46
			accountNumber = ConfigClient.getClient().get("fedex_account_number");
51
				accountNumber = ConfigClient.getClient().get("fedex_account_number");
-
 
52
			}
47
			meterNumber = ConfigClient.getClient().get("fedex_meter_number");
53
			meterNumber = ConfigClient.getClient().get("fedex_meter_number");
48
		} catch (ConfigException e) {
54
		} catch (ConfigException e) {
49
			log.error("Could not fetch Client Detail", e);
55
			log.error("Could not fetch Client Detail", e);
50
		}
56
		}
51
		log.info("fedex_account_number in Tracking Service"+accountNumber);
57
		log.info("fedex_account_number in Tracking Service"+accountNumber);
Line 310... Line 316...
310
			return null;
316
			return null;
311
		}
317
		}
312
	}
318
	}
313
	
319
	
314
	public static void main(String[] args) {
320
	public static void main(String[] args) {
315
		FedExTrackingService trackClient = new FedExTrackingService();
321
		FedExTrackingService trackClient = new FedExTrackingService(WarehouseLocation.Delhi);
316
		List<ShipmentUpdate> updates = trackClient.getUpdates("796869788166");
322
		List<ShipmentUpdate> updates = trackClient.getUpdates("796869788166");
317
		for(ShipmentUpdate update: updates){
323
		for(ShipmentUpdate update: updates){
318
			System.out.println(update.toString());
324
			System.out.println(update.toString());
319
		}
325
		}
320
	}
326
	}