ResponseEntity changeTransactionType()

in service/src/main/java/org/apache/fineract/cn/accounting/service/rest/TransactionTypeRestController.java [105:118]


  ResponseEntity<Void> changeTransactionType(@PathVariable("code") final String code,
                                             @RequestBody @Valid final TransactionType transactionType) {
    if (!code.equals(transactionType.getCode())) {
      throw ServiceException.badRequest("Given transaction type {0} must match request path.", code);
    }

    if (!this.transactionTypeService.findByIdentifier(code).isPresent()) {
      throw ServiceException.notFound("Transaction type '{0}' not found.", code);
    }

    this.commandGateway.process(new ChangeTransactionTypeCommand(transactionType));

    return ResponseEntity.accepted().build();
  }