class PisAuthorisationConfirmationService {

    public Xs2aUpdatePisCommonPaymentPsuDataResponse processAuthorisationConfirmation(Xs2aUpdatePisCommonPaymentPsuDataRequest request) {
        String paymentId = request.getPaymentId();
        String authorisationId = request.getAuthorisationId();

        CmsResponse<Authorisation> pisAuthorisationResponse = authorisationServiceEncrypted.getAuthorisationById(authorisationId);

        if (pisAuthorisationResponse.hasError()) {
            ErrorHolder errorHolder = ErrorHolder.builder(ErrorType.PIS_404)
                                          .tppMessages(TppMessageInformation.of(MessageErrorCode.RESOURCE_UNKNOWN_404_NO_AUTHORISATION))
                                          .build();
            log.info("Payment-ID [{}], Authorisation-ID [{}]. Updating PIS authorisation PSU Data has failed: authorisation is not found by id.",
                     paymentId, authorisationId);
            return new Xs2aUpdatePisCommonPaymentPsuDataResponse(errorHolder, paymentId, authorisationId, request.getPsuData());

        }

        Authorisation authorisationResponse = pisAuthorisationResponse.getPayload();

        ScaStatus status = authorisationResponse.getScaStatus();

        boolean processIsAllowed = status == ScaStatus.UNCONFIRMED;

        return processIsAllowed
                   ? processAuthorisationConfirmationInternal(request, authorisationResponse)
                   : buildScaConfirmationCodeErrorResponse(paymentId, authorisationId, request.getPsuData());
    }

}