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
77ee243e
Commit
77ee243e
authored
Aug 19, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some cleanup fixes to get verified certs working.
parent
d6e777bc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
20 deletions
+21
-20
lms/djangoapps/shoppingcart/models.py
+19
-13
lms/djangoapps/shoppingcart/views.py
+2
-7
No files found.
lms/djangoapps/shoppingcart/models.py
View file @
77ee243e
...
@@ -61,6 +61,12 @@ class Order(models.Model):
...
@@ -61,6 +61,12 @@ class Order(models.Model):
else
:
else
:
return
items
[
0
]
.
currency
return
items
[
0
]
.
currency
def
clear
(
self
):
"""
Clear out all the items in the cart
"""
self
.
orderitem_set
.
all
()
.
delete
()
def
purchase
(
self
,
first
=
''
,
last
=
''
,
street1
=
''
,
street2
=
''
,
city
=
''
,
state
=
''
,
postalcode
=
''
,
def
purchase
(
self
,
first
=
''
,
last
=
''
,
street1
=
''
,
street2
=
''
,
city
=
''
,
state
=
''
,
postalcode
=
''
,
country
=
''
,
ccnum
=
''
,
cardtype
=
''
,
processor_reply_dump
=
''
):
country
=
''
,
ccnum
=
''
,
cardtype
=
''
,
processor_reply_dump
=
''
):
"""
"""
...
@@ -208,15 +214,6 @@ class PaidCourseRegistration(OrderItem):
...
@@ -208,15 +214,6 @@ class PaidCourseRegistration(OrderItem):
"run:{0}"
.
format
(
run
)])
"run:{0}"
.
format
(
run
)])
# Each entry is a dictionary of ModelName: 'lower_case_model_name'
# See https://docs.djangoproject.com/en/1.4/topics/db/models/#multi-table-inheritance for
# PLEASE KEEP THIS LIST UP_TO_DATE WITH THE SUBCLASSES OF OrderItem
ORDER_ITEM_SUBTYPES
=
{
PaidCourseRegistration
:
'paidcourseregistration'
,
VerifiedCertificate
:
'verifiedcertificate'
,
}
class
VerifiedCertificate
(
OrderItem
):
class
VerifiedCertificate
(
OrderItem
):
"""
"""
This is an inventory item for purchasing verified certificates
This is an inventory item for purchasing verified certificates
...
@@ -229,8 +226,6 @@ class VerifiedCertificate(OrderItem):
...
@@ -229,8 +226,6 @@ class VerifiedCertificate(OrderItem):
"""
"""
Add a VerifiedCertificate item to an order
Add a VerifiedCertificate item to an order
"""
"""
# TODO: add the basic enrollment
# TODO: error checking
course_enrollment
=
CourseEnrollment
.
create_enrollment
(
order
.
user
,
course_id
,
mode
=
"verified"
)
course_enrollment
=
CourseEnrollment
.
create_enrollment
(
order
.
user
,
course_id
,
mode
=
"verified"
)
item
,
_created
=
cls
.
objects
.
get_or_create
(
item
,
_created
=
cls
.
objects
.
get_or_create
(
order
=
order
,
order
=
order
,
...
@@ -248,5 +243,16 @@ class VerifiedCertificate(OrderItem):
...
@@ -248,5 +243,16 @@ class VerifiedCertificate(OrderItem):
return
item
return
item
def
purchased_callback
(
self
):
def
purchased_callback
(
self
):
# TODO: add code around putting student in the verified track
"""
pass
When purchase goes through, activate the course enrollment
"""
self
.
course_enrollment
.
activate
()
# Each entry is a dictionary of ModelName: 'lower_case_model_name'
# See https://docs.djangoproject.com/en/1.4/topics/db/models/#multi-table-inheritance for
# PLEASE KEEP THIS LIST UP_TO_DATE WITH THE SUBCLASSES OF OrderItem
ORDER_ITEM_SUBTYPES
=
{
PaidCourseRegistration
:
'paidcourseregistration'
,
VerifiedCertificate
:
'verifiedcertificate'
,
}
lms/djangoapps/shoppingcart/views.py
View file @
77ee243e
...
@@ -57,7 +57,7 @@ def show_cart(request):
...
@@ -57,7 +57,7 @@ def show_cart(request):
@login_required
@login_required
def
clear_cart
(
request
):
def
clear_cart
(
request
):
cart
=
Order
.
get_cart_for_user
(
request
.
user
)
cart
=
Order
.
get_cart_for_user
(
request
.
user
)
cart
.
orderitem_set
.
all
()
.
delete
()
cart
.
clear
()
return
HttpResponse
(
'Cleared'
)
return
HttpResponse
(
'Cleared'
)
@login_required
@login_required
...
@@ -89,7 +89,7 @@ def postpay_callback(request):
...
@@ -89,7 +89,7 @@ def postpay_callback(request):
return
render_to_response
(
'shoppingcart.processor_error.html'
,
{
'order'
:
result
[
'order'
],
return
render_to_response
(
'shoppingcart.processor_error.html'
,
{
'order'
:
result
[
'order'
],
'error_html'
:
result
[
'error_html'
]})
'error_html'
:
result
[
'error_html'
]})
@login_required
def
show_receipt
(
request
,
ordernum
):
def
show_receipt
(
request
,
ordernum
):
"""
"""
Displays a receipt for a particular order.
Displays a receipt for a particular order.
...
@@ -108,8 +108,3 @@ def show_receipt(request, ordernum):
...
@@ -108,8 +108,3 @@ def show_receipt(request, ordernum):
return
render_to_response
(
'shoppingcart/receipt.html'
,
{
'order'
:
order
,
return
render_to_response
(
'shoppingcart/receipt.html'
,
{
'order'
:
order
,
'order_items'
:
order_items
,
'order_items'
:
order_items
,
'any_refunds'
:
any_refunds
})
'any_refunds'
:
any_refunds
})
#def show_orders(request):
"""
Displays all orders of a user
"""
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