Commit 5adf6fec by Matt Drayer

Merge pull request #12252 from edx/mattdrayer/microsite-override-ecommerce-api

mattdrayer: Add microsite settings overrides
parents ae52b9c4 fdd045b1
......@@ -3,6 +3,8 @@ from django.conf import settings
from edx_rest_api_client.client import EdxRestApiClient
from eventtracking import tracker
from openedx.core.djangoapps.theming import helpers
ECOMMERCE_DATE_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
......@@ -23,14 +25,16 @@ def is_commerce_service_configured():
Return a Boolean indicating whether or not configuration is present to use
the external commerce service.
"""
return bool(settings.ECOMMERCE_API_URL and settings.ECOMMERCE_API_SIGNING_KEY)
ecommerce_api_url = helpers.get_value("ECOMMERCE_API_URL", settings.ECOMMERCE_API_URL)
ecommerce_api_signing_key = helpers.get_value("ECOMMERCE_API_SIGNING_KEY", settings.ECOMMERCE_API_SIGNING_KEY)
return bool(ecommerce_api_url and ecommerce_api_signing_key)
def ecommerce_api_client(user):
""" Returns an E-Commerce API client setup with authentication for the specified user. """
return EdxRestApiClient(
settings.ECOMMERCE_API_URL,
settings.ECOMMERCE_API_SIGNING_KEY,
helpers.get_value("ECOMMERCE_API_URL", settings.ECOMMERCE_API_URL),
helpers.get_value("ECOMMERCE_API_SIGNING_KEY", settings.ECOMMERCE_API_SIGNING_KEY),
user.username,
user.profile.name if hasattr(user, 'profile') else None,
user.email,
......
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