Subversion Repositories SmartDukaan

Rev

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

Rev 11386 Rev 11511
Line 21... Line 21...
21
 
21
 
22
import org.apache.commons.lang.StringUtils;
22
import org.apache.commons.lang.StringUtils;
23
import org.apache.log4j.Logger;
23
import org.apache.log4j.Logger;
24
import org.apache.struts2.interceptor.ParameterAware;
24
import org.apache.struts2.interceptor.ParameterAware;
25
import org.apache.thrift.TException;
25
import org.apache.thrift.TException;
-
 
26
import org.apache.thrift.transport.TTransportException;
26
 
27
 
27
import com.google.gson.Gson;
28
import com.google.gson.Gson;
28
 
29
 
29
public class CartController extends BaseController implements ParameterAware{
30
public class CartController extends BaseController implements ParameterAware{
30
    
31
    
Line 62... Line 63...
62
    }
63
    }
63
    
64
    
64
    public String index() {
65
    public String index() {
65
        if(id != -1){
66
        if(id != -1){
66
            try {
67
            try {
-
 
68
            	log.info("Before cart response--------");
67
                List<String> cartResponse  = userClient.validateCart(id, -1);
69
                List<String> cartResponse  = userClient.validateCart(id, -1);
-
 
70
                log.info("After cart response--------");
68
                if (!"".equals(cartResponse.get(0))) {
71
                if (!"".equals(cartResponse.get(0))) {
69
                    errorMsg = cartResponse.get(0);
72
                    errorMsg = cartResponse.get(0);
70
                }
73
                }
71
                if(StringUtils.isNotEmpty(cartResponse.get(1))) {
74
                if(StringUtils.isNotEmpty(cartResponse.get(1))) {
72
                    addActionMessage(cartResponse.get(1));
75
                    addActionMessage(cartResponse.get(1));
Line 101... Line 104...
101
                }
104
                }
102
                
105
                
103
                cartPojoJson = new Gson().toJson(PojoPopulator.getCartPojo(cart, errorMsg, pincode, needInuranceInfo));
106
                cartPojoJson = new Gson().toJson(PojoPopulator.getCartPojo(cart, errorMsg, pincode, needInuranceInfo));
104
                log.info(cartPojoJson);
107
                log.info(cartPojoJson);
105
            } catch (Exception e) {
108
            } catch (Exception e) {
106
                // This exception can be ignored for showing the cart. Not so
109
                TTransportException te = (TTransportException)e;
107
                // innocent when this occurs at the time of checkout or when the
110
                log.warn(e.getLocalizedMessage() + " " + te.getType());
108
                // user is proceeding to pay.
-
 
109
                log.warn("Unable to validate the cart: ", e);
111
                log.warn("Unable to validate the cart: ", e);
110
            }
112
            }
111
        }
113
        }
112
        return "index";
114
        return "index";
113
    }
115
    }
Line 115... Line 117...
115
    public String create() {
117
    public String create() {
116
    	RedirectPojo rp = new RedirectPojo();
118
    	RedirectPojo rp = new RedirectPojo();
117
    	rp.setRedirectUrl("");
119
    	rp.setRedirectUrl("");
118
        try {
120
        try {
119
        	//NotificationPojo np = new NotificationPojo();
121
        	//NotificationPojo np = new NotificationPojo();
120
            UserClient userServiceClient = new UserClient();
122
            //UserClient userServiceClient = new UserClient();
121
            UserContextService.Client userClient = userServiceClient.getClient();
123
            //UserContextService.Client userClient = userServiceClient.getClient();
122
            cartMsg = userClient.addItemToCart(id, itemId, 1, -1);
124
            cartMsg = userClient.addItemToCart(id, itemId, 1, -1);
123
            if (!("".equals(cartMsg))) {
125
            if (!("".equals(cartMsg))) {
124
            	String emailId = this.request.getParameter("email");
126
            	String emailId = this.request.getParameter("email");
125
            	log.info("QuesyString" + this.request.getParameterMap().toString());
127
            	log.info("QuesyString" + this.request.getParameterMap().toString());
126
    			if(emailId==null || emailId.equals("")){
128
    			if(emailId==null || emailId.equals("")){