class UpdatePaymentAfterSpiServiceInternal implements UpdatePaymentAfterSpiService {

    @Override
    @Transactional
    public CmsResponse<Boolean> updatePaymentCancellationInternalRequestId(@NotNull String paymentId, @NotNull String internalRequestId) {
        Optional<PisCommonPaymentData> paymentDataOptional = commonPaymentDataService.getPisCommonPaymentData(paymentId, null);
        if (paymentDataOptional.isEmpty() || paymentDataOptional.get().isFinalised()) {
            log.info("Payment ID [{}]. Update payment intrenal request id failed, because pis payment data not found or payment is finalized",
                     paymentId);
            return CmsResponse.<Boolean>builder()
                       .payload(false)
                       .build();
        }

        boolean updated = commonPaymentDataService.updatePaymentCancellationInternalRequestId(paymentDataOptional.get(), internalRequestId);
        return CmsResponse.<Boolean>builder()
                   .payload(updated)
                   .build();
    }

}