Skip to content
Permalink
Browse files
Merge pull request #23 from markusgeiss/develop
fix for ATEN-466
  • Loading branch information
markusgeiss committed Oct 10, 2017
2 parents 9701c64 + 64fbc72 commit 4d97fb3ec9adeca635da7fe7655d03b080c1a5f9
Showing 1 changed file with 8 additions and 6 deletions.
@@ -367,12 +367,14 @@ private void verifyChequeTransaction(final TellerTransaction tellerTransaction)
throw ServiceException.conflict("Cheque {0} already used.", chequeIdentifier);
}

this.accountingService.findAccount(micr.getAccountNumber()).ifPresent(account -> {
final BigDecimal balance = BigDecimal.valueOf(account.getBalance());
if (tellerTransaction.getAmount().compareTo(balance) > 0) {
throw ServiceException.conflict("Cheque not covered.");
}
});
if (this.organizationService.officeExists(micr.getBranchSortCode())) {
this.accountingService.findAccount(micr.getAccountNumber()).ifPresent(account -> {
final BigDecimal balance = BigDecimal.valueOf(account.getBalance());
if (tellerTransaction.getAmount().compareTo(balance) > 0) {
throw ServiceException.conflict("Cheque not covered.");
}
});
}
}
}
}

0 comments on commit 4d97fb3

Please sign in to comment.