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
85d05558
Commit
85d05558
authored
Apr 24, 2017
by
Michael Frey
Committed by
GitHub
Apr 24, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14948 from edx/revert-14939-mjfrey/LEARNER-616
Revert "Only use ecommerce hosted receipt page"
parents
73833e41
b2dcc9c4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
24 deletions
+34
-24
lms/djangoapps/commerce/migrations/0006_remove_commerceconfiguration_receipt_page.py
+0
-18
lms/djangoapps/commerce/models.py
+6
-0
lms/djangoapps/commerce/tests/test_utils.py
+23
-2
lms/djangoapps/commerce/utils.py
+4
-3
lms/djangoapps/student_account/test/test_views.py
+1
-1
No files found.
lms/djangoapps/commerce/migrations/0006_remove_commerceconfiguration_receipt_page.py
deleted
100644 → 0
View file @
73833e41
# -*- 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
.
RemoveField
(
model_name
=
'commerceconfiguration'
,
name
=
'receipt_page'
,
),
]
lms/djangoapps/commerce/models.py
View file @
85d05558
...
@@ -15,6 +15,7 @@ class CommerceConfiguration(ConfigurationModel):
...
@@ -15,6 +15,7 @@ class CommerceConfiguration(ConfigurationModel):
API_NAME
=
'commerce'
API_NAME
=
'commerce'
CACHE_KEY
=
'commerce.api.data'
CACHE_KEY
=
'commerce.api.data'
DEFAULT_RECEIPT_PAGE_URL
=
'/commerce/checkout/receipt/?orderNum='
checkout_on_ecommerce_service
=
models
.
BooleanField
(
checkout_on_ecommerce_service
=
models
.
BooleanField
(
default
=
False
,
default
=
False
,
...
@@ -33,6 +34,11 @@ class CommerceConfiguration(ConfigurationModel):
...
@@ -33,6 +34,11 @@ class CommerceConfiguration(ConfigurationModel):
'Specified in seconds. Enable caching by setting this to a value greater than 0.'
'Specified in seconds. Enable caching by setting this to a value greater than 0.'
)
)
)
)
receipt_page
=
models
.
CharField
(
max_length
=
255
,
default
=
DEFAULT_RECEIPT_PAGE_URL
,
help_text
=
_
(
'Path to order receipt page.'
)
)
enable_automatic_refund_approval
=
models
.
BooleanField
(
enable_automatic_refund_approval
=
models
.
BooleanField
(
default
=
True
,
default
=
True
,
help_text
=
_
(
'Automatically approve valid refund requests, without manual processing'
)
help_text
=
_
(
'Automatically approve valid refund requests, without manual processing'
)
...
...
lms/djangoapps/commerce/tests/test_utils.py
View file @
85d05558
...
@@ -11,11 +11,16 @@ from openedx.core.lib.log_utils import audit_log
...
@@ -11,11 +11,16 @@ from openedx.core.lib.log_utils import audit_log
from
openedx.core.djangoapps.site_configuration.tests.test_util
import
with_site_configuration
from
openedx.core.djangoapps.site_configuration.tests.test_util
import
with_site_configuration
from
student.tests.factories
import
UserFactory
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/'
):
def
update_commerce_config
(
enabled
=
False
,
checkout_page
=
'/test_basket/'
,
receipt_page
=
'/checkout/receipt/'
):
""" Enable / Disable CommerceConfiguration model """
""" Enable / Disable CommerceConfiguration model """
CommerceConfiguration
.
objects
.
create
(
CommerceConfiguration
.
objects
.
create
(
checkout_on_ecommerce_service
=
enabled
,
checkout_on_ecommerce_service
=
enabled
,
receipt_page
=
receipt_page
,
single_course_checkout_page
=
checkout_page
,
single_course_checkout_page
=
checkout_page
,
)
)
...
@@ -78,7 +83,7 @@ class EcommerceServiceTests(TestCase):
...
@@ -78,7 +83,7 @@ class EcommerceServiceTests(TestCase):
"""Verify that the proper Receipt page URL is returned."""
"""Verify that the proper Receipt page URL is returned."""
order_number
=
'ORDER1'
order_number
=
'ORDER1'
url
=
EcommerceService
()
.
get_receipt_page_url
(
order_number
)
url
=
EcommerceService
()
.
get_receipt_page_url
(
order_number
)
expected_url
=
'
http://ecommerce_url/checkout/receipt/?order_number=
{}'
.
format
(
order_number
)
expected_url
=
'
/checkout/receipt/
{}'
.
format
(
order_number
)
self
.
assertEqual
(
url
,
expected_url
)
self
.
assertEqual
(
url
,
expected_url
)
@override_settings
(
ECOMMERCE_PUBLIC_URL_ROOT
=
'http://ecommerce_url'
)
@override_settings
(
ECOMMERCE_PUBLIC_URL_ROOT
=
'http://ecommerce_url'
)
...
@@ -87,3 +92,19 @@ class EcommerceServiceTests(TestCase):
...
@@ -87,3 +92,19 @@ class EcommerceServiceTests(TestCase):
url
=
EcommerceService
()
.
checkout_page_url
(
self
.
SKU
)
url
=
EcommerceService
()
.
checkout_page_url
(
self
.
SKU
)
expected_url
=
'http://ecommerce_url/test_basket/?sku={}'
.
format
(
self
.
SKU
)
expected_url
=
'http://ecommerce_url/test_basket/?sku={}'
.
format
(
self
.
SKU
)
self
.
assertEqual
(
url
,
expected_url
)
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 @
85d05558
...
@@ -6,8 +6,6 @@ from django.conf import settings
...
@@ -6,8 +6,6 @@ from django.conf import settings
from
commerce.models
import
CommerceConfiguration
from
commerce.models
import
CommerceConfiguration
from
openedx.core.djangoapps.site_configuration
import
helpers
as
configuration_helpers
from
openedx.core.djangoapps.site_configuration
import
helpers
as
configuration_helpers
RECEIPT_PAGE_URL
=
'/checkout/receipt/?order_number='
class
EcommerceService
(
object
):
class
EcommerceService
(
object
):
""" Helper class for ecommerce service integration. """
""" Helper class for ecommerce service integration. """
...
@@ -40,8 +38,11 @@ class EcommerceService(object):
...
@@ -40,8 +38,11 @@ class EcommerceService(object):
Returns:
Returns:
Receipt page for the specified Order.
Receipt page for the specified Order.
"""
"""
ecommerce_receipt_page_url
=
configuration_helpers
.
get_value
(
'ECOMMERCE_RECEIPT_PAGE_URL'
)
return
self
.
get_absolute_ecommerce_url
(
RECEIPT_PAGE_URL
+
order_number
)
if
ecommerce_receipt_page_url
:
return
self
.
get_absolute_ecommerce_url
(
ecommerce_receipt_page_url
+
order_number
)
return
self
.
config
.
receipt_page
+
order_number
def
is_enabled
(
self
,
user
):
def
is_enabled
(
self
,
user
):
"""
"""
...
...
lms/djangoapps/student_account/test/test_views.py
View file @
85d05558
...
@@ -645,7 +645,7 @@ class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase, ProgramsApiConf
...
@@ -645,7 +645,7 @@ class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase, ProgramsApiConf
'number'
:
order
[
'number'
],
'number'
:
order
[
'number'
],
'price'
:
order
[
'total_excl_tax'
],
'price'
:
order
[
'total_excl_tax'
],
'order_date'
:
'Jan 01, 2016'
,
'order_date'
:
'Jan 01, 2016'
,
'receipt_url'
:
'/c
heckout/receipt/?order_number
='
+
order
[
'number'
],
'receipt_url'
:
'/c
ommerce/checkout/receipt/?orderNum
='
+
order
[
'number'
],
'lines'
:
order
[
'lines'
],
'lines'
:
order
[
'lines'
],
}
}
self
.
assertEqual
(
order_detail
[
i
],
expected
)
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