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
c8b5dc06
Commit
c8b5dc06
authored
Apr 24, 2017
by
Michael Frey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only use ecommerce hosted receipt page
LEANER-616
parent
85d05558
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
29 deletions
+26
-29
lms/djangoapps/commerce/migrations/0006_auto_20170424_1734.py
+19
-0
lms/djangoapps/commerce/models.py
+3
-1
lms/djangoapps/commerce/tests/test_utils.py
+2
-23
lms/djangoapps/commerce/utils.py
+1
-4
lms/djangoapps/student_account/test/test_views.py
+1
-1
No files found.
lms/djangoapps/commerce/migrations/0006_auto_20170424_1734.py
0 → 100644
View file @
c8b5dc06
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'commerce'
,
'0005_commerceconfiguration_enable_automatic_refund_approval'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'commerceconfiguration'
,
name
=
'receipt_page'
,
field
=
models
.
CharField
(
default
=
b
'/checkout/receipt/?order_number='
,
help_text
=
'Path to order receipt page.'
,
max_length
=
255
),
),
]
lms/djangoapps/commerce/models.py
View file @
c8b5dc06
...
...
@@ -15,7 +15,7 @@ class CommerceConfiguration(ConfigurationModel):
API_NAME
=
'commerce'
CACHE_KEY
=
'commerce.api.data'
DEFAULT_RECEIPT_PAGE_URL
=
'/c
ommerce/checkout/receipt/?orderNum
='
DEFAULT_RECEIPT_PAGE_URL
=
'/c
heckout/receipt/?order_number
='
checkout_on_ecommerce_service
=
models
.
BooleanField
(
default
=
False
,
...
...
@@ -34,6 +34,8 @@ class CommerceConfiguration(ConfigurationModel):
'Specified in seconds. Enable caching by setting this to a value greater than 0.'
)
)
# receipt_page no longer used but remains in the model until we can purge old data.
# removing this will casue 500 errors when trying to access the Django admin.
receipt_page
=
models
.
CharField
(
max_length
=
255
,
default
=
DEFAULT_RECEIPT_PAGE_URL
,
...
...
lms/djangoapps/commerce/tests/test_utils.py
View file @
c8b5dc06
...
...
@@ -11,16 +11,11 @@ from openedx.core.lib.log_utils import audit_log
from
openedx.core.djangoapps.site_configuration.tests.test_util
import
with_site_configuration
from
student.tests.factories
import
UserFactory
TEST_SITE_CONFIGURATION
=
{
'ECOMMERCE_RECEIPT_PAGE_URL'
:
'/checkout/receipt/?order_number='
}
def
update_commerce_config
(
enabled
=
False
,
checkout_page
=
'/test_basket/'
,
receipt_page
=
'/checkout/receipt/'
):
def
update_commerce_config
(
enabled
=
False
,
checkout_page
=
'/test_basket/'
):
""" Enable / Disable CommerceConfiguration model """
CommerceConfiguration
.
objects
.
create
(
checkout_on_ecommerce_service
=
enabled
,
receipt_page
=
receipt_page
,
single_course_checkout_page
=
checkout_page
,
)
...
...
@@ -83,7 +78,7 @@ class EcommerceServiceTests(TestCase):
"""Verify that the proper Receipt page URL is returned."""
order_number
=
'ORDER1'
url
=
EcommerceService
()
.
get_receipt_page_url
(
order_number
)
expected_url
=
'
/checkout/receipt/
{}'
.
format
(
order_number
)
expected_url
=
'
http://ecommerce_url/checkout/receipt/?order_number=
{}'
.
format
(
order_number
)
self
.
assertEqual
(
url
,
expected_url
)
@override_settings
(
ECOMMERCE_PUBLIC_URL_ROOT
=
'http://ecommerce_url'
)
...
...
@@ -92,19 +87,3 @@ class EcommerceServiceTests(TestCase):
url
=
EcommerceService
()
.
checkout_page_url
(
self
.
SKU
)
expected_url
=
'http://ecommerce_url/test_basket/?sku={}'
.
format
(
self
.
SKU
)
self
.
assertEqual
(
url
,
expected_url
)
@override_settings
(
ECOMMERCE_PUBLIC_URL_ROOT
=
'http://ecommerce_url'
)
@with_site_configuration
(
configuration
=
TEST_SITE_CONFIGURATION
)
def
test_get_receipt_page_url_with_site_configuration
(
self
):
order_number
=
'ORDER1'
config
=
CommerceConfiguration
.
current
()
config
.
use_ecommerce_receipt_page
=
True
config
.
save
()
receipt_page_url
=
EcommerceService
()
.
get_receipt_page_url
(
order_number
)
expected_url
=
'{ecommerce_root}{receipt_page_url}{order_number}'
.
format
(
ecommerce_root
=
settings
.
ECOMMERCE_PUBLIC_URL_ROOT
,
order_number
=
order_number
,
receipt_page_url
=
TEST_SITE_CONFIGURATION
[
'ECOMMERCE_RECEIPT_PAGE_URL'
]
)
self
.
assertEqual
(
receipt_page_url
,
expected_url
)
lms/djangoapps/commerce/utils.py
View file @
c8b5dc06
...
...
@@ -38,11 +38,8 @@ class EcommerceService(object):
Returns:
Receipt page for the specified Order.
"""
ecommerce_receipt_page_url
=
configuration_helpers
.
get_value
(
'ECOMMERCE_RECEIPT_PAGE_URL'
)
if
ecommerce_receipt_page_url
:
return
self
.
get_absolute_ecommerce_url
(
ecommerce_receipt_page_url
+
order_number
)
return
self
.
config
.
receipt_page
+
order_number
return
self
.
get_absolute_ecommerce_url
(
CommerceConfiguration
.
DEFAULT_RECEIPT_PAGE_URL
+
order_number
)
def
is_enabled
(
self
,
user
):
"""
...
...
lms/djangoapps/student_account/test/test_views.py
View file @
c8b5dc06
...
...
@@ -645,7 +645,7 @@ class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase, ProgramsApiConf
'number'
:
order
[
'number'
],
'price'
:
order
[
'total_excl_tax'
],
'order_date'
:
'Jan 01, 2016'
,
'receipt_url'
:
'/c
ommerce/checkout/receipt/?orderNum
='
+
order
[
'number'
],
'receipt_url'
:
'/c
heckout/receipt/?order_number
='
+
order
[
'number'
],
'lines'
:
order
[
'lines'
],
}
self
.
assertEqual
(
order_detail
[
i
],
expected
)
...
...
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