Commit 935323a8 by Clinton Blackburn Committed by Clinton Blackburn

Enrolling via E-Commerce API for combined login-registration page

The login-registration page now supports using the E-Commerce API when enrolling users in honor seats (of courses with SKUs).
parent eaa7a220
...@@ -5,7 +5,7 @@ define(['js/common_helpers/ajax_helpers', 'js/student_account/enrollment'], ...@@ -5,7 +5,7 @@ define(['js/common_helpers/ajax_helpers', 'js/student_account/enrollment'],
describe( 'edx.student.account.EnrollmentInterface', function() { describe( 'edx.student.account.EnrollmentInterface', function() {
var COURSE_KEY = 'edX/DemoX/Fall', var COURSE_KEY = 'edX/DemoX/Fall',
ENROLL_URL = '/api/enrollment/v1/enrollment', ENROLL_URL = '/commerce/orders/',
FORWARD_URL = '/course_modes/choose/edX/DemoX/Fall/', FORWARD_URL = '/course_modes/choose/edX/DemoX/Fall/',
EMBARGO_MSG_URL = '/embargo/blocked-message/enrollment/default/'; EMBARGO_MSG_URL = '/embargo/blocked-message/enrollment/default/';
...@@ -26,7 +26,7 @@ define(['js/common_helpers/ajax_helpers', 'js/student_account/enrollment'], ...@@ -26,7 +26,7 @@ define(['js/common_helpers/ajax_helpers', 'js/student_account/enrollment'],
requests, requests,
'POST', 'POST',
ENROLL_URL, ENROLL_URL,
'{"course_details":{"course_id":"edX/DemoX/Fall"}}' '{"course_id":"edX/DemoX/Fall"}'
); );
// Simulate a successful response from the server // Simulate a successful response from the server
......
...@@ -9,7 +9,7 @@ var edx = edx || {}; ...@@ -9,7 +9,7 @@ var edx = edx || {};
edx.student.account.EnrollmentInterface = { edx.student.account.EnrollmentInterface = {
urls: { urls: {
enrollment: '/api/enrollment/v1/enrollment', orders: '/commerce/orders/',
trackSelection: '/course_modes/choose/' trackSelection: '/course_modes/choose/'
}, },
...@@ -23,14 +23,11 @@ var edx = edx || {}; ...@@ -23,14 +23,11 @@ var edx = edx || {};
* @param {string} courseKey Slash-separated course key. * @param {string} courseKey Slash-separated course key.
*/ */
enroll: function( courseKey ) { enroll: function( courseKey ) {
var data_obj = { var data_obj = {course_id: courseKey},
course_details: { data = JSON.stringify(data_obj);
course_id: courseKey
}
};
var data = JSON.stringify(data_obj);
$.ajax({ $.ajax({
url: this.urls.enrollment, url: this.urls.orders,
type: 'POST', type: 'POST',
contentType: 'application/json; charset=utf-8', contentType: 'application/json; charset=utf-8',
data: data, data: data,
......
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