diff --git a/common/djangoapps/entitlements/models.py b/common/djangoapps/entitlements/models.py index bac3255cba..d69035e5a9 100644 --- a/common/djangoapps/entitlements/models.py +++ b/common/djangoapps/entitlements/models.py @@ -464,3 +464,17 @@ class CourseEntitlementSupportDetail(TimeStampedModel): self.support_user, self.reason, ) + + @classmethod + def get_support_actions_list(cls): + """ + Method for retrieving a serializable version of the entitlement support reasons + + Returns + list: Containing the possible support actions + """ + return [ + action[0] # get just the action code, not the human readable description. + for action + in cls.ENTITLEMENT_SUPPORT_ACTIONS + ] diff --git a/lms/djangoapps/commerce/models.py b/lms/djangoapps/commerce/models.py index cedb50799c..72c9fcfb51 100644 --- a/lms/djangoapps/commerce/models.py +++ b/lms/djangoapps/commerce/models.py @@ -15,6 +15,7 @@ class CommerceConfiguration(ConfigurationModel): API_NAME = 'commerce' CACHE_KEY = 'commerce.api.data' DEFAULT_RECEIPT_PAGE_URL = '/checkout/receipt/?order_number=' + DEFAULT_ORDER_DASHBOARD_URL = '/dashboard/orders/' MULTIPLE_ITEMS_BASKET_PAGE_URL = '/basket/add/' checkout_on_ecommerce_service = models.BooleanField( diff --git a/lms/djangoapps/commerce/tests/test_utils.py b/lms/djangoapps/commerce/tests/test_utils.py index 092fe80764..6cec81bc0d 100644 --- a/lms/djangoapps/commerce/tests/test_utils.py +++ b/lms/djangoapps/commerce/tests/test_utils.py @@ -102,6 +102,13 @@ class EcommerceServiceTests(TestCase): 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') + def test_get_order_dashboard_url(self): + """Verify that the proper order dashboard url is returned.""" + url = EcommerceService().get_order_dashboard_url() + expected_url = 'http://ecommerce_url/dashboard/orders/' + self.assertEqual(url, expected_url) + @override_settings(ECOMMERCE_PUBLIC_URL_ROOT='http://ecommerce_url') @ddt.data(['TESTSKU'], ['TESTSKU1', 'TESTSKU2', 'TESTSKU3']) def test_get_checkout_page_url(self, skus): diff --git a/lms/djangoapps/commerce/utils.py b/lms/djangoapps/commerce/utils.py index e4bcddde99..083c2d3eec 100644 --- a/lms/djangoapps/commerce/utils.py +++ b/lms/djangoapps/commerce/utils.py @@ -55,6 +55,14 @@ class EcommerceService(object): """ return urljoin(self.ecommerce_url_root, ecommerce_page_url) + def get_order_dashboard_url(self): + """ Return the URL to the ecommerce dashboard orders page. + + Returns: + String: order dashboard url. + """ + return self.get_absolute_ecommerce_url(CommerceConfiguration.DEFAULT_ORDER_DASHBOARD_URL) + def get_receipt_page_url(self, order_number): """ Gets the URL for the Order Receipt page hosted by the ecommerce service.