class CardAccountAspectService extends BaseAspectService<CardAccountController> {

    public ResponseObject<Xs2aCardTransactionsReport> getTransactionsReportByPeriod(ResponseObject<Xs2aCardTransactionsReport> result,
                                                                                    Xs2aTransactionsReportByPeriodRequest request) {
        if (!result.hasError()) {
            Xs2aCardTransactionsReport transactionsReport = result.getBody();
            boolean isWithBalance = Optional.ofNullable(transactionsReport.getBalances())
                                        .map(balances -> !balances.isEmpty())
                                        .orElse(false);
            transactionsReport.setLinks(new TransactionsReportCardDownloadLinks(getHttpUrl(), request.getAccountId(), isWithBalance, transactionsReport.getDownloadId()));
            Xs2aCardAccountReport cardAccountReport = transactionsReport.getCardAccountReport();
            if (cardAccountReport != null) {
                cardAccountReport.setLinks(new TransactionsReportCardLinks(getHttpUrl(), request.getAccountId(), isWithBalance));
            }
        }
        return result;
    }

    @Autowired public  CardAccountAspectService(AspspProfileServiceWrapper aspspProfileServiceWrapper);

}