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
31402705
Commit
31402705
authored
Sep 19, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1040 from edx/diana/no-ordering-twice
Don't try to purchase the same order twice
parents
2f001041
67af3d5c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletions
+10
-1
lms/djangoapps/shoppingcart/models.py
+2
-0
lms/djangoapps/shoppingcart/tests/test_models.py
+8
-1
No files found.
lms/djangoapps/shoppingcart/models.py
View file @
31402705
...
...
@@ -105,6 +105,8 @@ class Order(models.Model):
`processor_reply_dump` - all the parameters returned by the processor
"""
if
self
.
status
==
'purchased'
:
return
self
.
status
=
'purchased'
self
.
purchase_time
=
datetime
.
now
(
pytz
.
utc
)
self
.
bill_to_first
=
first
...
...
lms/djangoapps/shoppingcart/tests/test_models.py
View file @
31402705
...
...
@@ -103,6 +103,14 @@ class OrderTest(ModuleStoreTestCase):
# verify that e-mail wasn't sent
self
.
assertEquals
(
len
(
mail
.
outbox
),
0
)
def
test_purchase_twice
(
self
):
cart
=
Order
.
get_cart_for_user
(
self
.
user
)
CertificateItem
.
add_to_order
(
cart
,
self
.
course_id
,
self
.
cost
,
'honor'
)
# purchase the cart more than once
cart
.
purchase
()
cart
.
purchase
()
self
.
assertEquals
(
len
(
mail
.
outbox
),
1
)
def
purchase_with_data
(
self
,
cart
):
""" purchase a cart with billing information """
CertificateItem
.
add_to_order
(
cart
,
self
.
course_id
,
self
.
cost
,
'honor'
)
...
...
@@ -137,7 +145,6 @@ class OrderTest(ModuleStoreTestCase):
@patch.dict
(
settings
.
MITX_FEATURES
,
{
'STORE_BILLING_INFO'
:
False
})
def
test_billing_info_storage_off
(
self
):
cart
=
Order
.
get_cart_for_user
(
self
.
user
)
cart
=
Order
.
get_cart_for_user
(
self
.
user
)
self
.
purchase_with_data
(
cart
)
self
.
assertNotEqual
(
cart
.
bill_to_first
,
''
)
self
.
assertNotEqual
(
cart
.
bill_to_last
,
''
)
...
...
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