@@ -140,7 +140,19 @@ def update_user_cart(request):
|
||||
old_to_new_id_map = item.order.update_order_type()
|
||||
total_cost = item.order.total_cost
|
||||
|
||||
return JsonResponse({"total_cost": total_cost, "oldToNewIdMap": old_to_new_id_map}, 200)
|
||||
callback_url = request.build_absolute_uri(
|
||||
reverse("shoppingcart.views.postpay_callback")
|
||||
)
|
||||
cart = Order.get_cart_for_user(request.user)
|
||||
form_html = render_purchase_form_html(cart, callback_url=callback_url)
|
||||
|
||||
return JsonResponse(
|
||||
{
|
||||
"total_cost": total_cost,
|
||||
"oldToNewIdMap": old_to_new_id_map,
|
||||
"form_html": form_html,
|
||||
}
|
||||
)
|
||||
|
||||
return HttpResponseBadRequest('Order item not found in request.')
|
||||
|
||||
|
||||
@@ -309,6 +309,8 @@ class TestVerifiedView(ModuleStoreTestCase):
|
||||
"""
|
||||
def setUp(self):
|
||||
self.user = UserFactory.create(username="abc", password="test")
|
||||
self.user.profile.name = u"Røøsty Bøøgins"
|
||||
self.user.save()
|
||||
self.client.login(username="abc", password="test")
|
||||
self.course = CourseFactory.create(org='MITx', number='999.1x', display_name='Verified Course')
|
||||
self.course_id = self.course.id
|
||||
@@ -357,6 +359,8 @@ class TestReverifyView(ModuleStoreTestCase):
|
||||
"""
|
||||
def setUp(self):
|
||||
self.user = UserFactory.create(username="rusty", password="test")
|
||||
self.user.profile.name = u"Røøsty Bøøgins"
|
||||
self.user.profile.save()
|
||||
self.client.login(username="rusty", password="test")
|
||||
self.course = CourseFactory.create(org='MITx', number='999', display_name='Robot Super Course')
|
||||
self.course_key = self.course.id
|
||||
|
||||
@@ -9,6 +9,7 @@ from django.utils.translation import ugettext as _
|
||||
|
||||
%>
|
||||
|
||||
|
||||
<%block name="custom_content">
|
||||
|
||||
<div class="container">
|
||||
@@ -108,7 +109,9 @@ from django.utils.translation import ugettext as _
|
||||
</p>
|
||||
</div>
|
||||
<div name="payment" class="hidden">
|
||||
${form_html}
|
||||
<div id="processor_form">
|
||||
${form_html}
|
||||
</div>
|
||||
<p>
|
||||
${_('After this purchase is complete,')}<br/><b>${order.user.username}</b>
|
||||
${_('will be enrolled in this course.')}
|
||||
@@ -141,14 +144,32 @@ from django.utils.translation import ugettext as _
|
||||
<a href="${marketing_link('COURSES')}" class="blue">${_('View Courses')}</a>
|
||||
</div>
|
||||
% endif
|
||||
|
||||
</div>
|
||||
<form id='refresh_tracker'>
|
||||
<input id="reloadValue" type="hidden" name="reloadValue" value="" />
|
||||
</form>
|
||||
</%block>
|
||||
<script>
|
||||
$(function() {
|
||||
var isSpinnerBtnEnabled = true;
|
||||
var prevQty = 0;
|
||||
|
||||
// This snipnet of code is to detect when and
|
||||
// end-user has clicked the back button to the
|
||||
// page. We want to force refresh to make
|
||||
// sure there is no cached data happening
|
||||
var d = new Date();
|
||||
d = d.getTime();
|
||||
if (jQuery('#reloadValue').val().length == 0)
|
||||
{
|
||||
jQuery('#reloadValue').val(d);
|
||||
} else
|
||||
{
|
||||
jQuery('body').hide();
|
||||
jQuery('#reloadValue').val('');
|
||||
location.reload(true);
|
||||
}
|
||||
|
||||
$('a.btn-remove').click(function(event) {
|
||||
event.preventDefault();
|
||||
var post_url = "${reverse('shoppingcart.views.remove_item')}";
|
||||
@@ -317,6 +338,7 @@ from django.utils.translation import ugettext as _
|
||||
var prevTotal = data['total_cost'];
|
||||
$('html').css({'cursor':'default'});
|
||||
$(".button").css({'cursor':'default'});
|
||||
$("#processor_form").html(data['form_html']);
|
||||
if(typeChanged){
|
||||
var submit_button = $('.col-2.relative').find("input[type='submit']")
|
||||
submit_button.removeAttr('disabled');
|
||||
@@ -410,4 +432,5 @@ from django.utils.translation import ugettext as _
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -347,8 +347,8 @@
|
||||
<h4 class="title">${_("Check Your Name")}</h4>
|
||||
|
||||
<div class="copy">
|
||||
<p>${_("Make sure your full name on your {platform_name} account ({full_name}) matches your ID. We will also use this as the name on your certificate.").format(
|
||||
full_name="<span id='full-name'>{name}</span>".format(name=user_full_name),
|
||||
<p>${_(u"Make sure your full name on your {platform_name} account ({full_name}) matches your ID. We will also use this as the name on your certificate.").format(
|
||||
full_name=u"<span id='full-name'>{name}</span>".format(name=user_full_name),
|
||||
platform_name=settings.PLATFORM_NAME,
|
||||
)}</p>
|
||||
</div>
|
||||
|
||||
@@ -376,8 +376,8 @@
|
||||
<h4 class="title">${_("Check Your Name")}</h4>
|
||||
|
||||
<div class="copy">
|
||||
<p>${_("Make sure your full name on your {platform_name} account ({full_name}) matches your ID. We will also use this as the name on your certificate.").format(
|
||||
full_name="<span id='full-name'>{name}</span>".format(name=user_full_name),
|
||||
<p>${_(u"Make sure your full name on your {platform_name} account ({full_name}) matches your ID. We will also use this as the name on your certificate.").format(
|
||||
full_name=u"<span id='full-name'>{name}</span>".format(name=user_full_name),
|
||||
platform_name=settings.PLATFORM_NAME,
|
||||
)}</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user