Commit 9bd1f3a8 by Stephen Sanchez

Merge pull request #6327 from edx/sanchez/logging-verified-split

Adding a number of logging messages for verification process.
parents cf83a3cc 33f62685
...@@ -1000,8 +1000,9 @@ class PaidCourseRegistration(OrderItem): ...@@ -1000,8 +1000,9 @@ class PaidCourseRegistration(OrderItem):
would in fact be quite silly since there's a clear back door. would in fact be quite silly since there's a clear back door.
""" """
if not modulestore().has_course(self.course_id): if not modulestore().has_course(self.course_id):
raise PurchasedCallbackException( msg = u"The customer purchased Course {0}, but that course doesn't exist!".format(self.course_id)
"The customer purchased Course {0}, but that course doesn't exist!".format(self.course_id)) log.error(msg)
raise PurchasedCallbackException(msg)
CourseEnrollment.enroll(user=self.user, course_key=self.course_id, mode=self.mode) CourseEnrollment.enroll(user=self.user, course_key=self.course_id, mode=self.mode)
...@@ -1144,8 +1145,9 @@ class CourseRegCodeItem(OrderItem): ...@@ -1144,8 +1145,9 @@ class CourseRegCodeItem(OrderItem):
be redeemed by users be redeemed by users
""" """
if not modulestore().has_course(self.course_id): if not modulestore().has_course(self.course_id):
raise PurchasedCallbackException( msg = u"The customer purchased Course {0}, but that course doesn't exist!".format(self.course_id)
"The customer purchased Course {0}, but that course doesn't exist!".format(self.course_id)) log.error(msg)
raise PurchasedCallbackException(msg)
total_registration_codes = int(self.qty) total_registration_codes = int(self.qty)
# we need to import here because of a circular dependency # we need to import here because of a circular dependency
...@@ -1306,7 +1308,9 @@ class CertificateItem(OrderItem): ...@@ -1306,7 +1308,9 @@ class CertificateItem(OrderItem):
if mode in valid_modes: if mode in valid_modes:
mode_info = valid_modes[mode] mode_info = valid_modes[mode]
else: else:
raise InvalidCartItem(_("Mode {mode} does not exist for {course_id}").format(mode=mode, course_id=course_id)) msg = u"Mode {mode} does not exist for {course_id}".format(mode=mode, course_id=course_id)
log.error(msg)
raise InvalidCartItem(_(msg))
item, _created = cls.objects.get_or_create( item, _created = cls.objects.get_or_create(
order=order, order=order,
user=order.user, user=order.user,
...@@ -1577,10 +1581,9 @@ class Donation(OrderItem): ...@@ -1577,10 +1581,9 @@ class Donation(OrderItem):
if course_id is not None: if course_id is not None:
course = modulestore().get_course(course_id) course = modulestore().get_course(course_id)
if course is None: if course is None:
err = _( msg = u"Could not find a course with the ID '{course_id}'".format(course_id=course_id)
u"Could not find a course with the ID '{course_id}'" log.error(msg)
).format(course_id=course_id) raise CourseDoesNotExistException(_(msg))
raise CourseDoesNotExistException(err)
return _(u"Donation for {course}").format(course=course.display_name) return _(u"Donation for {course}").format(course=course.display_name)
......
...@@ -451,6 +451,9 @@ class PhotoVerification(StatusModel): ...@@ -451,6 +451,9 @@ class PhotoVerification(StatusModel):
if self.status == "approved": if self.status == "approved":
return return
log.info(u"Verification for user '{user_id}' approved by '{reviewer}'.".format(
user_id=self.user, reviewer=user_id
))
self.error_msg = "" # reset, in case this attempt was denied before self.error_msg = "" # reset, in case this attempt was denied before
self.error_code = "" # reset, in case this attempt was denied before self.error_code = "" # reset, in case this attempt was denied before
self.reviewing_user = user_id self.reviewing_user = user_id
...@@ -494,6 +497,9 @@ class PhotoVerification(StatusModel): ...@@ -494,6 +497,9 @@ class PhotoVerification(StatusModel):
lets you amend the error message in case there were additional lets you amend the error message in case there were additional
details to be made. details to be made.
""" """
log.info(u"Verification for user '{user_id}' denied by '{reviewer}'.".format(
user_id=self.user, reviewer=reviewing_user
))
self.error_msg = error_msg self.error_msg = error_msg
self.error_code = error_code self.error_code = error_code
self.reviewing_user = reviewing_user self.reviewing_user = reviewing_user
...@@ -610,6 +616,9 @@ class SoftwareSecurePhotoVerification(PhotoVerification): ...@@ -610,6 +616,9 @@ class SoftwareSecurePhotoVerification(PhotoVerification):
if attempt.status != "approved": if attempt.status != "approved":
return False return False
except Exception: # pylint: disable=broad-except except Exception: # pylint: disable=broad-except
log.exception(
u"An error occurred while checking re-verification for user '{user_id}'".format(user_id=user)
)
return False return False
return True return True
......
...@@ -424,13 +424,23 @@ class PayAndVerifyView(View): ...@@ -424,13 +424,23 @@ class PayAndVerifyView(View):
# Verify that the course exists and has a verified mode # Verify that the course exists and has a verified mode
if course is None: if course is None:
log.warn(u"No course specified for verification flow request.")
raise Http404 raise Http404
# Verify that the course has a verified mode # Verify that the course has a verified mode
course_mode = CourseMode.verified_mode_for_course(course_key) course_mode = CourseMode.verified_mode_for_course(course_key)
if course_mode is None: if course_mode is None:
log.warn(
u"No verified course mode found for course '{course_id}' for verification flow request"
.format(course_id=course_id)
)
raise Http404 raise Http404
log.info(
u"Entering verified workflow for user '{user}', course '{course_id}', with current step '{current_step}'."
.format(user=request.user, course_id=course_id, current_step=current_step)
)
# Check whether the user has verified, paid, and enrolled. # Check whether the user has verified, paid, and enrolled.
# A user is considered "paid" if he or she has an enrollment # A user is considered "paid" if he or she has an enrollment
# with a paid course mode (such as "verified"). # with a paid course mode (such as "verified").
...@@ -762,6 +772,7 @@ def create_order(request): ...@@ -762,6 +772,7 @@ def create_order(request):
b64_face_image = request.POST['face_image'].split(",")[1] b64_face_image = request.POST['face_image'].split(",")[1]
b64_photo_id_image = request.POST['photo_id_image'].split(",")[1] b64_photo_id_image = request.POST['photo_id_image'].split(",")[1]
except IndexError: except IndexError:
log.error(u"Invalid image data during photo verification.")
context = { context = {
'success': False, 'success': False,
} }
...@@ -791,6 +802,7 @@ def create_order(request): ...@@ -791,6 +802,7 @@ def create_order(request):
# make sure this course has a verified mode # make sure this course has a verified mode
if not current_mode: if not current_mode:
log.warn(u"Verification requested for course {course_id} without a verified mode.".format(course_id=course_id))
return HttpResponseBadRequest(_("This course doesn't support verified certificates")) return HttpResponseBadRequest(_("This course doesn't support verified certificates"))
if current_mode.slug == 'professional': if current_mode.slug == 'professional':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment