Search in sources :

Example 1 with ConflictRuntimeException

use of uk.gov.pay.connector.common.exception.ConflictRuntimeException in project pay-connector by alphagov.

the class CardCaptureService method doCapture.

public CaptureResponse doCapture(String externalId) {
    ChargeEntity charge;
    try {
        charge = prepareChargeForCapture(externalId);
    } catch (OptimisticLockException e) {
        LOG.info("OptimisticLockException in doCapture for charge external_id={}", externalId);
        throw new ConflictRuntimeException(externalId);
    }
    CaptureResponse operationResponse = capture(charge);
    processGatewayCaptureResponse(externalId, charge.getStatus(), operationResponse);
    return operationResponse;
}
Also used : ChargeEntity(uk.gov.pay.connector.charge.model.domain.ChargeEntity) CaptureResponse(uk.gov.pay.connector.gateway.CaptureResponse) OptimisticLockException(javax.persistence.OptimisticLockException) ConflictRuntimeException(uk.gov.pay.connector.common.exception.ConflictRuntimeException)

Aggregations

OptimisticLockException (javax.persistence.OptimisticLockException)1 ChargeEntity (uk.gov.pay.connector.charge.model.domain.ChargeEntity)1 ConflictRuntimeException (uk.gov.pay.connector.common.exception.ConflictRuntimeException)1 CaptureResponse (uk.gov.pay.connector.gateway.CaptureResponse)1