Source:
public CaptureResponse capture(CaptureGatewayRequest request) { String transactionId = request.getTransactionId(); try { StripeCharge capturedCharge; if (usePaymentIntent(transactionId)) { capturedCharge = captureWithPaymentIntentAPI(request); } else { capturedCharge = captureWithChargeAPI(request); } Optional<Long> processingFee = capturedCharge.getFee() .flatMap(fee -> calculateProcessingFee(request.getAmount(), fee)); Long netTransferAmount = processingFee .map(fee -> request.getAmount() - fee) .orElse(request.getAmount()); transferToConnectAccount(request, netTransferAmount, capturedCharge.getId()); return new CaptureResponse(transactionId, COMPLETE, processingFee.orElse(null)); } catch (GatewayErrorException e) { if (e.getFamily() == CLIENT_ERROR) { var stripeErrorResponse = jsonObjectMapper.getObject(e.getResponseFromGateway(), StripeErrorResponse.class); String errorCode = stripeErrorResponse.getError().getCode(); String errorMessage = stripeErrorResponse.getError().getMessage(); LOGGER.info("Capture failed for transaction id {}. Failure code from Stripe: {}, failure message from " + "Stripe: {}. External Charge id: {}. Response code from Stripe: {}", transactionId, errorCode, errorMessage, request.getExternalId(), e.getStatus()); return fromBaseCaptureResponse(new StripeCaptureResponse(transactionId, errorCode, errorMessage), null); } if (e.getFamily() == SERVER_ERROR) { LOGGER.info("Capture failed for transaction id {}. Reason: {}. Status code from Stripe: {}. Charge External Id: {}", transactionId, e.getMessage(), e.getStatus(), request.getExternalId()); GatewayError gatewayError = gatewayConnectionError("An internal server error occurred when capturing charge_external_id: " + request.getExternalId()); return CaptureResponse.fromGatewayError(gatewayError); } LOGGER.info("Unrecognised response status during capture. charge_external_id={}, status={}, response={}", request.getExternalId(), e.getStatus(), e.getResponseFromGateway()); throw new RuntimeException("Unrecognised response status during capture."); } catch (GatewayException e) { return CaptureResponse.fromGatewayError(e.toGatewayError()); } }

Target:
public CaptureResponse capture(CaptureGatewayRequest request) { String transactionId = request.getTransactionId(); try { StripeCharge capturedCharge; if (usePaymentIntent(transactionId)) { capturedCharge = captureWithPaymentIntentAPI(request); } else { capturedCharge = captureWithChargeAPI(request); } Optional<Long> processingFee = capturedCharge.getFee() .flatMap(fee -> calculateProcessingFee(request.getAmount(), fee)); Long netTransferAmount = processingFee .map(fee -> request.getAmount() - fee) .orElse(request.getAmount()); transferToConnectAccount(request, netTransferAmount, capturedCharge.getId()); return new CaptureResponse(transactionId, COMPLETE, processingFee.orElse(null)); } catch (GatewayErrorException e) { if (e.getFamily() == CLIENT_ERROR) { var stripeErrorResponse = jsonObjectMapper.getObject(e.getResponseFromGateway(), StripeErrorResponse.class); String errorCode = stripeErrorResponse.getError().getCode(); String errorMessage = stripeErrorResponse.getError().getMessage(); LOGGER.warn("Capture failed for transaction id {}. Failure code from Stripe: {}, failure message from " + "Stripe: {}. External Charge id: {}. Response code from Stripe: {}", transactionId, errorCode, errorMessage, request.getExternalId(), e.getStatus()); return fromBaseCaptureResponse(new StripeCaptureResponse(transactionId, errorCode, errorMessage), null); } if (e.getFamily() == SERVER_ERROR) { LOGGER.warn("Capture failed for transaction id {}. Reason: {}. Status code from Stripe: {}. Charge External Id: {}", transactionId, e.getMessage(), e.getStatus(), request.getExternalId()); GatewayError gatewayError = gatewayConnectionError("An internal server error occurred when capturing charge_external_id: " + request.getExternalId()); return CaptureResponse.fromGatewayError(gatewayError); } LOGGER.error("Unrecognised response status during capture. charge_external_id={}, status={}, response={}", request.getExternalId(), e.getStatus(), e.getResponseFromGateway()); throw new RuntimeException("Unrecognised response status during capture."); } catch (GatewayException e) { return CaptureResponse.fromGatewayError(e.toGatewayError()); } }