class PisCancellationAuthService extends CmsAuthorisationService<PisCommonPaymentData> {

    @Override
    public Optional<Authorisable> getNotFinalisedAuthorisationParent(String parentId) {
        // todo implementation should be changed https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/1143
        Optional<PisCommonPaymentData> commonPaymentData = pisPaymentDataRepository.findByPaymentId(parentId)
                                                               .filter(CollectionUtils::isNotEmpty)
                                                               .map(list -> list.get(0).getPaymentData());
        if (commonPaymentData.isEmpty()) {
            commonPaymentData = pisCommonPaymentDataRepository.findByPaymentId(parentId);
        }

        return commonPaymentData
                   .filter(p -> p.getTransactionStatus().isNotFinalisedStatus())
                   .map(this::convertToCommonPayment);
    }

    @Autowired public  PisCancellationAuthService(CmsPsuService cmsPsuService, PsuDataMapper psuDataMapper, AspspProfileService aspspProfileService,
                                      AuthorisationRepository authorisationRepository,
                                      PisCommonPaymentConfirmationExpirationService pisCommonPaymentConfirmationExpirationService,
                                      PisPaymentDataRepository pisPaymentDataRepository,
                                      AuthorisationMapper authorisationMapper, PisCommonPaymentDataRepository pisCommonPaymentDataRepository,
                                      PisCommonPaymentMapper pisCommonPaymentMapper, CorePaymentsConvertService corePaymentsConvertService);

}