Skip to content

Commit

Permalink
refactor: use settings value for discounts list
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Noyan Aziz authored and Muhammad Noyan Aziz committed Nov 27, 2024
1 parent 37ee470 commit f653ed8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 1 addition & 3 deletions commerce_coordinator/apps/commercetools/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
2 changes: 2 additions & 0 deletions commerce_coordinator/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down

0 comments on commit f653ed8

Please sign in to comment.