Skip to content

feat: replace enterprise_support import with DiscountEligibilityCheckRequested filter#349

Open
marlonkeating wants to merge 2 commits into
release-ulmofrom
pwnage101/ENT-11564-mirror
Open

feat: replace enterprise_support import with DiscountEligibilityCheckRequested filter#349
marlonkeating wants to merge 2 commits into
release-ulmofrom
pwnage101/ENT-11564-mirror

Conversation

@marlonkeating

Copy link
Copy Markdown

release-ulmo companion PR of openedx#38099

Description

Describe what this pull request changes, and why. Include implications for people using this change.
Design decisions and their rationales should be documented in the repo (docstring / ADR), per
OEP-19, and can be
linked here.

Useful information to include:

  • Which edX user roles will this change impact? Common user roles are "Learner", "Course Author",
    "Developer", and "Operator".
  • Include screenshots for changes to the UI (ideally, both "before" and "after" screenshots, if applicable).
  • Provide links to the description of corresponding configuration changes. Remember to correctly annotate these
    changes.

Supporting information

Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions.
Be sure to check they are publicly readable, or if not, repeat the information here.

Testing instructions

Please provide detailed step-by-step instructions for testing this change.

Deadline

"None" if there's no rush, or provide a specific date or event (and reason) if there is one.

Other information

Include anything else that will help reviewers and consumers understand the change.

  • Does this change depend on other changes elsewhere?
  • Any special concerns or limitations? For example: deprecations, migrations, security, or accessibility.
  • If your database migration can't be rolled back easily.

pwnage101 and others added 2 commits June 11, 2026 16:51
…Requested filter

Removes direct lazy imports of is_enterprise_learner from
openedx.features.enterprise_support.utils in applicability.py and
replaces them with calls to the DiscountEligibilityCheckRequested
openedx-filter. Adds the filter to OPEN_EDX_FILTERS_CONFIG with the
DiscountEligibilityStep pipeline step. Updates tests to mock the filter
instead of using enterprise model factories.

ENT-11564

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 12, 2026 20:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR replaces the direct enterprise eligibility check in the discounts applicability logic with the DiscountEligibilityCheckRequested openedx-filters pipeline, and updates LMS settings/tests to support the new filter-driven behavior.

Changes:

  • Switch discount eligibility gating (can_receive_discount, can_show_streak_discount_coupon) from enterprise_support to DiscountEligibilityCheckRequested.run_filter(...).
  • Update discount applicability tests to patch the new filter and validate ineligibility behavior.
  • Introduce an OPEN_EDX_FILTERS_CONFIG default entry wiring the discount eligibility filter to an enterprise pipeline step.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
openedx/features/discounts/applicability.py Replaces enterprise-specific logic with a filter hook to allow pluggable eligibility decisions.
openedx/features/discounts/tests/test_applicability.py Updates tests to patch/drive the new filter-based eligibility behavior.
lms/envs/common.py Adds default openedx-filters configuration for the discount eligibility filter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


from datetime import datetime, timedelta
from unittest.mock import Mock, patch
from zoneinfo import ZoneInfo
Comment thread lms/envs/common.py
Comment on lines +3819 to +3824
# .. setting_name: OPEN_EDX_FILTERS_CONFIG
# .. setting_default: {}
# .. setting_description: Configuration dict for openedx-filters pipeline steps.
# Keys are filter type strings; values are dicts with 'fail_silently' (bool) and
# 'pipeline' (list of dotted-path strings to PipelineStep subclasses).
OPEN_EDX_FILTERS_CONFIG = {
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