Commit 400efdf1 by Will Daly

Merge pull request #6421 from edx/will/ecom-850

Set attempting_upgrade session flag in the new payment flow
parents c183831b c15adf9c
......@@ -993,6 +993,7 @@ class TestPayAndVerifyView(UrlResetMixin, ModuleStoreTestCase):
PayAndVerifyView.PHOTO_ID_REQ,
PayAndVerifyView.WEBCAM_REQ,
])
self._assert_upgrade_session_flag(False)
@ddt.data("expired", "denied")
def test_start_flow_expired_or_denied_verification(self, verification_status):
......@@ -1331,6 +1332,7 @@ class TestPayAndVerifyView(UrlResetMixin, ModuleStoreTestCase):
PayAndVerifyView.PHOTO_ID_REQ,
PayAndVerifyView.WEBCAM_REQ,
])
self._assert_upgrade_session_flag(True)
def test_upgrade_already_verified(self):
course = self._create_course("verified")
......@@ -1636,6 +1638,10 @@ class TestPayAndVerifyView(UrlResetMixin, ModuleStoreTestCase):
'verification_deadline': pay_and_verify_div['data-verification-deadline']
}
def _assert_upgrade_session_flag(self, is_upgrade):
"""Check that the session flag for attempting an upgrade is set. """
self.assertEqual(self.client.session.get('attempting_upgrade'), is_upgrade)
def _assert_redirects_to_dashboard(self, response):
"""Check that the page redirects to the student dashboard. """
self.assertRedirects(response, reverse('dashboard'))
......
......@@ -499,6 +499,10 @@ class PayAndVerifyView(View):
'donation_for_course', {}
).get(unicode(course_key), '')
# Remember whether the user is upgrading
# so we can fire an analytics event upon payment.
request.session['attempting_upgrade'] = (message == self.UPGRADE_MSG)
# Render the top-level page
context = {
'user_full_name': full_name,
......
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