Commit 4f67f0da by Diana Huang

Add course_id as merchant defined data

parent 58e6dcf7
......@@ -34,7 +34,7 @@ from verify_student.models import (
from reverification.models import MidcourseReverificationWindow
import ssencrypt
from xmodule.modulestore.exceptions import ItemNotFoundError
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from opaque_keys.edx.keys import CourseKey
from .exceptions import WindowExpiredException
from xmodule.modulestore.django import modulestore
......@@ -59,7 +59,7 @@ class VerifyView(View):
"""
upgrade = request.GET.get('upgrade', False)
course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
course_id = CourseKey.from_string(course_id)
# If the user has already been verified within the given time period,
# redirect straight to the payment -- no need to verify again.
if SoftwareSecurePhotoVerification.user_has_valid_or_pending(request.user):
......@@ -133,7 +133,7 @@ class VerifiedView(View):
Handle the case where we have a get request
"""
upgrade = request.GET.get('upgrade', False)
course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
course_id = CourseKey.from_string(course_id)
if CourseEnrollment.enrollment_mode_for_user(request.user, course_id) == ('verified', True):
return redirect(reverse('dashboard'))
......@@ -195,7 +195,7 @@ def create_order(request):
attempt.save()
course_id = request.POST['course_id']
course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
course_id = CourseKey.from_string(course_id)
donation_for_course = request.session.get('donation_for_course', {})
current_donation = donation_for_course.get(unicode(course_id), decimal.Decimal(0))
contribution = request.POST.get("contribution", donation_for_course.get(unicode(course_id), 0))
......@@ -230,10 +230,13 @@ def create_order(request):
callback_url = request.build_absolute_uri(
reverse("shoppingcart.views.postpay_callback")
)
params = get_signed_purchase_params(
cart, callback_url=callback_url
)
params['success'] = True
params['merchant_defined_data1'] = unicode(course_id)
return HttpResponse(json.dumps(params), content_type="text/json")
......@@ -322,7 +325,7 @@ def show_requirements(request, course_id):
Show the requirements necessary for the verification flow.
"""
# TODO: seems borked for professional; we're told we need to take photos even if there's a pending verification
course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
course_id = CourseKey.from_string(course_id)
upgrade = request.GET.get('upgrade', False)
if CourseEnrollment.enrollment_mode_for_user(request.user, course_id) == ('verified', True):
return redirect(reverse('dashboard'))
......@@ -421,7 +424,7 @@ class MidCourseReverifyView(View):
"""
display this view
"""
course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
course_id = CourseKey.from_string(course_id)
course = modulestore().get_course(course_id)
course_enrollment = CourseEnrollment.get_or_create_enrollment(request.user, course_id)
course_enrollment.update_enrollment(mode="verified")
......@@ -445,7 +448,7 @@ class MidCourseReverifyView(View):
"""
try:
now = datetime.datetime.now(UTC)
course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
course_id = CourseKey.from_string(course_id)
window = MidcourseReverificationWindow.get_window(course_id, now)
if window is None:
raise WindowExpiredException
......
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