in service/src/main/java/org/apache/fineract/cn/customer/rest/controller/CustomerRestController.java [383:412]
ResponseEntity<Void> taskForCustomerExecuted(@PathVariable("identifier") final String identifier,
@PathVariable("taskIdentifier") final String taskIdentifier) {
final Optional<Customer> optionalCustomer = this.customerService.findCustomer(identifier);
if (optionalCustomer.isPresent()) {
final Customer customer = optionalCustomer.get();
final Optional<TaskDefinition> optionalTaskDefinition = this.taskService.findByIdentifier(taskIdentifier);
if (optionalTaskDefinition.isPresent()) {
final TaskDefinition taskDefinition = optionalTaskDefinition.get();
switch (TaskDefinition.Type.valueOf(taskDefinition.getType())) {
case ID_CARD:
final Stream<IdentificationCard> identificationCards = this.customerService.fetchIdentificationCardsByCustomer(identifier);
if (!identificationCards.findAny().isPresent()) {
throw ServiceException.conflict("No identification cards for customer found.");
}
break;
case FOUR_EYES:
if (customer.getCreatedBy().equals(UserContextHolder.checkedGetUser())) {
throw ServiceException.conflict("Signing user must be different than creator.");
}
break;
}
this.commandGateway.process(new ExecuteTaskForCustomerCommand(identifier, taskIdentifier));
} else {
throw ServiceException.notFound("Task definition {0} not found.", taskIdentifier);
}
} else {
throw ServiceException.notFound("Customer {0} not found.", identifier);
}
return ResponseEntity.accepted().build();
}