Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
f552df33
Commit
f552df33
authored
Mar 16, 2015
by
Stephen Sanchez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify commerce view to work without ecommerce configuration.
parent
081f5b4e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
lms/djangoapps/commerce/views.py
+3
-4
lms/envs/aws.py
+3
-3
No files found.
lms/djangoapps/commerce/views.py
View file @
f552df33
...
...
@@ -54,17 +54,16 @@ class OrdersView(APIView):
return
True
,
course_key
,
None
def
_get_jwt
(
self
,
user
):
def
_get_jwt
(
self
,
user
,
ecommerce_api_signing_key
):
"""
Returns a JWT object with the specified user's info.
Raises AttributeError if settings.ECOMMERCE_API_SIGNING_KEY is not set.
"""
data
=
{
'username'
:
user
.
username
,
'email'
:
user
.
email
}
return
jwt
.
encode
(
data
,
getattr
(
settings
,
'ECOMMERCE_API_SIGNING_KEY'
)
)
return
jwt
.
encode
(
data
,
ecommerce_api_signing_key
)
def
_enroll
(
self
,
course_key
,
user
):
""" Enroll the user in the course. """
...
...
@@ -104,7 +103,7 @@ class OrdersView(APIView):
# Contact external API
headers
=
{
'Content-Type'
:
'application/json'
,
'Authorization'
:
'JWT {}'
.
format
(
self
.
_get_jwt
(
user
))
'Authorization'
:
'JWT {}'
.
format
(
self
.
_get_jwt
(
user
,
ecommerce_api_signing_key
))
}
url
=
'{}/orders/'
.
format
(
ecommerce_api_url
.
strip
(
'/'
))
...
...
lms/envs/aws.py
View file @
f552df33
...
...
@@ -560,6 +560,6 @@ PERFORMANCE_GRAPHITE_URL = ENV_TOKENS.get('PERFORMANCE_GRAPHITE_URL', PERFORMANC
CDN_VIDEO_URLS
=
ENV_TOKENS
.
get
(
'CDN_VIDEO_URLS'
,
CDN_VIDEO_URLS
)
##### ECOMMERCE API CONFIGURATION SETTINGS #####
ECOMMERCE_API_URL
=
ENV_TOKENS
.
get
(
'ECOMMERCE_API_URL'
)
ECOMMERCE_API_SIGNING_KEY
=
AUTH_TOKENS
.
get
(
'ECOMMERCE_API_SIGNING_KEY'
)
ECOMMERCE_API_TIMEOUT
=
ENV_TOKENS
.
get
(
'ECOMMERCE_API_TIMEOUT'
,
5
)
ECOMMERCE_API_URL
=
ENV_TOKENS
.
get
(
'ECOMMERCE_API_URL'
,
ECOMMERCE_API_URL
)
ECOMMERCE_API_SIGNING_KEY
=
AUTH_TOKENS
.
get
(
'ECOMMERCE_API_SIGNING_KEY'
,
ECOMMERCE_API_SIGNING_KEY
)
ECOMMERCE_API_TIMEOUT
=
ENV_TOKENS
.
get
(
'ECOMMERCE_API_TIMEOUT'
,
ECOMMERCE_API_TIMEOUT
)
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