class AisConsentServiceInternalEncrypted implements AisConsentServiceEncrypted {

    @Override
    @Transactional(rollbackFor = WrongChecksumException.class)
    public CmsResponse<CmsResponse.VoidResponse> checkConsentAndSaveActionLog(AisConsentActionRequest encryptedRequest) throws WrongChecksumException {
        String consentId = encryptedRequest.getConsentId();
        Optional<String> decryptedConsentId = securityDataService.decryptId(consentId);
        if (decryptedConsentId.isEmpty()) {
            log.info("Encrypted Consent ID: [{}]. Check consent and save action log failed, couldn't decrypt consent id",
                     consentId);
            return CmsResponse.<CmsResponse.VoidResponse>builder()
                       .error(TECHNICAL_ERROR)
                       .build();
        }

        AisConsentActionRequest decryptedRequest = new AisConsentActionRequest(encryptedRequest.getTppId(),
                                                                               decryptedConsentId.get(),
                                                                               encryptedRequest.getActionStatus(),
                                                                               encryptedRequest.getRequestUri(),
                                                                               encryptedRequest.isUpdateUsage(),
                                                                               encryptedRequest.getResourceId(),
                                                                               encryptedRequest.getTransactionId());
        return aisConsentService.checkConsentAndSaveActionLog(decryptedRequest);
    }

}