in service/src/main/java/org/apache/fineract/cn/accounting/service/rest/AccountRestController.java [153:174]
ResponseEntity<Void> modifyAccount(@PathVariable("identifier") final String identifier,
@RequestBody @Valid final Account account) {
if (!identifier.equals(account.getIdentifier())) {
throw ServiceException.badRequest("Addressed resource {0} does not match account {1}",
identifier, account.getIdentifier());
}
if (!this.accountService.findAccount(identifier).isPresent()) {
throw ServiceException.notFound("Account {0} not found.", identifier);
}
if (account.getReferenceAccount() != null
&& !this.accountService.findAccount(account.getReferenceAccount()).isPresent()) {
throw ServiceException.badRequest("Reference account {0} not available.",
account.getReferenceAccount());
}
validateLedger(account);
this.commandGateway.process(new ModifyAccountCommand(account));
return ResponseEntity.accepted().build();
}