public NotifyRequestResultRequest getNotifyRequestResultRequest() { NotifyRequestResultRequest notifyRequestResultRequest = new NotifyRequestResultRequest(); notifyRequestResultRequest.setRequestIdentifier(this.requestIdentifier); notifyRequestResultRequest.setRequestSuccess(this.requestSuccess); notifyRequestResultRequest.setCause(String.valueOf(this.cause)); return notifyRequestResultRequest; }
/** * Create an instance of {@link NotifyRequestResultRequest } * */ public NotifyRequestResultRequest createNotifyRequestResultRequest() { return new NotifyRequestResultRequest(); }
@Override public NotifyRequestResultResponse notifyRequestResult(NotifyRequestResultRequest notifyRequestResultRequest) { SessionInfo sessionInfo = sourceSessionRepository.findSessionInfoByRequestId(notifyRequestResultRequest.getRequestIdentifier()); NotifyRequestResultResponse notifyRequestResultResponse = new NotifyRequestResultResponse(); if (notifyRequestResultRequest.isRequestSuccess()) { if (sessionInfo.getSessionStateMachine().hasStateStartTransactionRequested()) { sessionInfo.getSessionStateMachine().eventStartOk(); sourceSessionRepository.insertOrUpdateSessionInfo(sessionInfo); } else if (sessionInfo.getSessionStateMachine().hasStateStopTransactionRequested()) { sessionInfo.getSessionStateMachine().eventStopOk(); sourceSessionRepository.insertOrUpdateSessionInfo(sessionInfo); } else { ResponseError responseError = new ResponseError(); responseError.setErrorCode("400"); responseError.setErrorMsg("Unexpected event in current state"); notifyRequestResultResponse.setResponseError(responseError); } } return notifyRequestResultResponse; }
/** * Create an instance of {@link NotifyRequestResultRequest } * */ public NotifyRequestResultRequest createNotifyRequestResultRequest() { return new NotifyRequestResultRequest(); }