private InteropActionEntity addAction()

in service/src/main/java/org/apache/fineract/cn/interoperation/service/internal/service/InteropService.java [787:805]


    private InteropActionEntity addAction(@NotNull InteropTransactionEntity transaction, @NotNull InteropRequestData request,
                                          @NotNull LocalDateTime createdOn) {
        InteropActionEntity lastAction = getLastAction(transaction);

        InteropActionType actionType = request.getActionType();
        String actionIdentifier = calcActionIdentifier(request.getIdentifier(), request.getActionType());
        InteropActionEntity action = new InteropActionEntity(actionIdentifier, transaction, request.getActionType(),
                (lastAction == null ? 0 : lastAction.getSeqNo() + 1), getLoginUser(),
                (lastAction == null ? transaction.getCreatedOn() : createdOn));
        action.setState(InteropActionState.ACCEPTED);
        action.setAmount(request.getAmount().getAmount());
        action.setExpirationDate(request.getExpiration());
        transaction.getActions().add(action);

        InteropState currentState = transaction.getState();
        if (transaction.getId() != null || InteropStateMachine.isValidAction(currentState, actionType)) // newly created was already set
            transaction.setState(InteropStateMachine.handleTransition(currentState, actionType));
        return action;
    }