class AuthorisationClosingService {

    @Transactional
    public void closePreviousAuthorisationsByParent(String parentId, AuthorisationType authorisationType, PsuIdData psuIdData) {
        if (psuIdData == null || psuIdData.isEmpty()) {
            log.info("Closing previous authorisations by PSU is skipped, because no PSU data has been provided in the request");
            return;
        }

        List<AuthorisationEntity> parentAuthorisations = authServiceResolver.getAuthService(authorisationType).getAuthorisationsByParentId(parentId);
        closePreviousAuthorisationsByPsu(authorisationType, parentAuthorisations, psuIdData);
    }

}