Implement student-initiated refunds for external commerce service.

XCOM-306
This commit is contained in:
jsa
2015-05-20 12:09:05 -04:00
parent 7eecfd89f9
commit 3dede202f1
5 changed files with 382 additions and 0 deletions

View File

@@ -13,7 +13,19 @@ def create_tracking_context(user):
}
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)
def ecommerce_api_client(user):
""" Returns an E-Commerce API client setup with authentication for the specified user. """
return EcommerceApiClient(settings.ECOMMERCE_API_URL, settings.ECOMMERCE_API_SIGNING_KEY, user.username,
user.profile.name, user.email, tracking_context=create_tracking_context(user))
# this is here to support registering the signals in signals.py
from commerce import signals # pylint: disable=unused-import