class AuthorisationServiceInternal implements AuthorisationService {

    @Transactional
    @Override
    public CmsResponse<ScaStatus> getAuthorisationScaStatus(String authorisationId, AuthorisationParentHolder parentHolder) {
        AuthService authService = authServiceResolver.getAuthService(parentHolder.getAuthorisationType());
        Optional<Authorisable> parentOptional = authService.getAuthorisationParent(parentHolder.getParentId());
        if (parentOptional.isEmpty()) {
            log.info("Parent ID: [{}], Authorisation ID: [{}]. Get authorisation SCA status has failed, because parent couldn't be found",
                     parentHolder.getParentId(), authorisationId);
            return CmsResponse.<ScaStatus>builder()
                       .error(LOGICAL_ERROR)
                       .build();
        }

        Authorisable parent = parentOptional.get();
        if (authService.isConfirmationExpired(parent)) {
            authService.updateOnConfirmationExpiration(parent);
            log.info("Parent ID: [{}], Authorisation ID: [{}]. Get authorisation SCA status has failed, because parent is expired",
                     parentHolder.getParentId(), authorisationId);
            return CmsResponse.<ScaStatus>builder()
                       .payload(ScaStatus.FAILED)
                       .build();
        }

        Optional<AuthorisationEntity> authorisation = findAuthorisationInParent(authorisationId, parentHolder.getAuthorisationType(), parent);
        if (authorisation.isPresent()) {
            return CmsResponse.<ScaStatus>builder()
                       .payload(authorisation.get().getScaStatus())
                       .build();
        }
        return CmsResponse.<ScaStatus>builder()
                   .error(LOGICAL_ERROR)
                   .build();
    }

}