in service/src/main/java/org/apache/fineract/cn/teller/service/rest/TellerOperationRestController.java [326:347]
private void verifyDepositTransaction(final TellerTransaction tellerTransaction,
final ConfirmTellerTransactionCommand confirmTellerTransactionCommand) {
final String transactionType = tellerTransaction.getTransactionType();
if (transactionType.equals(ServiceConstants.TX_CASH_DEPOSIT)
|| transactionType.equals(ServiceConstants.TX_OPEN_ACCOUNT)) {
final Account account = this.accountingService.findAccount(tellerTransaction.getCustomerAccountIdentifier())
.orElseThrow(() -> ServiceException.notFound("Customer account {0} not found.",
tellerTransaction.getCustomerAccountIdentifier()));
final BigDecimal newBalance = BigDecimal.valueOf(account.getBalance()).add(tellerTransaction.getAmount());
final TellerTransactionCosts tellerTransactionCosts =
this.tellerTransactionProcessor.getCosts(tellerTransaction);
if (!confirmTellerTransactionCommand.chargesIncluded() &&
tellerTransactionCosts.getTotalAmount().compareTo(newBalance) > 0) {
throw ServiceException.conflict("Account has not enough balance.");
}
}
}