Subversion Repositories SmartDukaan

Rev

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

Rev 3063 Rev 3076
Line 15... Line 15...
15
import in.shop2020.thrift.clients.UserContextServiceClient;
15
import in.shop2020.thrift.clients.UserContextServiceClient;
16
import in.shop2020.utils.DataLogger;
16
import in.shop2020.utils.DataLogger;
17
 
17
 
18
import java.util.ArrayList;
18
import java.util.ArrayList;
19
import java.util.Collection;
19
import java.util.Collection;
20
import java.util.Enumeration;
-
 
21
import java.util.HashMap;
20
import java.util.HashMap;
22
import java.util.List;
21
import java.util.List;
23
import java.util.Map;
22
import java.util.Map;
24
import java.util.Properties;
-
 
25
import java.util.ResourceBundle;
23
import java.util.ResourceBundle;
26
 
24
 
27
import net.tanesha.recaptcha.ReCaptcha;
-
 
28
import net.tanesha.recaptcha.ReCaptchaFactory;
-
 
29
 
-
 
30
import org.apache.log4j.Logger;
25
import org.apache.log4j.Logger;
31
import org.apache.struts2.convention.annotation.InterceptorRef;
26
import org.apache.struts2.convention.annotation.InterceptorRef;
32
import org.apache.struts2.convention.annotation.InterceptorRefs;
27
import org.apache.struts2.convention.annotation.InterceptorRefs;
33
import org.apache.struts2.convention.annotation.Result;
28
import org.apache.struts2.convention.annotation.Result;
34
import org.apache.struts2.convention.annotation.Results;
29
import org.apache.struts2.convention.annotation.Results;
35
import org.apache.velocity.VelocityContext;
30
import org.apache.velocity.VelocityContext;
36
 
31
 
-
 
32
@SuppressWarnings("serial")
37
@InterceptorRefs({
33
@InterceptorRefs({
38
    @InterceptorRef("myDefault"),
34
    @InterceptorRef("myDefault"),
39
    @InterceptorRef("login")
35
    @InterceptorRef("login")
40
})
36
})
41
 
37
 
Line 43... Line 39...
43
    @Result(name="redirect", type="redirectAction", 
39
    @Result(name="redirect", type="redirectAction", 
44
    		params = {"actionName" , "shipping"})
40
    		params = {"actionName" , "shipping"})
45
})
41
})
46
public class ShippingController extends BaseController{
42
public class ShippingController extends BaseController{
47
	
43
	
48
	private static final long serialVersionUID = 1L;
-
 
49
	private static Logger log = Logger.getLogger(Class.class);
44
	private static Logger log = Logger.getLogger(Class.class);
50
	
45
	
51
	private static final ResourceBundle resource = ResourceBundle.getBundle(ShippingController.class.getName());
46
	private static final ResourceBundle resource = ResourceBundle.getBundle(ShippingController.class.getName());
52
	private static final double COD_CUTOFF_AMOUNT = Double.parseDouble(resource.getString("cod_cutoff_amount")); 
47
	private static final double COD_CUTOFF_AMOUNT = Double.parseDouble(resource.getString("cod_cutoff_amount")); 
53
	private static final String RECAPTCHA_PUBLIC_KEY = resource.getString("recaptcha_public_key");
48
	private static final String RECAPTCHA_PUBLIC_KEY = resource.getString("recaptcha_public_key");
Line 174... Line 169...
174
                            Long.toString(userinfo.getCartId()), Long.toString(addressId));
169
                            Long.toString(userinfo.getCartId()), Long.toString(addressId));
175
					return "index";
170
					return "index";
176
				}
171
				}
177
			}
172
			}
178
		} catch (Exception e) {
173
		} catch (Exception e) {
-
 
174
		    log.error("Error while adding address to the cart", e);
179
			return "failure";
175
			return "failure";
180
		}
176
		}
181
		return null;
177
		return null;
182
	}
178
	}
183
 
179
 
Line 258... Line 254...
258
	            if(address.getId() == defaultAddressId){
254
	            if(address.getId() == defaultAddressId){
259
	                try {
255
	                try {
260
	                    LogisticsServiceClient lClient = new LogisticsServiceClient();
256
	                    LogisticsServiceClient lClient = new LogisticsServiceClient();
261
	                    showCodOption = showCodOption && lClient.getClient().isCodAllowed(address.getPin());
257
	                    showCodOption = showCodOption && lClient.getClient().isCodAllowed(address.getPin());
262
	                } catch(Exception e) {
258
	                } catch(Exception e) {
263
	                    log.error("Error while checking if COD is available for: " + showCodOption);
259
	                    log.error("Error while checking if COD is available for: " + showCodOption, e);
264
	                    showCodOption = false; //Defaulting to defensive behaviour
260
	                    showCodOption = false; //Defaulting to defensive behaviour
265
	                }
261
	                }
266
	            }
262
	            }
267
	        }
263
	        }
268
	        
264