Skip to content

Commit

Permalink
Merge branch 'master' into rpenido/fal-3611-download-library-tag-spre…
Browse files Browse the repository at this point in the history
…adsheet
  • Loading branch information
rpenido committed Feb 16, 2024
2 parents 4012481 + 6353bb2 commit 4ad87c2
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 9 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
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
return FormView.extend({
el: '.financial-assistance-wrapper',
events: {
'click .js-submit-form': 'submitForm'
'click .js-submit-form': 'submitForm',
'ajaxError': 'handleAjaxError'
},
tpl: formViewTpl,
fieldTpl: formFieldTpl,
Expand Down Expand Up @@ -101,6 +102,12 @@

if (error.status === 0) {
msg = gettext('An error has occurred. Check your Internet connection and try again.');
} else if (error.status === 403) {
txt = [
'You must confirm your email to complete registration before applying for financial assistance.',
'If you continue to have issues please contact support.'
],
msg = gettext(txt.join(' '));
}

this.errors = [HtmlUtils.joinHtml(
Expand Down Expand Up @@ -155,6 +162,12 @@
});
}
}
},

// this.model.save() makes an ajax call, which, when it errors,
// should have an error message displayed on the banner on the page
handleAjaxError: function (event, request, settings, thrownError) {
this.saveError(request);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ define([
expect(view.$('.js-success-message').length).toEqual(1);
};

failedSubmission = function() {
failedSubmission = function(statusCode) {
expect(view.$('.js-success-message').length).toEqual(0);
expect(view.$formFeedback.find('.' + view.formErrorsJsHook).length).toEqual(0);
validSubmission();
view.model.trigger('error', {status: 500});
view.model.trigger('error', {status: statusCode});
expect(view.$('.js-success-message').length).toEqual(0);
expect(view.$formFeedback.find('.' + view.formErrorsJsHook).length).toEqual(1);
};
Expand Down Expand Up @@ -166,7 +166,12 @@ define([
});

it('should submit the form and show an error message if content is valid and API returns error', function() {
failedSubmission();
failedSubmission(500);
});

it('should submit the form and show an error message if content is valid and API returns 403 error', function() {
failedSubmission(403);
expect(view.$('.message-copy').text()).toContain('You must confirm your email');
});

it('should allow form resubmission after a front end validation failure', function() {
Expand All @@ -176,7 +181,7 @@ define([
});

it('should allow form resubmission after an API error is returned', function() {
failedSubmission();
failedSubmission(500);
successfulSubmission();
});

Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ optimizely-sdk==4.1.1
# via
# -c requirements/edx/../constraints.txt
# -r requirements/edx/bundled.in
ora2==6.0.33
ora2==6.0.34
# via -r requirements/edx/bundled.in
packaging==23.2
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ optimizely-sdk==4.1.1
# -c requirements/edx/../constraints.txt
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
ora2==6.0.33
ora2==6.0.34
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ optimizely-sdk==4.1.1
# via
# -c requirements/edx/../constraints.txt
# -r requirements/edx/base.txt
ora2==6.0.33
ora2==6.0.34
# via -r requirements/edx/base.txt
packaging==23.2
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ optimizely-sdk==4.1.1
# via
# -c requirements/edx/../constraints.txt
# -r requirements/edx/base.txt
ora2==6.0.33
ora2==6.0.34
# via -r requirements/edx/base.txt
packaging==23.2
# via
Expand Down

0 comments on commit 4ad87c2

Please sign in to comment.