Subversion Repositories SmartDukaan

Rev

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

Rev 4882 Rev 5326
Line 92... Line 92...
92
    	    addActionError("Invalid address. Please add an address to the cart.");
92
    	    addActionError("Invalid address. Please add an address to the cart.");
93
    	    return "shipping-redirect";
93
    	    return "shipping-redirect";
94
    	}
94
    	}
95
    	 
95
    	 
96
    	long currentCartId = userinfo.getCartId();
96
    	long currentCartId = userinfo.getCartId();
-
 
97
    	long currentUserId = userinfo.getUserId();
97
    	
98
    	
98
    	if(paymentOption.equals(IPaymentService.COD)){
99
    	if(paymentOption.equals(IPaymentService.COD)){
99
    	    if(!verifyCaptcha()){
100
    	    if(!verifyCaptcha()){
100
    	        addActionError("Invalid captcha");
101
    	        addActionError("Invalid captcha");
101
    	        log.info("Invalid captcha error msg has been added");
102
    	        log.info("Invalid captcha error msg has been added");
Line 119... Line 120...
119
                return "proceed-to-pay-redirect";
120
                return "proceed-to-pay-redirect";
120
            }
121
            }
121
    	}
122
    	}
122
    	
123
    	
123
    	try {
124
    	try {
124
    		if(!createOrders(addressId, currentCartId)) {
125
    		if(!createOrders(addressId, currentCartId, currentUserId)) {
125
    			addActionError("We are experiencing some problems. Please try later.");
126
    			addActionError("We are experiencing some problems. Please try later.");
126
    			return "proceed-to-pay-redirect";
127
    			return "proceed-to-pay-redirect";
127
    		}
128
    		}
128
    	} catch (Exception e) {
129
    	} catch (Exception e) {
129
    		addActionError("We are experiencing some problems. Please try later.");
130
    		addActionError("We are experiencing some problems. Please try later.");
Line 241... Line 242...
241
	 * 
242
	 * 
242
	 * @param addressId
243
	 * @param addressId
243
	 * @param currentCartId
244
	 * @param currentCartId
244
	 * @return
245
	 * @return
245
	 */
246
	 */
246
	private boolean createOrders(long addressId, long currentCartId){
247
	private boolean createOrders(long addressId, long currentCartId, long currentUserId){
247
		UserClient userServiceClient = null;
248
		UserClient userServiceClient = null;
248
		try {
249
		try {
249
			userServiceClient = new UserClient();
250
			userServiceClient = new UserClient();
250
		} catch (Exception e) {
251
		} catch (Exception e) {
251
			log.error("Unable to talk to the user context service.", e);
252
			log.error("Unable to talk to the user context service.", e);
Line 293... Line 294...
293
            try {
294
            try {
294
                firstSrcTime = Long.parseLong(getCookie(TrackingInterceptor.SRC_TIME_COOKIE, false, null));
295
                firstSrcTime = Long.parseLong(getCookie(TrackingInterceptor.SRC_TIME_COOKIE, false, null));
295
            } catch (Exception e) {
296
            } catch (Exception e) {
296
                log.warn("Unable to parse session src time cookie.", e);
297
                log.warn("Unable to parse session src time cookie.", e);
297
            }
298
            }
298
            txnId = userClient.createOrders(currentCartId, sessionSrc, sessionTime, firstSrc, firstSrcTime);
299
            txnId = userClient.createOrders(currentCartId, sessionSrc, sessionTime, firstSrc, firstSrcTime, currentUserId);
299
		} catch (ShoppingCartException e1) {
300
		} catch (ShoppingCartException e1) {
300
			log.error("Error while creating orders from cart.", e1);
301
			log.error("Error while creating orders from cart.", e1);
301
			return false;
302
			return false;
302
		} catch (TException e) {
303
		} catch (TException e) {
303
			log.error("Thrift exception while creating orders from cart.", e);
304
			log.error("Thrift exception while creating orders from cart.", e);