Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ecommerce
Commits
405c2d4e
Commit
405c2d4e
authored
Oct 01, 2017
by
Uman Shahzad
Committed by
Uman Shahzad
Oct 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update mocks/docs/code to reflect Enterprise API updates.
parent
21b823ab
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
12 deletions
+22
-12
ecommerce/enterprise/api.py
+7
-4
ecommerce/enterprise/tests/mixins.py
+7
-4
ecommerce/enterprise/utils.py
+8
-4
No files found.
ecommerce/enterprise/api.py
View file @
405c2d4e
...
@@ -110,11 +110,14 @@ def fetch_enterprise_learner_data(site, user):
...
@@ -110,11 +110,14 @@ def fetch_enterprise_learner_data(site, user):
"is_active": true,
"is_active": true,
"date_joined": "2016-09-01T19:18:26.026495Z"
"date_joined": "2016-09-01T19:18:26.026495Z"
},
},
"data_sharing_consent": [
"data_sharing_consent
_records
": [
{
{
"user": 1,
"username": "staff",
"state": "enabled",
"enterprise_customer_uuid": "cf246b88-d5f6-4908-a522-fc307e0b0c59",
"enabled": true
"exists": true,
"consent_provided": true,
"consent_required": false,
"course_id": "course-v1:edX DemoX Demo_Course",
}
}
]
]
}
}
...
...
ecommerce/enterprise/tests/mixins.py
View file @
405c2d4e
...
@@ -172,11 +172,14 @@ class EnterpriseServiceMockMixin(object):
...
@@ -172,11 +172,14 @@ class EnterpriseServiceMockMixin(object):
'is_active'
:
True
,
'is_active'
:
True
,
'date_joined'
:
'2016-09-01T19:18:26.026495Z'
'date_joined'
:
'2016-09-01T19:18:26.026495Z'
},
},
'data_sharing_consent'
:
[
'data_sharing_consent
_records
'
:
[
{
{
'user'
:
1
,
"username"
:
"verified"
,
'state'
:
'enabled'
if
consent_provided
else
'disabled'
,
"enterprise_customer_uuid"
:
enterprise_customer_uuid
,
'enabled'
:
consent_provided
"exists"
:
True
,
"consent_provided"
:
consent_provided
,
"consent_required"
:
consent_enabled
and
not
consent_provided
,
"course_id"
:
"course-v1:edX DemoX Demo_Course"
,
}
}
]
]
}
}
...
...
ecommerce/enterprise/utils.py
View file @
405c2d4e
...
@@ -271,10 +271,14 @@ def get_enterprise_course_consent_url(
...
@@ -271,10 +271,14 @@ def get_enterprise_course_consent_url(
)
)
request_params
=
{
request_params
=
{
'course_id'
:
course_id
,
'course_id'
:
course_id
,
'enterprise_id'
:
enterprise_customer_uuid
,
'enterprise_
customer_uu
id'
:
enterprise_customer_uuid
,
'
enrollment_deferred
'
:
True
,
'
defer_creation
'
:
True
,
'next'
:
callback_url
,
'next'
:
callback_url
,
'failure_url'
:
failure_url
,
'failure_url'
:
failure_url
,
# TODO: Erase these 2 keys when edx-platform/ecommerce are both deployed to be using
# 'enterprise_customer_uuid' and 'defer_creation' rather than these.
'enterprise_id'
:
enterprise_customer_uuid
,
'enrollment_deferred'
:
True
,
}
}
redirect_url
=
'{base}?{params}'
.
format
(
redirect_url
=
'{base}?{params}'
.
format
(
base
=
site
.
siteconfiguration
.
enterprise_grant_data_sharing_url
,
base
=
site
.
siteconfiguration
.
enterprise_grant_data_sharing_url
,
...
@@ -290,9 +294,9 @@ def get_enterprise_customer_data_sharing_consent_token(access_token, course_id,
...
@@ -290,9 +294,9 @@ def get_enterprise_customer_data_sharing_consent_token(access_token, course_id,
"""
"""
consent_token_hmac
=
hmac
.
new
(
consent_token_hmac
=
hmac
.
new
(
str
(
access_token
),
str
(
access_token
),
'{course_id}_{enterprise_uuid}'
.
format
(
'{course_id}_{enterprise_
customer_
uuid}'
.
format
(
course_id
=
course_id
,
course_id
=
course_id
,
enterprise_uuid
=
enterprise_customer_uuid
,
enterprise_
customer_
uuid
=
enterprise_customer_uuid
,
),
),
digestmod
=
hashlib
.
sha256
,
digestmod
=
hashlib
.
sha256
,
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment