public String activateCustomer()

in service/src/main/java/org/apache/fineract/cn/customer/internal/command/handler/CustomerAggregate.java [215:236]


  public String activateCustomer(final ActivateCustomerCommand activateCustomerCommand) {
    final CustomerEntity customerEntity = findCustomerEntityOrThrow(activateCustomerCommand.identifier());

    if (this.taskAggregate.openTasksForCustomerExist(customerEntity, Command.Action.ACTIVATE.name())) {
      throw ServiceException.conflict("Open Tasks for customer {0} exists.", activateCustomerCommand.identifier());
    }

    customerEntity.setCurrentState(Customer.State.ACTIVE.name());
    if (customerEntity.getApplicationDate() == null) {
      customerEntity.setApplicationDate(LocalDate.now(Clock.systemUTC()));
    }
    customerEntity.setLastModifiedBy(UserContextHolder.checkedGetUser());
    customerEntity.setLastModifiedOn(LocalDateTime.now(Clock.systemUTC()));

    final CustomerEntity savedCustomerEntity = this.customerRepository.save(customerEntity);

    this.commandRepository.save(
        CommandMapper.create(savedCustomerEntity, Command.Action.ACTIVATE.name(), activateCustomerCommand.comment())
    );

    return activateCustomerCommand.identifier();
  }