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

refactor: remove ENABLE_TAXES_DISPLAY feature flag #3354

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

Conversation

asadali145
Copy link
Contributor

@asadali145 asadali145 commented Jan 3, 2025

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/6369

Description (What does it do?)

Removes ENABLE_TAXES_DISPLAY feature flag.

How can this be tested?

  • Enable ECOMMERCE_FORCE_PROFILE_COUNTRY and add TaxRate for your profile country in the admin.
  • Checkout any product and see that taxes are displayed and applied at the checkout, email receipt and dashboard receipt.
  • Now disable the tax rate and see that taxes are not visible.

@pdpinch
Copy link
Member

pdpinch commented Jan 3, 2025 via email

@asadali145
Copy link
Contributor Author

@cachob I am going to remove the feature flag ENABLE_TAXES_DISPLAY as per Peter's suggestion.

@arslanashraf7
Copy link
Contributor

I don't think there's any reason to keep this feature flag. The feature has been deployed, and there's no reason why we would turn it off (at least not in RC and production deployments).

@pdpinch could you take a look at the other subtasks in https://github.com/mitodl/hq/issues/5825 and let us know what other flags are not needed?

@pdpinch
Copy link
Member

pdpinch commented Jan 3, 2025

@pdpinch could you take a look at the other subtasks in https://github.com/mitodl/hq/issues/5825 and let us know what other flags are not needed?

See https://github.com/mitodl/hq/issues/5825#issuecomment-2436216514

If the flag is currently True in production, we should plan to remove it. I would only consider keeping these flags if they are significantly valuable for developers. Otherwise, they are just tech debt.

@arslanashraf7
Copy link
Contributor

See https://github.com/mitodl/hq/issues/5825#issuecomment-2436216514

Wow. Sorry, I missed that.

@asadali145 asadali145 changed the title refactor: migrate ENABLE_TAXES_DISPLAY to posthog refactor: remove ENABLE_TAXES_DISPLAY feature flag Jan 6, 2025
@asadali145
Copy link
Contributor Author

@arslanashraf7 This is good to review. I have removed the usage of ENABLE_TAXES_DISPLAY.

@arslanashraf7 arslanashraf7 self-assigned this Jan 6, 2025
Copy link
Contributor

@arslanashraf7 arslanashraf7 left a comment

Choose a reason for hiding this comment

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

I've requested some minor changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

extra file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kept it intentionally for the features that we will move to posthog. It is similar to mitxonline https://github.com/mitodl/mitxonline/blob/main/main/features.py

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. But it doesn't make sense to add it to this PR as this is out of context for this PR. We should add this with a PR that migrates the first feature flag.

@@ -494,7 +495,7 @@ def test_get_js_settings(settings, rf, user):
"digital_credentials_supported_runs": settings.DIGITAL_CREDENTIALS_SUPPORTED_RUNS,
"course_dropdown": settings.FEATURES.get("COURSE_DROPDOWN", False),
"webinars": settings.FEATURES.get("WEBINARS", False),
"enable_taxes_display": settings.FEATURES.get("ENABLE_TAXES_DISPLAY", False),
"enable_taxes_display": display_taxes(request),
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: enable_taxes_display gives a sense of a feature flag somewhere, for more readability we should change its name as well.

NOTE: This will require changes in various other places as this name is used in multiple locations. The logic isn't complex so this might be an easy name change.

As for the method name changes, We can go for has_tax_rate which is all we are going to check from now onwards.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I saw that and avoided extra changes and focused on the removal only. I can make these changes if you want.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is already a nit so It's up to you. I looked at the usages of this name and they looked straight forward and there were not too many. This is mostly for readability.

@@ -165,13 +165,10 @@ def display_taxes(request):
request(HttpRequest): Request object
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should write a test for this method if not already. Since we are not mocking it in different tests and if we add additional conditions in the future the mock would always stay true/false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is already a test for this in ecommerce/api_test.py named test_display_taxes.

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

Successfully merging this pull request may close these issues.

4 participants