class ProjectFinanceHandlerImpl implements ProjectFinanceHandler {

    @Override
    @Transactional
    public List<ProjectFinanceResource> getFinanceChecksTotals(long projectId) {
        return find(projectRepository.findById(projectId), notFoundError(Project.class, projectId)).andOnSuccessReturn(project -> {
            List<ProjectFinanceResource> financeResources = new ArrayList<>();
            project.getPartnerOrganisations().stream()
                    .map(PartnerOrganisation::getOrganisation)
                    .map(organisation -> getProjectFinanceForOrganisation(projectId, organisation.getId()).getSuccess())
                    .forEach(finance -> {
                        ProjectFinanceResource financeResource = projectFinanceMapper.mapToResource(finance);
                        OrganisationTypeFinanceHandler organisationFinanceHandler =
                                organisationFinanceDelegate.getOrganisationFinanceHandler(finance.getProject().getApplication().getCompetition().getId(), finance.getOrganisation().getOrganisationType().getId());
                        EnumMap<FinanceRowType, FinanceRowCostCategory> costs =
                                new EnumMap<>(organisationFinanceHandler.getProjectOrganisationFinances(financeResource.getId()));
                        financeResource.setFinanceOrganisationDetails(costs);
                        financeResources.add(financeResource);
                    });
            return financeResources;
        }).getSuccess();
    }

}