Merge pull request #27419 from edx/bseverino/idv-remove-utm-parameters
[MST-740] Toggle verification approved emails from ACE
This commit is contained in:
@@ -4,16 +4,6 @@ ACE message types for the verify_student module.
|
||||
from openedx.core.djangoapps.ace_common.message import BaseMessageType
|
||||
|
||||
|
||||
class VerificationExpiry(BaseMessageType): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
APP_LABEL = 'verify_student'
|
||||
Name = 'verificationexpiry'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.options['transactional'] = True
|
||||
|
||||
|
||||
class VerificationApproved(BaseMessageType):
|
||||
"""
|
||||
A message to the learner when their ID verification has been approved.
|
||||
@@ -26,6 +16,16 @@ class VerificationApproved(BaseMessageType):
|
||||
self.options['transactional'] = True
|
||||
|
||||
|
||||
class VerificationExpiry(BaseMessageType): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
APP_LABEL = 'verify_student'
|
||||
Name = 'verificationexpiry'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.options['transactional'] = True
|
||||
|
||||
|
||||
class VerificationSubmitted(BaseMessageType):
|
||||
"""
|
||||
A confirmation message to the learner when their ID verification has been submitted.
|
||||
|
||||
@@ -1664,6 +1664,31 @@ class TestPhotoVerificationResultsCallback(ModuleStoreTestCase, TestVerification
|
||||
}
|
||||
mock_segment_track.assert_called_with(attempt.user.id, "edx.bi.experiment.verification.attempt.result", data)
|
||||
|
||||
@patch.dict(settings.VERIFY_STUDENT, {'USE_DJANGO_MAIL': True})
|
||||
def test_approved_email_without_ace(self):
|
||||
"""
|
||||
Test basic email for verification approved.
|
||||
"""
|
||||
expiration_datetime = now() + timedelta(
|
||||
days=settings.VERIFY_STUDENT["DAYS_GOOD_FOR"]
|
||||
)
|
||||
|
||||
data = {
|
||||
"EdX-ID": self.receipt_id,
|
||||
"Result": "PASS",
|
||||
"Reason": "",
|
||||
"MessageType": "You have been verified."
|
||||
}
|
||||
json_data = json.dumps(data)
|
||||
self.client.post(
|
||||
reverse('verify_student_results_callback'), data=json_data,
|
||||
content_type='application/json',
|
||||
HTTP_AUTHORIZATION='test BBBBBBBBBBBBBBBBBBBB:testing',
|
||||
HTTP_DATE='testdate'
|
||||
)
|
||||
|
||||
self._assert_verification_approved_email(expiration_datetime.date())
|
||||
|
||||
@patch(
|
||||
'lms.djangoapps.verify_student.ssencrypt.has_valid_signature',
|
||||
mock.Mock(side_effect=mocked_has_valid_signature)
|
||||
|
||||
@@ -1149,8 +1149,22 @@ def results_callback(request): # lint-amnesty, pylint: disable=too-many-stateme
|
||||
attempt.approve()
|
||||
|
||||
expiration_datetime = attempt.expiration_datetime.date()
|
||||
email_context = {'user': user, 'expiration_datetime': expiration_datetime.strftime("%m/%d/%Y")}
|
||||
send_verification_approved_email(context=email_context)
|
||||
if settings.VERIFY_STUDENT.get('USE_DJANGO_MAIL'):
|
||||
verification_status_email_vars['expiration_datetime'] = expiration_datetime.strftime("%m/%d/%Y")
|
||||
verification_status_email_vars['full_name'] = user.profile.name
|
||||
subject = _("Your {platform_name} ID verification was approved!").format(
|
||||
platform_name=settings.PLATFORM_NAME
|
||||
)
|
||||
context = {
|
||||
'subject': subject,
|
||||
'template': 'emails/passed_verification_email.txt',
|
||||
'email': user.email,
|
||||
'email_vars': verification_status_email_vars
|
||||
}
|
||||
send_verification_status_email.delay(context)
|
||||
else:
|
||||
email_context = {'user': user, 'expiration_datetime': expiration_datetime.strftime("%m/%d/%Y")}
|
||||
send_verification_approved_email(context=email_context)
|
||||
|
||||
elif result == "FAIL":
|
||||
log.debug("Denying verification for %s", receipt_id)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<%! from django.utils.translation import ugettext as _ %>
|
||||
|
||||
|
||||
${_("Hi {full_name}").format(full_name=full_name)}
|
||||
${_("Hello {full_name},").format(full_name=full_name)}
|
||||
|
||||
${_("Congratulations! Your ID verification process was successful.")}
|
||||
${_("Your verification is effective for two years. It will expire on {expiration_datetime}").format(expiration_date=expiration_datetime)}
|
||||
${_("Your {platform_name} ID verification photos have been approved.").format(platform_name=platform_name)}
|
||||
|
||||
${_("Thank you,")}
|
||||
${_("The {platform_name} team").format(platform_name=platform_name)}
|
||||
${_("Your approval status remains valid for two years, and it will expire {expiration_datetime}.").format(expiration_datetime=expiration_datetime)}
|
||||
|
||||
${_("Enjoy your studies,")}
|
||||
${_("The {platform_name} Team").format(platform_name=platform_name)}
|
||||
|
||||
Reference in New Issue
Block a user