Subversion Repositories SmartDukaan

Rev

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

Rev 2511 Rev 2817
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
 
2
 
3
import in.shop2020.datalogger.EventType;
3
import in.shop2020.datalogger.EventType;
4
import in.shop2020.model.v1.order.Order;
4
import in.shop2020.model.v1.order.Order;
5
import in.shop2020.model.v1.user.ShoppingCartException;
5
import in.shop2020.model.v1.user.ShoppingCartException;
-
 
6
import in.shop2020.serving.interceptors.TrackingInterceptor;
6
import in.shop2020.serving.services.EbsPaymentService;
7
import in.shop2020.serving.services.EbsPaymentService;
7
import in.shop2020.serving.services.HdfcPaymentService;
8
import in.shop2020.serving.services.HdfcPaymentService;
8
import in.shop2020.serving.services.IPaymentService;
9
import in.shop2020.serving.services.IPaymentService;
-
 
10
import in.shop2020.serving.utils.DesEncrypter;
9
import in.shop2020.thrift.clients.TransactionServiceClient;
11
import in.shop2020.thrift.clients.TransactionServiceClient;
10
import in.shop2020.thrift.clients.UserContextServiceClient;
12
import in.shop2020.thrift.clients.UserContextServiceClient;
11
import in.shop2020.utils.DataLogger;
13
import in.shop2020.utils.DataLogger;
12
 
14
 
13
import java.util.List;
15
import java.util.List;
14
 
16
 
-
 
17
import javax.servlet.http.Cookie;
-
 
18
 
15
import org.apache.log4j.Logger;
19
import org.apache.log4j.Logger;
16
import org.apache.struts2.convention.annotation.InterceptorRef;
20
import org.apache.struts2.convention.annotation.InterceptorRef;
17
import org.apache.struts2.convention.annotation.InterceptorRefs;
21
import org.apache.struts2.convention.annotation.InterceptorRefs;
18
import org.apache.struts2.convention.annotation.Result;
22
import org.apache.struts2.convention.annotation.Result;
19
import org.apache.struts2.convention.annotation.Results;
23
import org.apache.struts2.convention.annotation.Results;
Line 177... Line 181...
177
			return false;
181
			return false;
178
		}
182
		}
179
		
183
		
180
		
184
		
181
		try {
185
		try {
-
 
186
		    String sessionSrc = null;
-
 
187
		    Cookie sessionSrcCookie = (Cookie) cookiesMap.get(TrackingInterceptor.SESSION_SRC_COOKIE);
-
 
188
            if (sessionSrcCookie != null) {
-
 
189
                DesEncrypter desEncrypter = new DesEncrypter(TrackingInterceptor.ENCRIPTION_STRING);
-
 
190
                sessionSrc = desEncrypter.decrypt(sessionSrcCookie.getValue());
-
 
191
            }
-
 
192
            
-
 
193
            Cookie sessionSrcTimeCookie = (Cookie) cookiesMap.get(TrackingInterceptor.SESSION_SRC_TIME_COOKIE);
-
 
194
            long sessionTime = 0;
-
 
195
            if (sessionSrcTimeCookie != null) {
-
 
196
                try {
-
 
197
                    sessionTime = Long.parseLong(sessionSrcTimeCookie.getValue());
-
 
198
                }
-
 
199
                catch (Exception e) {
-
 
200
                    log.warn("Unable to parse session src time cookie.");
-
 
201
                }
-
 
202
            }
182
			txnId = userClient.createOrders(currentCartId);
203
		    txnId = userClient.createOrders(currentCartId, sessionSrc, sessionTime);
183
		} catch (ShoppingCartException e1) {
204
		} catch (ShoppingCartException e1) {
184
			log.error("Error while creating orders from cart.", e1);
205
			log.error("Error while creating orders from cart.", e1);
185
			return false;
206
			return false;
186
		} catch (TException e) {
207
		} catch (TException e) {
187
			log.error("Thrift exception while creating orders from cart.", e);
208
			log.error("Thrift exception while creating orders from cart.", e);