Source:
public GatewayResponse<BaseAuthoriseResponse> postOperation(String chargeId, Auth3dsDetails auth3DsDetails, GatewayResponse<BaseAuthoriseResponse> operationResponse) { return chargeDao.findByExternalId(chargeId).map(chargeEntity -> { ChargeStatus status = operationResponse.getBaseResponse() .map(BaseAuthoriseResponse::authoriseStatus) .map(BaseAuthoriseResponse.AuthoriseStatus::getMappedChargeStatus) .orElse(ChargeStatus.AUTHORISATION_ERROR); String transactionId = operationResponse.getBaseResponse() .map(BaseAuthoriseResponse::getTransactionId).orElse(""); logger.info("3DS response authorisation for ({} {}) for ({}) - .'. -> {}", chargeEntity.getExternalId(), chargeEntity.getPaymentGatewayName().getName(), chargeEntity.getGatewayTransactionId(), chargeEntity.getGatewayAccount().getAnalyticsId(), chargeEntity.getGatewayAccount().getId(), operationResponse, chargeEntity.getStatus(), status); GatewayAccountEntity account = chargeEntity.getGatewayAccount(); metricRegistry.counter(String.format("gateway-operations.%s.%s.%s.authorise-3ds.result.%s", account.getGatewayName(), account.getType(), account.getId(), status.toString())).inc(); chargeEntity.setStatus(status); Optional<PaymentRequestEntity> paymentRequestEntity = paymentRequestDao.updateChargeTransactionStatus(chargeEntity.getExternalId(), status); if (StringUtils.isBlank(transactionId)) { logger.warn("Auth3DSDetails authorisation response received with no transaction id. - charge_external_id={}", chargeId); } else { chargeEntity.setGatewayTransactionId(transactionId); paymentRequestEntity.ifPresent(paymentRequest -> { if (paymentRequest.hasChargeTransaction()) { paymentRequest.getChargeTransaction().setGatewayTransactionId(transactionId); } }); } chargeEventDao.persistChargeEventOf(chargeEntity, Optional.empty()); return operationResponse; }).orElseThrow(() -> new ChargeNotFoundRuntimeException(chargeId)); }

Target:
public GatewayResponse<BaseAuthoriseResponse> postOperation(String chargeId, Auth3dsDetails auth3DsDetails, GatewayResponse<BaseAuthoriseResponse> operationResponse) { return chargeDao.findByExternalId(chargeId).map(chargeEntity -> { ChargeStatus status = operationResponse.getBaseResponse() .map(BaseAuthoriseResponse::authoriseStatus) .map(BaseAuthoriseResponse.AuthoriseStatus::getMappedChargeStatus) .orElse(ChargeStatus.AUTHORISATION_ERROR); String transactionId = operationResponse.getBaseResponse() .map(BaseAuthoriseResponse::getTransactionId).orElse(""); logger.info("3DS response authorisation for ({} {}) for ({}) - .'. -> {}", chargeEntity.getExternalId(), chargeEntity.getPaymentGatewayName().getName(), chargeEntity.getGatewayTransactionId(), chargeEntity.getGatewayAccount().getAnalyticsId(), chargeEntity.getGatewayAccount().getId(), operationResponse, chargeEntity.getStatus(), status); GatewayAccountEntity account = chargeEntity.getGatewayAccount(); metricRegistry.counter(String.format("gateway-operations.%s.%s.%s.authorise-3ds.result.%s", account.getGatewayName(), account.getType(), account.getId(), status.toString())).inc(); chargeEntity.setStatus(status); statusUpdater.updateChargeTransactionStatus(chargeEntity.getExternalId(), status); Optional<PaymentRequestEntity> paymentRequestEntity = paymentRequestDao.findByExternalId(chargeEntity.getExternalId()); if (StringUtils.isBlank(transactionId)) { logger.warn("Auth3DSDetails authorisation response received with no transaction id. - charge_external_id={}", chargeId); } else { setGatewayTransactionId(chargeEntity, transactionId, paymentRequestEntity); } chargeEventDao.persistChargeEventOf(chargeEntity, Optional.empty()); return operationResponse; }).orElseThrow(() -> new ChargeNotFoundRuntimeException(chargeId)); }