From 64f7ec7a0f6f9dd4a508058462426f8ff997ef8d Mon Sep 17 00:00:00 2001 From: Troy Sankey Date: Fri, 6 Sep 2024 09:52:48 -0700 Subject: [PATCH] chore: remove deprecated ENTERPRISE_SUBSIDY_AUTOMATIC_EXTERNAL_CANCELLATION This setting is True in all internal environments now. --- .../apps/transaction/signals/handlers.py | 13 ------------- .../apps/transaction/tests/test_signal_handlers.py | 1 - 2 files changed, 14 deletions(-) diff --git a/enterprise_subsidy/apps/transaction/signals/handlers.py b/enterprise_subsidy/apps/transaction/signals/handlers.py index e656f20c..91826a0b 100644 --- a/enterprise_subsidy/apps/transaction/signals/handlers.py +++ b/enterprise_subsidy/apps/transaction/signals/handlers.py @@ -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 diff --git a/enterprise_subsidy/apps/transaction/tests/test_signal_handlers.py b/enterprise_subsidy/apps/transaction/tests/test_signal_handlers.py index 214dd5ae..fb2be4e5 100644 --- a/enterprise_subsidy/apps/transaction/tests/test_signal_handlers.py +++ b/enterprise_subsidy/apps/transaction/tests/test_signal_handlers.py @@ -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,