Preserve purchase amount choice and redisplay on final verification page.
This commit is contained in:
@@ -26,6 +26,7 @@ class ChooseModeView(View):
|
||||
"course_id": course_id,
|
||||
"modes": modes,
|
||||
"course_name": course_from_id(course_id).display_name,
|
||||
"chosen_price" : None,
|
||||
}
|
||||
if "verified" in modes:
|
||||
context["suggested_prices"] = modes["verified"].suggested_prices.split(",")
|
||||
@@ -57,10 +58,10 @@ class ChooseModeView(View):
|
||||
if requested_mode == "verified":
|
||||
amount = request.POST.get("contribution") or \
|
||||
request.POST.get("contribution-other-amt") or \
|
||||
requested_mode.min_price
|
||||
requested_mode.min_price.format("{:g}")
|
||||
|
||||
donation_for_course = request.session.get("donation_for_course", {})
|
||||
donation_for_course[course_id] = float(amount)
|
||||
donation_for_course[course_id] = amount
|
||||
request.session["donation_for_course"] = donation_for_course
|
||||
|
||||
# TODO: Check here for minimum pricing
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
<ul class="pay-options">
|
||||
% for price in suggested_prices:
|
||||
<li>
|
||||
<input type="radio" name="contribution" value="${price|h}" selected="${'selected' if price == chosen_price else ''}"><label for="contribution-${price|h}">$${price} ${currency}</label>
|
||||
<input type="radio" name="contribution" value="${price|h}" ${'checked' if price == chosen_price else ''}><label for="contribution-${price|h}">$${price} ${currency}</label>
|
||||
</li>
|
||||
% endfor
|
||||
|
||||
<li class="other1">
|
||||
<input type="radio" id="contribution-other" name="contribution" value=""/>
|
||||
<input type="radio" id="contribution-other" name="contribution" value="" ${'checked' if (chosen_price and chosen_price not in suggested_prices) else ''}/>
|
||||
<label for=" contribution-other"><span class="sr">Other</span></label>
|
||||
</li>
|
||||
<li class="other2">
|
||||
<label for="contribution-other-amt"><span class="sr">Other Amount</span> </label>$<input type="text" size="5" name="contribution-other-amt" id="contribution-other-amt" />
|
||||
<label for="contribution-other-amt"><span class="sr">Other Amount</span> </label>$<input type="text" size="5" name="contribution-other-amt" id="contribution-other-amt" value="${chosen_price if (chosen_price and chosen_price not in suggested_prices) else ''}" />
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<span class="ribbon"></span>
|
||||
<p>Sign up as a verified student and work toward a Certificate of Achievement.</p>
|
||||
|
||||
<%include file="_contribution.html" args="suggested_prices=suggested_prices, currency=currency"/>
|
||||
<%include file="_contribution.html" args="suggested_prices=suggested_prices, currency=currency, chosen_price=chosen_price"/>
|
||||
|
||||
<p class="tip expand">
|
||||
<a href="">Why do I have to pay? What if I don't meet all the requirements?</a>
|
||||
|
||||
@@ -42,15 +42,19 @@ class VerifyView(View):
|
||||
|
||||
course_id = request.GET['course_id']
|
||||
verify_mode = CourseMode.mode_for_course(course_id, "verified")
|
||||
if course_id in request.session.get("donation_for_course", {}):
|
||||
chosen_price = request.session["donation_for_course"][course_id]
|
||||
else:
|
||||
chosen_price = verify_mode.min_price.format("{:g}")
|
||||
context = {
|
||||
"progress_state" : progress_state,
|
||||
"user_full_name" : request.user.profile.name,
|
||||
"course_id" : course_id,
|
||||
"course_name" : course_from_id(course_id).display_name,
|
||||
"purchase_endpoint" : get_purchase_endpoint(),
|
||||
"suggested_prices" : [int(price) for price in verify_mode.suggested_prices.split(",")],
|
||||
"suggested_prices" : verify_mode.suggested_prices.split(","),
|
||||
"currency" : verify_mode.currency.upper(),
|
||||
"chosen_price" : request.session.get("donation_for_course", verify_mode.min_price)
|
||||
"chosen_price" : chosen_price,
|
||||
}
|
||||
|
||||
return render_to_response('verify_student/photo_verification.html', context)
|
||||
|
||||
Reference in New Issue
Block a user