Subversion Repositories SmartDukaan

Rev

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

Rev 2199 Rev 2263
Line 9... Line 9...
9
import java.util.Map;
9
import java.util.Map;
10
import java.util.StringTokenizer;
10
import java.util.StringTokenizer;
11
import java.util.TreeMap;
11
import java.util.TreeMap;
12
 
12
 
13
import in.shop2020.config.ConfigException;
13
import in.shop2020.config.ConfigException;
-
 
14
import in.shop2020.datalogger.EventType;
14
import in.shop2020.payments.Attribute;
15
import in.shop2020.payments.Attribute;
15
import in.shop2020.payments.Payment;
16
import in.shop2020.payments.Payment;
16
import in.shop2020.payments.PaymentException;
17
import in.shop2020.payments.PaymentException;
17
import in.shop2020.payments.PaymentStatus;
18
import in.shop2020.payments.PaymentStatus;
18
import in.shop2020.serving.services.CommonPaymentService;
19
import in.shop2020.serving.services.CommonPaymentService;
19
import in.shop2020.serving.services.EbsPaymentService;
20
import in.shop2020.serving.services.EbsPaymentService;
20
import in.shop2020.serving.utils.DataLogger;
21
import in.shop2020.serving.utils.DataLogger;
21
import in.shop2020.serving.utils.DataLogger.Event;
-
 
22
import in.shop2020.serving.utils.ebs.Base64;
22
import in.shop2020.serving.utils.ebs.Base64;
23
import in.shop2020.serving.utils.ebs.RC4;
23
import in.shop2020.serving.utils.ebs.RC4;
24
import in.shop2020.thrift.clients.PaymentServiceClient;
24
import in.shop2020.thrift.clients.PaymentServiceClient;
25
import in.shop2020.thrift.clients.TransactionServiceClient;
25
import in.shop2020.thrift.clients.TransactionServiceClient;
26
import in.shop2020.thrift.clients.UserContextServiceClient;
26
import in.shop2020.thrift.clients.UserContextServiceClient;
Line 150... Line 150...
150
				} catch (PaymentException e) {
150
				} catch (PaymentException e) {
151
					log.error("Error while updating failed capture payment attempt: ", e);
151
					log.error("Error while updating failed capture payment attempt: ", e);
152
				} catch (TException e) {
152
				} catch (TException e) {
153
					log.error("Error while updating failed capture payment attempt: ", e);
153
					log.error("Error while updating failed capture payment attempt: ", e);
154
				}
154
				}
155
				DataLogger.logData(Event.PAYMENT_FAILURE.name(), session.getId(), Long.toString(userinfo.getUserId()), userinfo.getEmail(), Long.toString(merchantPaymentId), gatewayPaymentId,
155
				DataLogger.logData(EventType.PAYMENT_FAILURE.name(), session.getId(), Long.toString(userinfo.getUserId()), userinfo.getEmail(), Long.toString(merchantPaymentId), gatewayPaymentId,
156
                        gatewayTxnStatus, description, errorCode);
156
                        gatewayTxnStatus, description, errorCode);
157
				this.redirectUrl = errorUrl + "?paymentId=" + merchantPaymentId;
157
				this.redirectUrl = errorUrl + "?paymentId=" + merchantPaymentId;
158
			}else{
158
			}else{
159
				//Success
159
				//Success
160
				try {
160
				try {
Line 169... Line 169...
169
					log.error("Error while updating successful capture payment attempt: ", e);
169
					log.error("Error while updating successful capture payment attempt: ", e);
170
				}
170
				}
171
				
171
				
172
				CommonPaymentService.processSuccessfulTxn(txnId, userServiceClient, transactionServiceClient);
172
				CommonPaymentService.processSuccessfulTxn(txnId, userServiceClient, transactionServiceClient);
173
 
173
 
174
				DataLogger.logData(Event.PAYMENT_SUCCESS.name(), session.getId(), Long.toString(userinfo.getUserId()), userinfo.getEmail(), Long.toString(merchantPaymentId), gatewayPaymentId,
174
				DataLogger.logData(EventType.PAYMENT_SUCCESS.name(), session.getId(), Long.toString(userinfo.getUserId()), userinfo.getEmail(), Long.toString(merchantPaymentId), gatewayPaymentId,
175
                        gatewayTxnStatus, description, captureStatus);
175
                        gatewayTxnStatus, description, captureStatus);
176
				this.redirectUrl = successUrl + "?paymentId=" + merchantPaymentId;				
176
				this.redirectUrl = successUrl + "?paymentId=" + merchantPaymentId;				
177
			}
177
			}
178
		}else{
178
		}else{
179
			try {
179
			try {
Line 184... Line 184...
184
			} catch (TException e) {
184
			} catch (TException e) {
185
				e.printStackTrace();
185
				e.printStackTrace();
186
			}
186
			}
187
			
187
			
188
			CommonPaymentService.processFailedTxn(txnId, transactionServiceClient);
188
			CommonPaymentService.processFailedTxn(txnId, transactionServiceClient);
189
			DataLogger.logData(Event.PAYMENT_FAILURE.name(), session.getId(), Long.toString(userinfo.getUserId()), userinfo.getEmail(), Long.toString(merchantPaymentId), gatewayPaymentId,
189
			DataLogger.logData(EventType.PAYMENT_FAILURE.name(), session.getId(), Long.toString(userinfo.getUserId()), userinfo.getEmail(), Long.toString(merchantPaymentId), gatewayPaymentId,
190
                    gatewayTxnStatus, description);
190
                    gatewayTxnStatus, description);
191
 
191
 
192
			this.redirectUrl = errorUrl + "?paymentId=" + merchantPaymentId;
192
			this.redirectUrl = errorUrl + "?paymentId=" + merchantPaymentId;
193
		}
193
		}
194
		
194