Subversion Repositories SmartDukaan

Rev

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

Rev 5340 Rev 6524
Line 34... Line 34...
34
	private String id;
34
	private String id;
35
	private long itemId;
35
	private long itemId;
36
	private String pincode;
36
	private String pincode;
37
	private long days = -1;
37
	private long days = -1;
38
	private boolean isCODAvailable;
38
	private boolean isCODAvailable;
-
 
39
	private boolean isOTGAvailable;
39
	private Map<String, String> response = new HashMap<String, String>();
40
	private Map<String, String> response = new HashMap<String, String>();
40
	
41
	
41
	public EstimateController() {
42
	public EstimateController() {
42
		super();
43
		super();
43
	}
44
	}
Line 49... Line 50...
49
			logisticsServiceClient = new LogisticsClient();
50
			logisticsServiceClient = new LogisticsClient();
50
			Client logisticsClient = logisticsServiceClient.getClient();
51
			Client logisticsClient = logisticsServiceClient.getClient();
51
			LogisticsInfo logistincInfo = logisticsClient.getLogisticsEstimation(itemId, pincode, DeliveryType.PREPAID);
52
			LogisticsInfo logistincInfo = logisticsClient.getLogisticsEstimation(itemId, pincode, DeliveryType.PREPAID);
52
			days = logistincInfo.getDeliveryTime();
53
			days = logistincInfo.getDeliveryTime();
53
			isCODAvailable = logistincInfo.isCodAllowed();
54
			isCODAvailable = logistincInfo.isCodAllowed();
-
 
55
			isOTGAvailable = logistincInfo.isOtgAvailable();
54
    	} catch (LogisticsServiceException e)	{
56
    	} catch (LogisticsServiceException e)	{
55
    		days = -1;
57
    		days = -1;
56
    		isCODAvailable = false;
58
    		isCODAvailable = false;
57
    		log.error("Unable to get estimate/COD availability for " + itemId, e);
59
    		log.error("Unable to get estimate/COD availability for " + itemId, e);
58
    		
60
    		
Line 61... Line 63...
61
		} catch (Exception e)	{
63
		} catch (Exception e)	{
62
    		
64
    		
63
		}
65
		}
64
		response.put("delivery_estimate", Long.toString(days));
66
		response.put("delivery_estimate", Long.toString(days));
65
		response.put("is_cod_available_for_location", Boolean.toString(isCODAvailable));
67
		response.put("is_cod_available_for_location", Boolean.toString(isCODAvailable));
-
 
68
		response.put("on_time_guarantee", Boolean.toString(isOTGAvailable));
66
		
69
		
67
		try{
70
		try{
68
			if(pincode.length() == 6 && !pincode.equals("110001")){
71
			if(pincode.length() == 6 && !pincode.equals("110001")){
69
				String requestOrigin = request.getHeader("referer").contains("cart")?"Cart":"Product";
72
				String requestOrigin = request.getHeader("referer").contains("cart")?"Cart":"Product";
70
				DataLogger.logData(EventType.DELIVERY_ESTIMATE, getSessionId(), userinfo.getUserId(), userinfo.getEmail(),
73
				DataLogger.logData(EventType.DELIVERY_ESTIMATE, getSessionId(), userinfo.getUserId(), userinfo.getEmail(),