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
ff472e16
Commit
ff472e16
authored
Aug 22, 2013
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Grabbing the basic order information we need to sent to CyberSource.
parent
247c3ade
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
9 deletions
+38
-9
lms/djangoapps/shoppingcart/processors/CyberSource.py
+10
-5
lms/djangoapps/verify_student/urls.py
+6
-0
lms/djangoapps/verify_student/views.py
+19
-2
lms/templates/verify_student/photo_verification.html
+3
-2
No files found.
lms/djangoapps/shoppingcart/processors/CyberSource.py
View file @
ff472e16
...
...
@@ -102,6 +102,15 @@ def render_purchase_form_html(cart):
"""
Renders the HTML of the hidden POST form that must be used to initiate a purchase with CyberSource
"""
return
render_to_string
(
'shoppingcart/cybersource_form.html'
,
{
'action'
:
purchase_endpoint
,
'params'
:
get_signed_purchase_params
(
params
),
})
def
get_signed_purchase_params
(
cart
):
return
sign
(
get_purchase_params
(
cart
))
def
get_purchase_params
(
cart
):
purchase_endpoint
=
settings
.
CC_PROCESSOR
[
'CyberSource'
]
.
get
(
'PURCHASE_ENDPOINT'
,
''
)
total_cost
=
cart
.
total_cost
...
...
@@ -112,12 +121,8 @@ def render_purchase_form_html(cart):
params
[
'currency'
]
=
cart
.
currency
params
[
'orderPage_transactionType'
]
=
'sale'
params
[
'orderNumber'
]
=
"{0:d}"
.
format
(
cart
.
id
)
signed_param_dict
=
sign
(
params
)
return
render_to_string
(
'shoppingcart/cybersource_form.html'
,
{
'action'
:
purchase_endpoint
,
'params'
:
signed_param_dict
,
})
return
params
def
payment_accepted
(
params
):
...
...
lms/djangoapps/verify_student/urls.py
View file @
ff472e16
...
...
@@ -38,6 +38,12 @@ urlpatterns = patterns(
r'^verify'
,
views
.
VerifyView
.
as_view
(),
name
=
"verify_student_verify"
),
url
(
r'^create_order'
,
views
.
create_order
,
name
=
"verify_student_create_order"
)
)
lms/djangoapps/verify_student/views.py
View file @
ff472e16
...
...
@@ -2,15 +2,21 @@
"""
import
json
from
mitxmako.shortcuts
import
render_to_response
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.http
import
HttpResponse
from
django.shortcuts
import
redirect
from
django.views.generic.base
import
View
from
course_modes.models
import
CourseMode
from
student.models
import
CourseEnrollment
from
student.views
import
course_from_id
from
shoppingcart.models
import
Order
,
CertificateItem
from
shoppingcart.processors.CyberSource
import
get_signed_purchase_params
from
verify_student.models
import
SoftwareSecurePhotoVerification
class
VerifyView
(
View
):
...
...
@@ -29,21 +35,32 @@ class VerifyView(View):
# bookkeeping-wise just to start over.
progress_state
=
"start"
course_id
=
request
.
GET
[
'course_id'
]
context
=
{
"progress_state"
:
progress_state
,
"user_full_name"
:
request
.
user
.
profile
.
name
,
"course_name"
:
course_from_id
(
request
.
GET
[
'course_id'
])
.
display_name
"course_id"
:
course_id
,
"course_name"
:
course_from_id
(
course_id
)
.
display_name
}
return
render_to_response
(
'verify_student/photo_verification.html'
,
context
)
def
post
(
request
):
def
create_order
(
request
):
attempt
=
SoftwareSecurePhotoVerification
(
user
=
request
.
user
)
attempt
.
status
=
"pending"
attempt
.
save
()
course_id
=
request
.
POST
[
'course_id'
]
# I know, we should check this is valid. All kinds of stuff missing here
# enrollment = CourseEnrollment.create_enrollment(request.user, course_id)
cart
=
Order
.
get_cart_for_user
(
request
.
user
)
CertificateItem
.
add_to_order
(
cart
,
course_id
,
30
,
'verified'
)
params
=
get_signed_purchase_params
(
cart
)
return
HttpResponse
(
json
.
dumps
(
params
),
content_type
=
"text/json"
)
def
show_requirements
(
request
):
...
...
lms/templates/verify_student/photo_verification.html
View file @
ff472e16
...
...
@@ -264,9 +264,10 @@
<div
class=
"actions"
>
<ul>
<li
class=
"action action-next"
>
<form
method=
"post"
>
<form
method=
"post"
action=
"create_order"
>
<!-- <a href="#">Go to Step 4: Secure Payment</a> -->
<input
type=
"hidden"
name=
"csrfmiddlewaretoken"
value=
"${ csrf_token }"
>
<input
type=
"hidden"
name=
"course_id"
value=
"${course_id | h}"
/>
<input
type=
"submit"
value=
"Go to Step 4"
name=
"payment"
>
</form>
<p
class=
"tips"
>
Once you verify your details match the requirements, you can move on to step 4, payment on our secure server.
</p>
...
...
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