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
5b2dd87a
Commit
5b2dd87a
authored
Mar 13, 2015
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7333 from edx/clintonb/commerce-json-fix
Corrected data sent to E-Commerce API
parents
63bf1510
acb141a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
lms/djangoapps/commerce/tests.py
+1
-1
lms/djangoapps/commerce/views.py
+3
-2
No files found.
lms/djangoapps/commerce/tests.py
View file @
5b2dd87a
...
...
@@ -184,7 +184,7 @@ class OrdersViewTests(ModuleStoreTestCase):
# Verify the correct information was passed to the E-Commerce API
request
=
httpretty
.
last_request
()
sku
=
CourseMode
.
objects
.
filter
(
course_id
=
self
.
course
.
id
,
mode_slug
=
'honor'
,
sku__isnull
=
False
)[
0
]
.
sku
self
.
assertEqual
(
request
.
body
,
'
sku={
}'
.
format
(
sku
))
self
.
assertEqual
(
request
.
body
,
'
{{"sku": "{}"}
}'
.
format
(
sku
))
self
.
assertEqual
(
request
.
headers
[
'Content-Type'
],
'application/json'
)
# Verify the JWT is correct
...
...
lms/djangoapps/commerce/views.py
View file @
5b2dd87a
""" Commerce views. """
import
json
import
logging
from
simplejson
import
JSONDecodeError
...
...
@@ -111,7 +111,8 @@ class OrdersView(APIView):
try
:
timeout
=
getattr
(
settings
,
'ECOMMERCE_API_TIMEOUT'
,
5
)
response
=
requests
.
post
(
url
,
data
=
{
'sku'
:
course_modes
[
0
]
.
sku
},
headers
=
headers
,
timeout
=
timeout
)
response
=
requests
.
post
(
url
,
data
=
json
.
dumps
({
'sku'
:
course_modes
[
0
]
.
sku
}),
headers
=
headers
,
timeout
=
timeout
)
except
Exception
as
ex
:
# pylint: disable=broad-except
log
.
exception
(
'Call to E-Commerce API failed:
%
s.'
,
ex
.
message
)
return
ApiErrorResponse
()
...
...
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