Skip to content

Commit

Permalink
Merge pull request #856 from /issues/773-upload-failed-selfie
Browse files Browse the repository at this point in the history
Fix #773: Upload presence check photo for failed authentication attempts
  • Loading branch information
banterCZ authored Sep 8, 2023
2 parents c5cb634 + 6854c92 commit 4946b20
Showing 1 changed file with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,29 @@ public PresenceCheckResult getResult(OwnerId id, SessionInfo sessionInfo) throws
throw new RemoteCommunicationException("Missing response body when validating a verification in iProov, " + id);
}

final PresenceCheckResult result = new PresenceCheckResult();

final ClaimValidateResponse response = parseResponse(responseEntity.getBody(), ClaimValidateResponse.class);
if (response.getPassed()) {
result.setStatus(PresenceCheckStatus.ACCEPTED);
return convert(response, id);
}

if (ifFrameAvailable(response)) {
logger.debug("Parsing frame image {}", id);
result.setPhoto(parseImage(response.getFrame()));
} else {
logger.debug("Frame is not available, {}", id);
}
private static PresenceCheckResult convert(final ClaimValidateResponse source, final OwnerId id) {
final PresenceCheckResult target = new PresenceCheckResult();

if (source.getPassed()) {
target.setStatus(PresenceCheckStatus.ACCEPTED);
} else {
result.setStatus(PresenceCheckStatus.REJECTED);
result.setRejectReason(response.getReason());
logger.debug("Image rejected with reason={}, {}", source.getReason(), id);
target.setStatus(PresenceCheckStatus.REJECTED);
target.setRejectReason(source.getReason());
}
return result;

if (ifFrameAvailable(source)) {
logger.debug("Parsing frame image {}", id);
target.setPhoto(parseImage(source.getFrame()));
} else {
logger.debug("Frame is not available, {}", id);
}

return target;
}

@Override
Expand Down

0 comments on commit 4946b20

Please sign in to comment.