Skip to content
Permalink
Browse files
Merge pull request #1 from markusgeiss/develop
filter for empty or 0 charges
  • Loading branch information
markusgeiss committed Aug 9, 2017
2 parents cae3aff + 8f2dca7 commit 56a747036c01d838cde735453dbce6d966e422d6
Showing 1 changed file with 7 additions and 2 deletions.
@@ -63,11 +63,16 @@ public DepositTransactionHandler(@Qualifier(ServiceConstants.LOGGER_NAME) final
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() > 0.00D)
.collect(Collectors.toList());

final TellerTransactionCosts tellerTransactionCosts = new TellerTransactionCosts();
tellerTransactionCosts.setCharges(charges);
tellerTransactionCosts.setCharges(cleanedCharges);
tellerTransactionCosts.setTellerTransactionIdentifier(tellerTransaction.getIdentifier());
tellerTransactionCosts.setTotalAmount(
tellerTransaction.getAmount() + charges.stream().mapToDouble(Charge::getAmount).sum()
tellerTransaction.getAmount() + cleanedCharges.stream().mapToDouble(Charge::getAmount).sum()
);

return tellerTransactionCosts;

0 comments on commit 56a7470

Please sign in to comment.