Commit 000ad0a3 by Matt Drayer

mattdrayer/theme-ecommerce-url: Add theme support for ECOMMERCE_PUBLIC_URL_ROOT setting

parent 0ad9eb91
...@@ -16,6 +16,7 @@ from microsite_configuration import microsite ...@@ -16,6 +16,7 @@ from microsite_configuration import microsite
from request_cache.middleware import RequestCache from request_cache.middleware import RequestCache
from student.models import UNENROLL_DONE from student.models import UNENROLL_DONE
from openedx.core.djangoapps.commerce.utils import ecommerce_api_client, is_commerce_service_configured from openedx.core.djangoapps.commerce.utils import ecommerce_api_client, is_commerce_service_configured
from openedx.core.djangoapps.theming.helpers import get_value
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -196,7 +197,8 @@ def generate_refund_notification_body(student, refund_ids): # pylint: disable=i ...@@ -196,7 +197,8 @@ def generate_refund_notification_body(student, refund_ids): # pylint: disable=i
"To process this request, please visit the link(s) below." "To process this request, please visit the link(s) below."
).format(username=student.username, email=student.email) ).format(username=student.username, email=student.email)
refund_urls = [urljoin(settings.ECOMMERCE_PUBLIC_URL_ROOT, '/dashboard/refunds/{}/'.format(refund_id)) ecommerce_url_root = get_value('ECOMMERCE_PUBLIC_URL_ROOT', settings.ECOMMERCE_PUBLIC_URL_ROOT)
refund_urls = [urljoin(ecommerce_url_root, '/dashboard/refunds/{}/'.format(refund_id))
for refund_id in refund_ids] for refund_id in refund_ids]
return '{msg}\n\n{urls}'.format(msg=msg, urls='\n'.join(refund_urls)) return '{msg}\n\n{urls}'.format(msg=msg, urls='\n'.join(refund_urls))
......
...@@ -55,7 +55,8 @@ class EcommerceService(object): ...@@ -55,7 +55,8 @@ class EcommerceService(object):
Example: Example:
http://localhost:8002/basket/single_item/ http://localhost:8002/basket/single_item/
""" """
return urljoin(settings.ECOMMERCE_PUBLIC_URL_ROOT, self.config.single_course_checkout_page) ecommerce_url_root = helpers.get_value('ECOMMERCE_PUBLIC_URL_ROOT', settings.ECOMMERCE_PUBLIC_URL_ROOT)
return urljoin(ecommerce_url_root, self.config.single_course_checkout_page)
def checkout_page_url(self, sku): def checkout_page_url(self, sku):
""" Construct the URL to the ecommerce checkout page and include a product. """ Construct the URL to the ecommerce checkout page and include a product.
......
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
credit_msg_class = "credit-eligibility-msg" credit_msg_class = "credit-eligibility-msg"
credit_btn_class = "purchase-credit-btn" credit_btn_class = "purchase-credit-btn"
credit_btn_label = _("Get Credit") credit_btn_label = _("Get Credit")
ecommerce_url_root = static.get_value('ECOMMERCE_PUBLIC_URL_ROOT', settings.ECOMMERCE_PUBLIC_URL_ROOT)
credit_btn_href = '{root}/credit/checkout/{course_id}/'.format( credit_btn_href = '{root}/credit/checkout/{course_id}/'.format(
root=settings.ECOMMERCE_PUBLIC_URL_ROOT, root=ecommerce_url_root,
course_id=credit_status['course_key']) course_id=credit_status['course_key'])
if credit_status["purchased"]: if credit_status["purchased"]:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment