| Line 150... |
Line 150... |
| 150 |
updatePaymentDetails(merchantPaymentId, description, PaymentStatus.AUTHORIZED, request, paymentClient);
|
150 |
updatePaymentDetails(merchantPaymentId, description, PaymentStatus.AUTHORIZED, request, paymentClient);
|
| 151 |
|
151 |
|
| 152 |
CommonPaymentService.processSuccessfulTxn(txnId, userServiceClient, transactionServiceClient);
|
152 |
CommonPaymentService.processSuccessfulTxn(txnId, userServiceClient, transactionServiceClient);
|
| 153 |
|
153 |
|
| 154 |
this.redirectUrl = successUrl + "?paymentId=" + merchantPaymentId;
|
154 |
this.redirectUrl = successUrl + "?paymentId=" + merchantPaymentId;
|
| 155 |
|
- |
|
| 156 |
// log.info("Capturing payment with id: " + merchantPaymentId);
|
- |
|
| 157 |
// Map<String, String> captureResult = HdfcPaymentService.capturePayment(payment);
|
- |
|
| 158 |
// String captureStatus = captureResult.get(IPaymentService.STATUS);
|
- |
|
| 159 |
// String gatewayStatus = captureResult.get(IPaymentService.GATEWAY_STATUS);
|
- |
|
| 160 |
//
|
- |
|
| 161 |
// List<Attribute> attributes = new ArrayList<Attribute>();
|
- |
|
| 162 |
// if(!captureStatus.trim().equals("0") || !PaymentReturnStatus.CAPTURED.value().equals(gatewayStatus)){
|
- |
|
| 163 |
// //Failure
|
- |
|
| 164 |
// log.info("Capture attempt failed for payment with id: " + merchantPaymentId);
|
- |
|
| 165 |
// description = captureResult.get(IPaymentService.ERROR);
|
- |
|
| 166 |
// String errorCode = captureResult.get(IPaymentService.ERR_CODE);
|
- |
|
| 167 |
//
|
- |
|
| 168 |
// try {
|
- |
|
| 169 |
// paymentServiceClient.getClient().updatePaymentDetails(merchantPaymentId, paymentId,
|
- |
|
| 170 |
// null, null, description, null, null, null, errorCode, PaymentStatus.FAILED, null, attributes);
|
- |
|
| 171 |
// } catch (PaymentException e) {
|
- |
|
| 172 |
// log.error("Error while updating failed capture payment attempt: ", e);
|
- |
|
| 173 |
// } catch (TException e) {
|
- |
|
| 174 |
// log.error("Error while updating failed capture payment attempt: ", e);
|
- |
|
| 175 |
// }
|
- |
|
| 176 |
// //DataLogger.logData(EventType.PAYMENT_FAILURE.name(), session.getId(), Long.toString(userinfo.getUserId()), userinfo.getEmail(), Long.toString(merchantPaymentId), paymentId, gatewayTxnStatus, description, errorCode);
|
- |
|
| 177 |
// this.redirectUrl = errorUrl + "?paymentId=" + merchantPaymentId;
|
- |
|
| 178 |
// }else{
|
- |
|
| 179 |
// //Success
|
- |
|
| 180 |
// log.info("Capture attempt successful for payment with id: " + merchantPaymentId);
|
- |
|
| 181 |
// description = "Payment Captured";
|
- |
|
| 182 |
// attributes.add(new Attribute(IPaymentService.CAPTURE_TXN_ID, captureResult.get(IPaymentService.CAPTURE_TXN_ID)));
|
- |
|
| 183 |
// attributes.add(new Attribute(IPaymentService.CAPTURE_REF_ID, captureResult.get(IPaymentService.CAPTURE_REF_ID)));
|
- |
|
| 184 |
// attributes.add(new Attribute(IPaymentService.CAPTURE_AUTH_ID, captureResult.get(IPaymentService.CAPTURE_AUTH_ID)));
|
- |
|
| 185 |
//
|
- |
|
| 186 |
// SimpleDateFormat captureTimeDateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
- |
|
| 187 |
// attributes.add(new Attribute(IPaymentService.CAPTURE_TIME, captureTimeDateFormatter.format(new Date())));
|
- |
|
| 188 |
//
|
- |
|
| 189 |
// try {
|
- |
|
| 190 |
// paymentServiceClient.getClient().updatePaymentDetails(merchantPaymentId, paymentId,
|
- |
|
| 191 |
// null, gatewayStatus, null, null, null, null, null, PaymentStatus.SUCCESS, null, attributes);
|
- |
|
| 192 |
// } catch (PaymentException e) {
|
- |
|
| 193 |
// log.error("Error while updating successful capture payment attempt: ", e);
|
- |
|
| 194 |
// } catch (TException e) {
|
- |
|
| 195 |
// log.error("Error while updating successful capture payment attempt: ", e);
|
- |
|
| 196 |
// }
|
- |
|
| 197 |
//
|
- |
|
| 198 |
// CommonPaymentService.processSuccessfulTxn(txnId, userServiceClient, transactionServiceClient);
|
- |
|
| 199 |
//
|
- |
|
| 200 |
// this.redirectUrl = successUrl + "?paymentId=" + merchantPaymentId;
|
- |
|
| 201 |
// }
|
- |
|
| 202 |
} else {
|
155 |
} else {
|
| 203 |
updatePaymentDetails(merchantPaymentId, errorText, PaymentStatus.FAILED, request, paymentClient);
|
156 |
updatePaymentDetails(merchantPaymentId, errorText, PaymentStatus.FAILED, request, paymentClient);
|
| 204 |
|
157 |
|
| 205 |
CommonPaymentService.processFailedTxn(txnId, transactionServiceClient);
|
158 |
CommonPaymentService.processFailedTxn(txnId, transactionServiceClient);
|
| 206 |
|
159 |
|