public TellerTransactionCosts getTellerTransactionCosts()

in service/src/main/java/org/apache/fineract/cn/teller/service/internal/processor/DepositTransactionHandler.java [66:83]


  public TellerTransactionCosts getTellerTransactionCosts(final TellerTransaction tellerTransaction) {
    final List<Charge> charges = this.depositAccountManagementService.getCharges(tellerTransaction);

    final List<Charge> cleanedCharges = charges
        .stream()
        .filter(charge -> charge.getAmount() != null && charge.getAmount().compareTo(BigDecimal.ZERO) > 0)
        .collect(Collectors.toList());

    final TellerTransactionCosts tellerTransactionCosts = new TellerTransactionCosts();
    tellerTransactionCosts.setCharges(cleanedCharges);
    tellerTransactionCosts.setTellerTransactionIdentifier(tellerTransaction.getIdentifier());
    tellerTransactionCosts.setTotalAmount(
        tellerTransaction.getAmount().add(
            BigDecimal.valueOf(cleanedCharges.stream().mapToDouble(value -> value.getAmount().doubleValue()).sum()))
    );

    return tellerTransactionCosts;
  }