class ApplicationFinanceTotalsSenderImpl implements ApplicationFinanceTotalsSender {

    @Override
    @Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW)
    public ServiceResult<Void> sendFinanceTotalsForApplication(Long applicationId) {
        LOG.debug("Initiating sendFinanceTotalsForApplication for applicationId: {}", applicationId);

        List<ApplicationFinanceResource> applicationFinanceResources =
                applicationFinanceHandler.getApplicationFinances(applicationId);

        List<FinanceCostTotalResource> financeCostTotalResourceList = financeCostTotalResourceMapper
                .mapFromApplicationFinanceResourceListToList(applicationFinanceResources);

        if (financeCostTotalResourceList.isEmpty()) {
            LOG.debug("Ignoring empty financeCostTotalResources for applicationId: {}", applicationId);
            return serviceSuccess();
        }

        return costTotalEndpoint.sendCostTotals(applicationId,
                spendProfileCostFilter.filterBySpendProfile(financeCostTotalResourceList));
    }

    @Autowired public  ApplicationFinanceTotalsSenderImpl(
            ApplicationFinanceHandler applicationFinanceHandler,
            FinanceCostTotalResourceMapper financeCostTotalResourceMapper,
            SpendProfileCostFilter spendProfileCostFilter,
            AsyncRestCostTotalEndpoint costTotalEndpoint
    );

}