Subversion Repositories SmartDukaan

Rev

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

Rev 1527 Rev 1999
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
 
2
 
-
 
3
import java.util.Date;
3
import java.util.List;
4
import java.util.List;
4
 
5
 
5
import org.apache.log4j.Logger;
6
import org.apache.log4j.Logger;
6
import org.apache.struts2.convention.annotation.InterceptorRef;
7
import org.apache.struts2.convention.annotation.InterceptorRef;
7
import org.apache.struts2.convention.annotation.InterceptorRefs;
8
import org.apache.struts2.convention.annotation.InterceptorRefs;
Line 9... Line 10...
9
 
10
 
10
import in.shop2020.model.v1.order.Order;
11
import in.shop2020.model.v1.order.Order;
11
import in.shop2020.model.v1.order.TransactionServiceException;
12
import in.shop2020.model.v1.order.TransactionServiceException;
12
import in.shop2020.model.v1.user.Cart;
13
import in.shop2020.model.v1.user.Cart;
13
import in.shop2020.model.v1.user.ShoppingCartException;
14
import in.shop2020.model.v1.user.ShoppingCartException;
-
 
15
import in.shop2020.model.v1.user.UserAffiliateException;
14
import in.shop2020.payments.PaymentException;
16
import in.shop2020.payments.PaymentException;
-
 
17
import in.shop2020.serving.interceptors.TrackingInterceptor;
15
import in.shop2020.thrift.clients.PaymentServiceClient;
18
import in.shop2020.thrift.clients.PaymentServiceClient;
16
import in.shop2020.thrift.clients.TransactionServiceClient;
19
import in.shop2020.thrift.clients.TransactionServiceClient;
17
import in.shop2020.thrift.clients.UserContextServiceClient;
20
import in.shop2020.thrift.clients.UserContextServiceClient;
18
 
21
 
19
 
22
 
Line 61... Line 64...
61
			int totalItems = 0;
64
			int totalItems = 0;
62
			if(cart != null){
65
			if(cart != null){
63
				totalItems = cart.getLinesSize();
66
				totalItems = cart.getLinesSize();
64
			}
67
			}
65
			userinfo.setTotalItems(totalItems);
68
			userinfo.setTotalItems(totalItems);
-
 
69
			if (cookiesMap.containsKey(TrackingInterceptor.AFF_COOKIE)) {
-
 
70
	            long affId = Long.parseLong(cookiesMap.get(TrackingInterceptor.AFF_COOKIE).getValue());
-
 
71
	            userServiceClient.getClient().addTrackLog(affId, userinfo.getUserId(), "payment success", "",
-
 
72
                        Long.toString(merchantPaymentId), (new Date()).getTime());
-
 
73
	        }
66
		} catch (PaymentException e) {
74
		} catch (PaymentException e) {
67
			log.error("Payment service not responding. Payment id is" + merchantPaymentId);
75
			log.error("Payment service not responding. Payment id is" + merchantPaymentId);
68
			e.printStackTrace();
76
			e.printStackTrace();
69
		} catch (TException e) {
77
		} catch (TException e) {
70
			log.error("Thrift service exception. Payment id is" + merchantPaymentId);
78
			log.error("Thrift service exception. Payment id is" + merchantPaymentId);
Line 73... Line 81...
73
			log.error("Transaction service exception. Payment id is" + merchantPaymentId);
81
			log.error("Transaction service exception. Payment id is" + merchantPaymentId);
74
			e.printStackTrace();
82
			e.printStackTrace();
75
		} catch (ShoppingCartException e) {
83
		} catch (ShoppingCartException e) {
76
			log.error("Shopping cart service exception. Payment id is" + merchantPaymentId + " message id and name are " + e.getId() + e.getMessage());
84
			log.error("Shopping cart service exception. Payment id is" + merchantPaymentId + " message id and name are " + e.getId() + e.getMessage());
77
			e.printStackTrace();
85
			e.printStackTrace();
-
 
86
		} catch (UserAffiliateException e) {
-
 
87
		    log.error("Affiliate service exception. Payment id is" + merchantPaymentId + " message id and name are " + e.getId() + e.getMessage());
-
 
88
            e.printStackTrace();
78
		}
89
        }
79
		
90
		
80
		return "index";
91
		return "index";
81
	}
92
	}
82
	
93
	
83
	
94