Commit a268c912 by Renzo Lucioni

Hook up new payment/verification flow to dashboard, track selection page, and upgrade

parent 7699b5ff
...@@ -4,6 +4,7 @@ Views for the course_mode module ...@@ -4,6 +4,7 @@ Views for the course_mode module
import decimal import decimal
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.conf import settings
from django.http import HttpResponseBadRequest from django.http import HttpResponseBadRequest
from django.shortcuts import redirect from django.shortcuts import redirect
from django.views.generic.base import View from django.views.generic.base import View
...@@ -62,12 +63,20 @@ class ChooseModeView(View): ...@@ -62,12 +63,20 @@ class ChooseModeView(View):
# to the usual "choose your track" page. # to the usual "choose your track" page.
has_enrolled_professional = (enrollment_mode == "professional" and is_active) has_enrolled_professional = (enrollment_mode == "professional" and is_active)
if "professional" in modes and not has_enrolled_professional: if "professional" in modes and not has_enrolled_professional:
return redirect( if settings.FEATURES.get('SEPARATE_VERIFICATION_FROM_PAYMENT'):
reverse( return redirect(
'verify_student_show_requirements', reverse(
kwargs={'course_id': course_key.to_deprecated_string()} '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 # 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 # to do on this page. The user has almost certainly been auto-registered
...@@ -171,9 +180,20 @@ class ChooseModeView(View): ...@@ -171,9 +180,20 @@ class ChooseModeView(View):
donation_for_course[unicode(course_key)] = amount_value donation_for_course[unicode(course_key)] = amount_value
request.session["donation_for_course"] = donation_for_course request.session["donation_for_course"] = donation_for_course
return redirect( if settings.FEATURES.get('SEPARATE_VERIFICATION_FROM_PAYMENT'):
reverse('verify_student_show_requirements', return redirect(
kwargs={'course_id': course_key.to_deprecated_string()}) + "?upgrade={}".format(upgrade)) 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): def _get_requested_mode(self, request_dict):
"""Get the user's requested mode """Get the user's requested mode
......
...@@ -21,6 +21,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, mixed_st ...@@ -21,6 +21,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, mixed_st
from student.tests.factories import UserFactory, CourseEnrollmentFactory from student.tests.factories import UserFactory, CourseEnrollmentFactory
from course_modes.tests.factories import CourseModeFactory from course_modes.tests.factories import CourseModeFactory
from verify_student.models import SoftwareSecurePhotoVerification # pylint: disable=F0401 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) 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 ...@@ -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') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
@ddt.ddt @ddt.ddt
class TestCourseVerificationStatus(ModuleStoreTestCase): class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase):
"""Tests for per-course verification status on the dashboard. """ """Tests for per-course verification status on the dashboard. """
PAST = datetime.now(UTC) - timedelta(days=5) PAST = datetime.now(UTC) - timedelta(days=5)
FUTURE = 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): def setUp(self):
# Invoke UrlResetMixin
super(TestCourseVerificationStatus, self).setUp('verify_student.urls')
self.user = UserFactory(password="edx") self.user = UserFactory(password="edx")
self.course = CourseFactory.create() self.course = CourseFactory.create()
success = self.client.login(username=self.user.username, password="edx") success = self.client.login(username=self.user.username, password="edx")
......
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
% endif % endif
</div> </div>
<div class="verification-cta"> <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> </div>
% elif verification_status['status'] == VERIFY_STATUS_SUBMITTED: % elif verification_status['status'] == VERIFY_STATUS_SUBMITTED:
<h4 class="message-title">${_('You have already verified your ID!')}</h4> <h4 class="message-title">${_('You have already verified your ID!')}</h4>
...@@ -172,7 +172,11 @@ ...@@ -172,7 +172,11 @@
<ul class="actions message-actions"> <ul class="actions message-actions">
<li class="action-item"> <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"> <img class="deco-graphic" src="${static.url('images/vcert-ribbon-s.png')}" alt="ID Verified Ribbon/Badge">
<span class="wrapper-copy"> <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> <span class="copy" id="upgrade-to-verified" data-course-id="${course.id | h}" data-user="${user.username | h}">${_("Upgrade to Verified Track")}</span>
......
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