Skip to content
Permalink
Browse files
filter for empty or 0 charges
  • Loading branch information
mgeiss committed Aug 9, 2017
1 parent cae3aff commit 8f2dca7fa77e792bbbb732521199e1041a7b3c27
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 8f2dca7

Please sign in to comment.