in service/src/main/java/org/apache/fineract/cn/accounting/service/rest/AccountRestController.java [86:102]
ResponseEntity<Void> createAccount(@RequestBody @Valid final Account account) {
if (this.accountService.findAccount(account.getIdentifier()).isPresent()) {
throw ServiceException.conflict("Account {0} already exists.", account.getIdentifier());
}
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 CreateAccountCommand(account));
return ResponseEntity.accepted().build();
}