protected List<ReceiptService> getServiceInfoOfReceipt(String consentReceiptId, ReceiptContext receiptContext) throws ConsentManagementServerException { List<ReceiptService> receiptServices; JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate(); try { receiptServices = jdbcTemplate.withTransaction(template -> { List<ReceiptService> internalReceiptServices = template.executeQuery(GET_RECEIPT_SP_SQL, (resultSet, rowNumber) -> { ReceiptService receiptService = new ReceiptService(); receiptService.setReceiptToServiceId(resultSet.getInt(1)); receiptService.setService(resultSet.getString(2)); receiptService.setTenantId(resultSet.getInt(3)); receiptService.setSpDisplayName(resultSet.getString(4)); receiptService.setSpDescription(resultSet.getString(5)); return receiptService; }, preparedStatement -> preparedStatement.setString(1, consentReceiptId)); if (internalReceiptServices != null) { internalReceiptServices.forEach(rethrowConsumer(receiptService -> receiptService.setPurposes (getPurposeInfoOfService(receiptService.getReceiptToServiceId(), consentReceiptId, receiptContext)))); } return internalReceiptServices; }); } catch (TransactionException e) { throw ConsentUtils.handleServerException(ErrorMessages.ERROR_CODE_RETRIEVE_RECEIPT_INFO, consentReceiptId, e); } return receiptServices; }