public List fetchTellerTransactions()

in service/src/main/java/org/apache/fineract/cn/teller/service/internal/service/TellerOperationService.java [78:114]


  public List<TellerTransaction> fetchTellerTransactions(final String tellerCode, final String state) {
    final Optional<TellerEntity> optionalTellerEntity = this.tellerRepository.findByIdentifier(tellerCode);
    if (optionalTellerEntity.isPresent()) {
      final TellerEntity tellerEntity = optionalTellerEntity.get();
      if (state != null) {
        return this.tellerTransactionRepository.findByTellerAndStateOrderByTransactionDateAsc(tellerEntity, state)
            .stream()
            .map(tellerTransactionEntity -> {
              final TellerTransaction tellerTransaction = TellerTransactionMapper.map(tellerTransactionEntity);
              if (tellerTransaction.getTransactionType().equals(ServiceConstants.TX_CHEQUE)) {
                final Optional<ChequeEntity> optionalCheque =
                    this.chequeRepository.findByTellerTransactionId(tellerTransactionEntity.getId());

                optionalCheque.ifPresent(chequeEntity -> tellerTransaction.setCheque(ChequeMapper.map(chequeEntity)));
              }
              return tellerTransaction;
            })
            .collect(Collectors.toList());
      } else {
        return this.tellerTransactionRepository.findByTellerOrderByTransactionDateAsc(tellerEntity)
            .stream()
            .map(tellerTransactionEntity -> {
              final TellerTransaction tellerTransaction = TellerTransactionMapper.map(tellerTransactionEntity);
              if (tellerTransaction.getTransactionType().equals(ServiceConstants.TX_CHEQUE)) {
                final Optional<ChequeEntity> optionalCheque =
                    this.chequeRepository.findByTellerTransactionId(tellerTransactionEntity.getId());

                optionalCheque.ifPresent(chequeEntity -> tellerTransaction.setCheque(ChequeMapper.map(chequeEntity)));
              }
              return tellerTransaction;
            })
            .collect(Collectors.toList());
      }
    } else {
      throw ServiceException.notFound("Teller {0} not found.", tellerCode);
    }
  }