Skip to content

Commit 81bbedb

Browse files
Revert "fix: update payment page redirect for program (#326)"
This reverts commit ddf10ad.
1 parent cb89e52 commit 81bbedb

File tree

4 files changed

+5
-50
lines changed

4 files changed

+5
-50
lines changed

commerce_coordinator/apps/commercetools/clients.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -369,28 +369,6 @@ def get_payment_by_transaction_interaction_id(self, interaction_id: str) -> CTPa
369369
logger.info(f"[CommercetoolsAPIClient] - Attempting to find payment with interaction ID {interaction_id}")
370370
return self.base_client.payments.query(where=f'transactions(interactionId="{interaction_id}")').results[0]
371371

372-
def get_product_variant_by_program(self, product_id: str) -> Optional[CTProductVariant]:
373-
"""
374-
Fetches a program from Commercetools.
375-
Args:
376-
product_id: The ID of the program (bundle) to fetch.
377-
Returns:
378-
CTProductVariant if found, None otherwise.
379-
"""
380-
start_time = datetime.datetime.now()
381-
try:
382-
product_projection = self.base_client.product_projections.get_by_key(product_id)
383-
except CommercetoolsError as exc:
384-
logger.exception(
385-
f'[get_product_variant_by_program] Failed to get CT program for product_id: {product_id} '
386-
f'with exception: {exc}'
387-
)
388-
return None
389-
390-
duration = (datetime.datetime.now() - start_time).total_seconds()
391-
logger.info(f"[Performance Check] get_product_variant_by_program took {duration} seconds")
392-
return product_projection
393-
394372
def get_product_variant_by_course_run(self, cr_id: str) -> Optional[CTProductVariant]:
395373
"""
396374
Args:

commerce_coordinator/apps/lms/views.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
enrollment_attribute_key
3232
)
3333
from commerce_coordinator.apps.rollout.utils import is_legacy_order
34-
from commerce_coordinator.apps.rollout.waffle import is_program_redirection_to_ct_enabled
3534

3635
logger = logging.getLogger(__name__)
3736

@@ -86,7 +85,7 @@ def _redirect_response_payment(self, request):
8685

8786
get_items = list(self.request.GET.lists())
8887
redirect_url = None
89-
if "bundle" in dict(get_items) and not is_program_redirection_to_ct_enabled(request):
88+
if "bundle" in dict(get_items):
9089
ecom_url = urljoin(
9190
settings.ECOMMERCE_URL, settings.ECOMMERCE_ADD_TO_BASKET_API_PATH
9291
)

commerce_coordinator/apps/rollout/pipeline.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
from commerce_coordinator.apps.enterprise_learner.utils import is_user_enterprise_learner
1515
from commerce_coordinator.apps.frontend_app_payment.constants import FRONTEND_APP_PAYMENT_CHECKOUT
1616
from commerce_coordinator.apps.rollout.utils import is_legacy_order
17-
from commerce_coordinator.apps.rollout.waffle import (
18-
is_program_redirection_to_ct_enabled,
19-
is_redirect_to_commercetools_enabled_for_user
20-
)
17+
from commerce_coordinator.apps.rollout.waffle import is_redirect_to_commercetools_enabled_for_user
2118

2219
logger = logging.getLogger(__name__)
2320

@@ -34,29 +31,17 @@ def run_filter(self, request): # pylint: disable=arguments-differ
3431
"""
3532
Execute a filter with the signature specified.
3633
Arguments:
37-
request: request object passed through from the LMS filter
34+
request: request object passed through from the lms filter
3835
Returns:
3936
dict:
4037
active_order_management_system: result from pipeline steps to determine if
41-
redirect_to_commercetools_checkout flag is enabled and course_run_key,
42-
sku, or bundle query params exist, and detect which checkout to redirect to.
38+
redirect_to_commercetools_checkout flag is enabled and course_run_key
39+
and sku query params exist and detect which checkout to redirect to
4340
"""
4441
sku = request.query_params.get('sku', '').strip()
4542
course_run = request.query_params.get('course_run_key', '').strip()
46-
bundle = request.query_params.get('bundle', '').strip()
4743
commercetools_available_course = None
4844

49-
ct_api_client = CommercetoolsAPIClient()
50-
51-
if bundle and is_program_redirection_to_ct_enabled(request):
52-
commercetools_available_program = ct_api_client.get_product_variant_by_program(bundle)
53-
if commercetools_available_program:
54-
return {ACTIVE_ORDER_MANAGEMENT_SYSTEM_KEY: COMMERCETOOLS_FRONTEND}
55-
logger.warning(
56-
f'[get_product_variant_by_program] Program {bundle} not found in Commercetools. '
57-
f'Please ensure it is properly synced.'
58-
)
59-
6045
if course_run and is_redirect_to_commercetools_enabled_for_user(request):
6146
try:
6247
ct_api_client = CommercetoolsAPIClient()

commerce_coordinator/apps/rollout/waffle.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,3 @@ def is_redirect_to_commercetools_enabled_for_user(request):
1414
Check if REDIRECT_TO_COMMERCETOOLS_CHECKOUT flag is enabled.
1515
"""
1616
return waffle.flag_is_active(request, REDIRECT_TO_COMMERCETOOLS_CHECKOUT)
17-
18-
19-
def is_program_redirection_to_ct_enabled(request):
20-
"""
21-
Check if PROGRAM_CT_REDIRECTION flag is enabled.
22-
"""
23-
return waffle.flag_is_active(request, "PROGRAM_CT_REDIRECTION")

0 commit comments

Comments
 (0)