Subversion Repositories SmartDukaan

Rev

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

Rev 2947 Rev 3010
Line 128... Line 128...
128
				log.error("Unable to mark the payment as authorized", e);
128
				log.error("Unable to mark the payment as authorized", e);
129
			} catch (TException e) {
129
			} catch (TException e) {
130
			    log.error("Unable to mark the payment as authorized", e);
130
			    log.error("Unable to mark the payment as authorized", e);
131
			}
131
			}
132
 
132
 
-
 
133
			CommonPaymentService.processSuccessfulTxn(txnId, userServiceClient, transactionServiceClient);
-
 
134
            this.redirectUrl = successUrl + "?paymentId=" + merchantPaymentId;
-
 
135
			
133
			Map<String, String> captureResult = EbsPaymentService.capturePayment(payment, gatewayPaymentId);
136
//			Map<String, String> captureResult = EbsPaymentService.capturePayment(payment, gatewayPaymentId);
134
			String captureStatus = captureResult.get(IPaymentService.STATUS);
137
//			String captureStatus = captureResult.get(IPaymentService.STATUS);
135
 
138
//
136
			if("".equals(captureStatus)){
139
//			if("".equals(captureStatus)){
137
				//Failure
140
//				//Failure
138
				description = captureResult.get(EbsPaymentService.ERROR);
141
//				description = captureResult.get(EbsPaymentService.ERROR);
139
				String errorCode = captureResult.get(EbsPaymentService.ERR_CODE);
142
//				String errorCode = captureResult.get(EbsPaymentService.ERR_CODE);
140
				try {
143
//				try {
141
					paymentServiceClient.getClient().updatePaymentDetails(merchantPaymentId, gatewayPaymentId,
144
//					paymentServiceClient.getClient().updatePaymentDetails(merchantPaymentId, gatewayPaymentId,
142
							"", gatewayTxnStatus, description, "", "", "", errorCode, PaymentStatus.FAILED, "", attributes);
145
//							"", gatewayTxnStatus, description, "", "", "", errorCode, PaymentStatus.FAILED, "", attributes);
143
				} catch (PaymentException e) {
146
//				} catch (PaymentException e) {
144
					log.error("Error while updating failed capture payment attempt: ", e);
147
//					log.error("Error while updating failed capture payment attempt: ", e);
145
				} catch (TException e) {
148
//				} catch (TException e) {
146
					log.error("Error while updating failed capture payment attempt: ", e);
149
//					log.error("Error while updating failed capture payment attempt: ", e);
147
				}
150
//				}
148
				DataLogger.logData(EventType.PAYMENT_FAILURE, session.getId(), userinfo.getUserId(), userinfo.getEmail(), Long.toString(merchantPaymentId), gatewayPaymentId,
151
//				DataLogger.logData(EventType.PAYMENT_FAILURE, session.getId(), userinfo.getUserId(), userinfo.getEmail(), Long.toString(merchantPaymentId), gatewayPaymentId,
149
                        gatewayTxnStatus, description, errorCode);
152
//                        gatewayTxnStatus, description, errorCode);
150
				this.redirectUrl = errorUrl + "?paymentId=" + merchantPaymentId;
153
//				this.redirectUrl = errorUrl + "?paymentId=" + merchantPaymentId;
151
			}else{
154
//			}else{
152
				//Success
155
//				//Success
153
				try {
156
//				try {
154
					attributes.add(new Attribute(IPaymentService.CAPTURE_TXN_ID, captureResult.get(IPaymentService.CAPTURE_TXN_ID)));
157
//					attributes.add(new Attribute(IPaymentService.CAPTURE_TXN_ID, captureResult.get(IPaymentService.CAPTURE_TXN_ID)));
155
					attributes.add(new Attribute(IPaymentService.CAPTURE_TIME, captureResult.get(IPaymentService.CAPTURE_TIME)));
158
//					attributes.add(new Attribute(IPaymentService.CAPTURE_TIME, captureResult.get(IPaymentService.CAPTURE_TIME)));
156
 
159
//
157
					paymentServiceClient.getClient().updatePaymentDetails(merchantPaymentId, gatewayPaymentId,
160
//					paymentServiceClient.getClient().updatePaymentDetails(merchantPaymentId, gatewayPaymentId,
158
							"", captureStatus, description, "", "", "", "", PaymentStatus.SUCCESS, "", attributes);
161
//							"", captureStatus, description, "", "", "", "", PaymentStatus.SUCCESS, "", attributes);
159
				} catch (PaymentException e) {
162
//				} catch (PaymentException e) {
160
					log.error("Error while updating successful capture payment attempt: ", e);
163
//					log.error("Error while updating successful capture payment attempt: ", e);
161
				} catch (TException e) {
164
//				} catch (TException e) {
162
					log.error("Error while updating successful capture payment attempt: ", e);
165
//					log.error("Error while updating successful capture payment attempt: ", e);
163
				}
166
//				}
164
 
167
//
165
				CommonPaymentService.processSuccessfulTxn(txnId, userServiceClient, transactionServiceClient);
168
//				CommonPaymentService.processSuccessfulTxn(txnId, userServiceClient, transactionServiceClient);
166
 
169
//
167
				this.redirectUrl = successUrl + "?paymentId=" + merchantPaymentId;
170
//				this.redirectUrl = successUrl + "?paymentId=" + merchantPaymentId;
168
			}
171
//			}
169
		}else{
172
		}else{
170
			try {
173
			try {
171
				paymentServiceClient.getClient().updatePaymentDetails(merchantPaymentId, gatewayPaymentId,
174
				paymentServiceClient.getClient().updatePaymentDetails(merchantPaymentId, gatewayPaymentId,
172
						"", gatewayTxnStatus, description, "", "", "", "", PaymentStatus.FAILED, "", attributes);
175
						"", gatewayTxnStatus, description, "", "", "", "", PaymentStatus.FAILED, "", attributes);
173
			} catch (PaymentException e) {
176
			} catch (PaymentException e) {