Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

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

Closed
wants to merge 3 commits into 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
Contributor

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.

@feanil feanil closed this Nov 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants