Subversion Repositories SmartDukaan

Rev

Rev 651 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 651 Rev 692
Line 43... Line 43...
43
			setRedirectUrl();
43
			setRedirectUrl();
44
			return "login";
44
			return "login";
45
		}
45
		}
46
    	long userId = userinfo.getUserId();
46
    	long userId = userinfo.getUserId();
47
    	boolean isLoggedIn = userinfo.isLoggedIn();
47
    	boolean isLoggedIn = userinfo.isLoggedIn();
48
    	
48
    	long cartId = userinfo.getCartId();
49
    	try {
49
    	try {
50
			UserContextService.Client userClient = (new UserContextServiceClient()).getClient();
50
			UserContextService.Client userClient = (new UserContextServiceClient()).getClient();
-
 
51
			userClient.checkOut(cartId);
51
			long defaultAddressId = userClient.getDefaultAddressId(userId);
52
			long defaultAddressId = userClient.getDefaultAddressId(userId);
52
			log.info("The default address id of this user is: " + defaultAddressId);
53
			log.info("The default address id of this user is: " + defaultAddressId);
53
			if(defaultAddressId > 0)
54
			if(defaultAddressId > 0)
54
				userClient.addAddressToCart(userinfo.getCartId(), defaultAddressId);
55
				userClient.addAddressToCart(cartId, defaultAddressId);
55
			if(!userClient.validateCart(userinfo.getCartId()))
56
			if(!userClient.validateCart(cartId))
56
				errorMsg = "Your cart has been updated.";
57
				errorMsg = "Your cart has been updated.";
57
			
58
			
58
		} catch (Exception e) {
59
		} catch (Exception e) {
59
			// This exception can be ignored for showing the cart. Not so
60
			// This exception can be ignored for showing the cart. Not so
60
			// innocent when this occurs at the time of checkout or when the
61
			// innocent when this occurs at the time of checkout or when the