Subversion Repositories SmartDukaan

Rev

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

Rev 7263 Rev 7268
Line 49... Line 49...
49
    public EstimateController() {
49
    public EstimateController() {
50
        super();
50
        super();
51
    }
51
    }
52
    
52
    
53
    // GET /logout
53
    // GET /logout
54
    public HttpHeaders create(){
54
    public String create(){
55
        LogisticsClient logisticsServiceClient = null;
55
        LogisticsClient logisticsServiceClient = null;
56
        CatalogClient catalogServiceClient = null;
56
        CatalogClient catalogServiceClient = null;
57
        try {
57
        try {
58
            logisticsServiceClient = new LogisticsClient();
58
            logisticsServiceClient = new LogisticsClient();
59
            Client logisticsClient = logisticsServiceClient.getClient();
59
            Client logisticsClient = logisticsServiceClient.getClient();
Line 64... Line 64...
64
            catalogServiceClient = new CatalogClient();
64
            catalogServiceClient = new CatalogClient();
65
            StorePricing sp = catalogServiceClient.getClient().getStorePricing(itemId);
65
            StorePricing sp = catalogServiceClient.getClient().getStorePricing(itemId);
66
            sellingPrice = sp.getRecommendedPrice();
66
            sellingPrice = sp.getRecommendedPrice();
67
            minAdvanceAmount = sp.getMinAdvancePrice();
67
            minAdvanceAmount = sp.getMinAdvancePrice();
68
            
68
            
69
        } catch (LogisticsServiceException e)   {
69
        } catch (Exception e)   {
70
            date = -1;
70
            date = -1;
71
            isCODAvailable = false;
71
            isCODAvailable = false;
72
            log.error("Unable to get estimate/COD availability for " + itemId, e);
72
            log.error("Unable to get estimate/COD availability for " + itemId, e);
73
            
-
 
74
        } catch(TException e)   {
-
 
75
            
-
 
76
        } catch (Exception e)   {
-
 
77
            
-
 
78
        }
73
        }
79
        SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy");
74
        SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy");
80
        
75
        
81
        response.put("delivery_estimate", dateformat.format(new Date(date)));
76
        response.put("delivery_estimate", dateformat.format(new Date(date)));
82
        response.put("is_cod_available_for_location", Boolean.toString(isCODAvailable));
77
        response.put("is_cod_available_for_location", Boolean.toString(isCODAvailable));
83
        response.put("on_time_guarantee", Boolean.toString(isOTGAvailable));
78
        response.put("on_time_guarantee", Boolean.toString(isOTGAvailable));
84
        response.put("selling_price", Double.toString(sellingPrice));
79
        response.put("selling_price", Double.toString(sellingPrice));
85
        response.put("min_advance_amount", Double.toString(minAdvanceAmount));
80
        response.put("min_advance_amount", Double.toString(minAdvanceAmount));
86
        
81
        
87
        
82
        
88
        return new DefaultHttpHeaders("index");
83
        return "index";
89
    }
84
    }
90
 
85
 
91
    public String getResponseJSONString() {
86
    public String getResponseJSONString() {
92
        Gson gson = new Gson();
87
        Gson gson = new Gson();
93
        return gson.toJson(response);
88
        return gson.toJson(response);
Line 98... Line 93...
98
    }
93
    }
99
 
94
 
100
    public long getProduct_id() {
95
    public long getProduct_id() {
101
        return product_id;
96
        return product_id;
102
    }
97
    }
-
 
98
 
-
 
99
    public String getPin() {
-
 
100
        return pin;
-
 
101
    }
-
 
102
 
-
 
103
    public void setPin(String pin) {
-
 
104
        this.pin = pin;
-
 
105
    }
103
}
106
}
104
107