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).
This commit is contained in:
Clinton Blackburn
2015-03-12 12:50:35 -04:00
committed by Clinton Blackburn
parent eaa7a22058
commit 935323a879
2 changed files with 7 additions and 10 deletions

View File

@@ -5,7 +5,7 @@ define(['js/common_helpers/ajax_helpers', 'js/student_account/enrollment'],
describe( 'edx.student.account.EnrollmentInterface', function() {
var COURSE_KEY = 'edX/DemoX/Fall',
ENROLL_URL = '/api/enrollment/v1/enrollment',
ENROLL_URL = '/commerce/orders/',
FORWARD_URL = '/course_modes/choose/edX/DemoX/Fall/',
EMBARGO_MSG_URL = '/embargo/blocked-message/enrollment/default/';
@@ -26,7 +26,7 @@ define(['js/common_helpers/ajax_helpers', 'js/student_account/enrollment'],
requests,
'POST',
ENROLL_URL,
'{"course_details":{"course_id":"edX/DemoX/Fall"}}'
'{"course_id":"edX/DemoX/Fall"}'
);
// Simulate a successful response from the server

View File

@@ -9,7 +9,7 @@ var edx = edx || {};
edx.student.account.EnrollmentInterface = {
urls: {
enrollment: '/api/enrollment/v1/enrollment',
orders: '/commerce/orders/',
trackSelection: '/course_modes/choose/'
},
@@ -23,14 +23,11 @@ var edx = edx || {};
* @param {string} courseKey Slash-separated course key.
*/
enroll: function( courseKey ) {
var data_obj = {
course_details: {
course_id: courseKey
}
};
var data = JSON.stringify(data_obj);
var data_obj = {course_id: courseKey},
data = JSON.stringify(data_obj);
$.ajax({
url: this.urls.enrollment,
url: this.urls.orders,
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: data,