ResponseEntity post()

in service/src/main/java/org/apache/fineract/cn/teller/service/rest/TellerOperationRestController.java [173:193]


  ResponseEntity<TellerTransactionCosts> post(@PathVariable("tellerCode") final String tellerCode,
                                              @RequestBody @Valid final TellerTransaction tellerTransaction) {
    final Teller teller = this.verifyTeller(tellerCode);

    if (!teller.getState().equals(Teller.State.ACTIVE.name())) {
      throw ServiceException.conflict("Teller {0} is not active.", tellerCode);
    }

    this.verifyEmployee(teller);
    this.verifyAccounts(tellerTransaction);
    this.verifyTellerTransaction(teller, tellerTransaction);

    try {
      return ResponseEntity.ok(
          this.commandGateway.process(
              new InitializeTellerTransactionCommand(tellerCode, tellerTransaction), TellerTransactionCosts.class).get()
      );
    } catch (final Exception e) {
      throw ServiceException.badRequest("Transaction for teller {0} not valid.", tellerCode);
    }
  }