Skip to content
Permalink
Browse files
fix for ATEN-466
  • Loading branch information
mgeiss committed Oct 10, 2017
1 parent 9701c64 commit 64fbc72d98eaa172fa9e61a7c4673be41f9403d4
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 64fbc72

Please sign in to comment.