diff --git a/commerce_coordinator/apps/commercetools/clients.py b/commerce_coordinator/apps/commercetools/clients.py index 840d32fa..59969e86 100644 --- a/commerce_coordinator/apps/commercetools/clients.py +++ b/commerce_coordinator/apps/commercetools/clients.py @@ -611,12 +611,10 @@ def is_first_time_discount_eligible(self, email: str) -> bool: username (str): Username of the user Returns (bool): True if the user is eligible for a first time discount """ - FIRST_TIME_DISCOUNT_CODES = ['EDXWELCOME', 'NEW2EDX'] - try: discounts = self.base_client.discount_codes.query( where="code in :discountCodes", - predicate_var={'discountCodes': FIRST_TIME_DISCOUNT_CODES} + predicate_var={'discountCodes': settings.COMMERCETOOLS_FIRST_TIME_DISCOUNTS} ) discount_ids = [discount.id for discount in discounts.results] diff --git a/commerce_coordinator/settings/base.py b/commerce_coordinator/settings/base.py index a5aaa301..8b6e6bbd 100644 --- a/commerce_coordinator/settings/base.py +++ b/commerce_coordinator/settings/base.py @@ -460,6 +460,8 @@ def root(*path_fragments): # Checkout view urls COMMERCETOOLS_FRONTEND_URL = 'http://localhost:3000/SET-ME' +COMMERCETOOLS_FIRST_TIME_DISCOUNTS = ('EDXWELCOME', 'NEW2EDX') + COMMERCETOOLS_MERCHANT_CENTER_ORDERS_PAGE_URL = \ f'https://mc.{_COMMERCETOOLS_CONFIG_GEO}.commercetools.com/{COMMERCETOOLS_CONFIG["projectKey"]}/orders'