Skip to content

Commit

Permalink
chore: remove deprecated ENTERPRISE_SUBSIDY_AUTOMATIC_EXTERNAL_CANCEL…
Browse files Browse the repository at this point in the history
…LATION

This setting is True in all internal environments now.
  • Loading branch information
pwnage101 committed Sep 6, 2024
1 parent ce225c5 commit 64f7ec7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
13 changes: 0 additions & 13 deletions enterprise_subsidy/apps/transaction/signals/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,6 @@ def handle_lc_enrollment_revoked(**kwargs):
f"Writing Reversal for Transaction: {related_transaction}."
)

# On initial release we are only supporting learner initiated unenrollments for OCM courses.
# OCM courses are identified by the lack of an external_reference on the Transaction object.
# Externally referenced transactions can be unenrolled through the Django admin actions related to the
# Transaction model.
automatic_external_cancellation = getattr(settings, "ENTERPRISE_SUBSIDY_AUTOMATIC_EXTERNAL_CANCELLATION", False)
if related_transaction.external_reference.exists() and not automatic_external_cancellation:
logger.info(
f"Found unenrolled enterprise fulfillment: {fulfillment_uuid} related to "
f"an externally referenced transaction: {related_transaction.external_reference.first()}. "
f"Skipping ENTERPRISE_SUBSIDY_AUTOMATIC_EXTERNAL_CANCELLATION={automatic_external_cancellation}."
)
return

# NOTE: get_content_metadata() is backed by TieredCache, so this would be performant if a bunch learners unenroll
# from the same course at the same time. However, normally no two learners in the same course would unenroll within
# a single cache timeout period, so we'd expect this to normally always re-fetch from remote API. That's OK because
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ def test_transaction_reversed_signal_without_fulfillment_identifier(
@mock.patch('enterprise_subsidy.apps.transaction.signals.handlers.reverse_transaction')
@mock.patch('enterprise_subsidy.apps.transaction.signals.handlers.unenrollment_can_be_refunded')
@mock.patch('enterprise_subsidy.apps.transaction.signals.handlers.ContentMetadataApi.get_content_metadata')
@override_settings(ENTERPRISE_SUBSIDY_AUTOMATIC_EXTERNAL_CANCELLATION=True)
def test_handle_lc_enrollment_revoked(
self,
mock_get_content_metadata,
Expand Down

0 comments on commit 64f7ec7

Please sign in to comment.