Skip to content
Snippets Groups Projects
Commit cbb259eb authored by David Ormsbee's avatar David Ormsbee
Browse files

Allow amounts specified to actually work for purchasing certificates

parent 2cdddef9
No related merge requests found
......@@ -47,6 +47,14 @@ class ChooseModeView(View):
return redirect('dashboard')
if requested_mode == "verified":
amount = request.POST.get("contribution") or \
request.POST.get("contribution-other-amt") or \
requested_mode.min_price
donation_for_course = request.session.get("donation_for_course", {})
donation_for_course[course_id] = float(amount)
request.session["donation_for_course"] = donation_for_course
return redirect(
"{}?{}".format(
reverse('verify_student_verify'),
......
......@@ -39,24 +39,19 @@
<p>Sign up as a verified student and work toward a Certificate of Achievement.</p>
<dl>
<dt>
Select your contribution for this course (in USD):
Select your contribution for this course (in ${modes["verified"].currency.upper()|h}):
</dt>
<dd>
<ul>
% for price in modes["verified"].suggested_prices.split(","):
<li>
<input type="radio" name="contribution-25" id="contribution"> <label for="contribution-25">$25</label>
<input type="radio" name="contribution" value="${price|h}"><label for="contribution-${price|h}">$${price}</label>
</li>
% endfor
<li>
<input type="radio" name="contribution-50" id="contribution"> <label for="contribution-50">$50</label>
</li>
<li>
<input type="radio" name="contribution-100" id="contribution"> <label for="contribution-100">$100</label>
</li>
<li>
<input type="radio" name="contribution-other" id="contribution"> <label for="contribution-other">Other</label>
</li>
<li>
<label for="contribution-other-amt">Other Amount</label> <input type="text" name="contribution-other" id="contribution-other-amt">
<input type="radio" name="contribution" value=""/>
<label for="contribution-other-amt">Other Amount</label>
$<input type="text" name="contribution-other-amt" id="contribution-other-amt" />
</li>
</ul>
</dd>
......
......@@ -58,11 +58,16 @@ def create_order(request):
attempt.save()
course_id = request.POST['course_id']
donation_for_course = request.session.get("donation_for_course", {})
# FIXME: When this isn't available we do...?
amount = donation_for_course.get(course_id)
# I know, we should check this is valid. All kinds of stuff missing here
# enrollment = CourseEnrollment.create_enrollment(request.user, course_id)
cart = Order.get_cart_for_user(request.user)
CertificateItem.add_to_order(cart, course_id, 30, 'verified')
cart.clear()
CertificateItem.add_to_order(cart, course_id, amount, 'verified')
params = get_signed_purchase_params(cart)
......
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