Skip to content

Commit

Permalink
temp: add supplemental logging to debug IDV issues (#34248)
Browse files Browse the repository at this point in the history
This commit adds some supplemental, more verbose logging to the results_callback view in the verify_student Djangoapp. This endpoint is called by identity verification (IDV) providers to POST an IDV review to edX.

We are experiencing issues with receiving IDV reviews from our IDV provider, and these logs will help us diagnose whether there is an issue in edX's systems.

These logs will be removed after our investigation is complete.
  • Loading branch information
MichaelRoytman authored Feb 16, 2024
1 parent 663feed commit 95b3e88
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lms/djangoapps/verify_student/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,18 @@ def results_callback(request): # lint-amnesty, pylint: disable=too-many-stateme
reason = body_dict.get("Reason", "")
error_code = body_dict.get("MessageType", "")

# TODO: These logs must be removed once the investigation in COSMO-184 is complete.
# COSMO-196 was created to track the cleanup of these logs.
log.info(
"[COSMO-184] Software Secure review received for receipt_id={receipt_id}, "
"with result={result} and reason={reason}."
.format(
receipt_id=receipt_id,
result=result,
reason=reason,
)
)

try:
attempt = SoftwareSecurePhotoVerification.objects.get(receipt_id=receipt_id)
except SoftwareSecurePhotoVerification.DoesNotExist:
Expand Down Expand Up @@ -1099,6 +1111,10 @@ def results_callback(request): # lint-amnesty, pylint: disable=too-many-stateme
SoftwareSecurePhotoVerification.objects.filter(pk=previous_verification.pk
).update(expiry_email_date=None)
log.debug(f'Approving verification for {receipt_id}')

# TODO: These logs must be removed once the investigation in COSMO-184 is complete.
# COSMO-196 was created to track the cleanup of these logs.
log.info("[COSMO-184] Approved verification for receipt_id={receipt_id}.".format(receipt_id=receipt_id))
attempt.approve()

expiration_datetime = attempt.expiration_datetime.date()
Expand All @@ -1121,6 +1137,11 @@ def results_callback(request): # lint-amnesty, pylint: disable=too-many-stateme

elif result == "FAIL":
log.debug("Denying verification for %s", receipt_id)

# TODO: These logs must be removed once the investigation in COSMO-184 is complete.
# COSMO-196 was created to track the cleanup of these logs.
log.info("[COSMO-184] Denied verification for receipt_id={receipt_id}.".format(receipt_id=receipt_id))

attempt.deny(json.dumps(reason), error_code=error_code)
reverify_url = f'{settings.ACCOUNT_MICROFRONTEND_URL}/id-verification'
verification_status_email_vars['reasons'] = reason
Expand Down

0 comments on commit 95b3e88

Please sign in to comment.