public String process()

in service/src/main/java/org/apache/fineract/cn/deposit/service/internal/command/handler/ProductInstanceAggregate.java [121:142]


  public String process(final ActivateProductInstanceCommand activateProductInstanceCommand) {
    final String accountIdentifier = activateProductInstanceCommand.identifier();
    final Optional<ProductInstanceEntity> optionalProductInstance =
        this.productInstanceRepository.findByAccountIdentifier(accountIdentifier);

    if (optionalProductInstance.isPresent()) {
      final ProductInstanceEntity productInstanceEntity = optionalProductInstance.get();
      productInstanceEntity.setState("ACTIVE");
      if (productInstanceEntity.getOpenedOn() == null) {
        productInstanceEntity.setOpenedOn(LocalDate.now(Clock.systemUTC()));
      }
      productInstanceEntity.setLastModifiedBy(UserContextHolder.checkedGetUser());
      productInstanceEntity.setLastModifiedOn(LocalDateTime.now(Clock.systemUTC()));
      this.productInstanceRepository.save(productInstanceEntity);

      return accountIdentifier;
    } else {
      this.logger.warn("Product instance for account {} not found.", accountIdentifier);
    }

    return null;
  }