Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Embargo API fixed with new product type. #4034

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mobeenali12
Copy link

  • Added product type Course Entitlement to be checked by Embargo while adding to the bucket.
  • Fixed embargo API callback parameters.
  • Added dummy test string test_local_ip to bypass API checks for local testing.

@mobeenali12 mobeenali12 requested a review from a team as a code owner September 25, 2023 14:18
'user': user.username,
# ip variable is None when testing it locally, giving it dummy string "test_local_ip"
# just to bypass the API, otherwise API returns "Missing Parameters" response.
'ip_address': ip or "test_local_ip",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not have a test string hard coded here, especially if it's only for local testing. if we need behavior that varies whether you are in a local dev environment vs stage/prod, i recommend we instead use a config variable that, if true, will override what the ip variable with something that works. that way, we prevent a user from potentially spoofing the values in their context to trigger this test behavior

Copy link
Contributor

@christopappas christopappas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in addition to my inline comment, please update the unit tests to account for the change in the logic here 👍

product_class_name = product.get_product_class().name

# We are checking Seats & Course Entitlement
if product_class_name == SEAT_PRODUCT_CLASS_NAME or product_class_name == COURSE_ENTITLEMENT_PRODUCT_CLASS_NAME:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last time when I reported this issue I tried using the same fix but it didn't work since for course entitlement products we didn't have course attribute set on them and hence the code would raise attribute errors as far as I remember. I would recommend double checking the code by debugging it locally and testing all the scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants