Skip to content

Commit

Permalink
TII-258 TurnitinOC: Add webhook for updated report scores (sakaiproje…
Browse files Browse the repository at this point in the history
  • Loading branch information
baholladay authored and ern committed Apr 23, 2019
1 parent ee96840 commit cf3c0ee
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public class ContentReviewServiceTurnitinOC extends BaseContentReviewService {

private static final String SUBMISSION_COMPLETE_EVENT_TYPE = "SUBMISSION_COMPLETE";
private static final String SIMILARITY_COMPLETE_EVENT_TYPE = "SIMILARITY_COMPLETE";
private static final String SIMILARITY_UPDATED_EVENT_TYPE = "SIMILARITY_UPDATED";

private String serviceUrl;
private String apiKey;
Expand Down Expand Up @@ -311,8 +312,9 @@ public String setupWebhook(String webhookUrl) throws Exception {
String id = null;
Map<String, Object> data = new HashMap<String, Object>();
List<String> types = new ArrayList<>();
types.add("SIMILARITY_COMPLETE");
types.add("SUBMISSION_COMPLETE");
types.add(SIMILARITY_UPDATED_EVENT_TYPE);
types.add(SIMILARITY_COMPLETE_EVENT_TYPE);
types.add(SUBMISSION_COMPLETE_EVENT_TYPE);

data.put("signing_secret", base64Encode(apiKey));
data.put("url", webhookUrl);
Expand Down Expand Up @@ -1612,7 +1614,7 @@ public void webhookEvent(HttpServletRequest request, int providerId, Optional<St
log.warn("Callback item received without needed information");
errors++;
}
} else if (SIMILARITY_COMPLETE_EVENT_TYPE.equals(eventType)) {
} else if (SIMILARITY_COMPLETE_EVENT_TYPE.equals(eventType) || SIMILARITY_UPDATED_EVENT_TYPE.equals(eventType)) {
if (webhookJSON.has("submission_id") && STATUS_COMPLETE.equals(webhookJSON.get("status"))) {
log.info("Similarity complete webhook cb received");
log.info(webhookJSON.toString());
Expand Down

0 comments on commit cf3c0ee

Please sign in to comment.