Skip to content

Commit

Permalink
Do not fail if no ticket number node is passed into the endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mseaton committed Nov 15, 2023
1 parent 968ca68 commit b9c1653
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,15 @@ public Object assignTicketToServicePoint(HttpServletRequest request) throws Exce
if (requestBody != null) {
ObjectMapper mapper = new ObjectMapper();
JsonNode actualObj = mapper.readTree(requestBody);

if (!actualObj.has("ticketNumber")) {
return new ResponseEntity<Object>(
"No ticketNumber passed, skipping ticket assignment",
new HttpHeaders(),
HttpStatus.OK
);
}

String servicePointName = actualObj.get("servicePointName").textValue();
String ticketNumber = actualObj.get("ticketNumber").textValue();
String status = actualObj.get("status").textValue();
Expand Down

0 comments on commit b9c1653

Please sign in to comment.