Merge pull request #6259 from edx/renzo/split-verification-payment-hookup
Hook up new payment and verification flow
This commit is contained in:
@@ -4,6 +4,7 @@ Views for the course_mode module
|
||||
|
||||
import decimal
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponseBadRequest
|
||||
from django.shortcuts import redirect
|
||||
from django.views.generic.base import View
|
||||
@@ -62,12 +63,20 @@ class ChooseModeView(View):
|
||||
# to the usual "choose your track" page.
|
||||
has_enrolled_professional = (enrollment_mode == "professional" and is_active)
|
||||
if "professional" in modes and not has_enrolled_professional:
|
||||
return redirect(
|
||||
reverse(
|
||||
'verify_student_show_requirements',
|
||||
kwargs={'course_id': course_key.to_deprecated_string()}
|
||||
if settings.FEATURES.get('SEPARATE_VERIFICATION_FROM_PAYMENT'):
|
||||
return redirect(
|
||||
reverse(
|
||||
'verify_student_start_flow',
|
||||
kwargs={'course_id': unicode(course_key)}
|
||||
)
|
||||
)
|
||||
else:
|
||||
return redirect(
|
||||
reverse(
|
||||
'verify_student_show_requirements',
|
||||
kwargs={'course_id': unicode(course_key)}
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
# If there isn't a verified mode available, then there's nothing
|
||||
# to do on this page. The user has almost certainly been auto-registered
|
||||
@@ -171,9 +180,20 @@ class ChooseModeView(View):
|
||||
donation_for_course[unicode(course_key)] = amount_value
|
||||
request.session["donation_for_course"] = donation_for_course
|
||||
|
||||
return redirect(
|
||||
reverse('verify_student_show_requirements',
|
||||
kwargs={'course_id': course_key.to_deprecated_string()}) + "?upgrade={}".format(upgrade))
|
||||
if settings.FEATURES.get('SEPARATE_VERIFICATION_FROM_PAYMENT'):
|
||||
return redirect(
|
||||
reverse(
|
||||
'verify_student_start_flow',
|
||||
kwargs={'course_id': unicode(course_key)}
|
||||
)
|
||||
)
|
||||
else:
|
||||
return redirect(
|
||||
reverse(
|
||||
'verify_student_show_requirements',
|
||||
kwargs={'course_id': unicode(course_key)}
|
||||
) + "?upgrade={}".format(upgrade)
|
||||
)
|
||||
|
||||
def _get_requested_mode(self, request_dict):
|
||||
"""Get the user's requested mode
|
||||
|
||||
@@ -21,6 +21,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, mixed_st
|
||||
from student.tests.factories import UserFactory, CourseEnrollmentFactory
|
||||
from course_modes.tests.factories import CourseModeFactory
|
||||
from verify_student.models import SoftwareSecurePhotoVerification # pylint: disable=F0401
|
||||
from util.testing import UrlResetMixin
|
||||
|
||||
|
||||
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
|
||||
@@ -33,13 +34,17 @@ MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, incl
|
||||
})
|
||||
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
|
||||
@ddt.ddt
|
||||
class TestCourseVerificationStatus(ModuleStoreTestCase):
|
||||
class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase):
|
||||
"""Tests for per-course verification status on the dashboard. """
|
||||
|
||||
PAST = datetime.now(UTC) - timedelta(days=5)
|
||||
FUTURE = datetime.now(UTC) + timedelta(days=5)
|
||||
|
||||
@patch.dict(settings.FEATURES, {'SEPARATE_VERIFICATION_FROM_PAYMENT': True})
|
||||
def setUp(self):
|
||||
# Invoke UrlResetMixin
|
||||
super(TestCourseVerificationStatus, self).setUp('verify_student.urls')
|
||||
|
||||
self.user = UserFactory(password="edx")
|
||||
self.course = CourseFactory.create()
|
||||
success = self.client.login(username=self.user.username, password="edx")
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
% endif
|
||||
</div>
|
||||
<div class="verification-cta">
|
||||
<a href="#" class="cta">${_('Verify Now')}</a>
|
||||
<a href="${reverse('verify_student_verify_later', kwargs={'course_id': unicode(course.id)})}" class="cta">${_('Verify Now')}</a>
|
||||
</div>
|
||||
% elif verification_status['status'] == VERIFY_STATUS_SUBMITTED:
|
||||
<h4 class="message-title">${_('You have already verified your ID!')}</h4>
|
||||
@@ -172,7 +172,11 @@
|
||||
|
||||
<ul class="actions message-actions">
|
||||
<li class="action-item">
|
||||
<a class="action action-upgrade" href="${reverse('course_modes_choose', kwargs={'course_id': course.id.to_deprecated_string()})}?upgrade=True">
|
||||
% if settings.FEATURES.get('SEPARATE_VERIFICATION_FROM_PAYMENT'):
|
||||
<a class="action action-upgrade" href="${reverse('verify_student_upgrade_and_verify', kwargs={'course_id': unicode(course.id)})}">
|
||||
% else:
|
||||
<a class="action action-upgrade" href="${reverse('course_modes_choose', kwargs={'course_id': unicode(course.id)})}?upgrade=True">
|
||||
% endif
|
||||
<img class="deco-graphic" src="${static.url('images/vcert-ribbon-s.png')}" alt="ID Verified Ribbon/Badge">
|
||||
<span class="wrapper-copy">
|
||||
<span class="copy" id="upgrade-to-verified" data-course-id="${course.id | h}" data-user="${user.username | h}">${_("Upgrade to Verified Track")}</span>
|
||||
|
||||
Reference in New Issue
Block a user