diff --git a/common/djangoapps/student/views/dashboard.py b/common/djangoapps/student/views/dashboard.py index a0ba7af57823..2dfc45810bda 100644 --- a/common/djangoapps/student/views/dashboard.py +++ b/common/djangoapps/student/views/dashboard.py @@ -5,6 +5,7 @@ import datetime import logging +import base64 from collections import defaultdict from django.conf import settings @@ -34,6 +35,7 @@ get_pseudo_session_for_entitlement, get_visible_sessions_for_entitlement ) +from openedx.core.djangoapps.content.course_overviews.models import CourseOverview from openedx.core.djangoapps.credit.email_utils import get_credit_provider_attribute_values, make_providers_strings from openedx.core.djangoapps.plugins.constants import ProjectType from openedx.core.djangoapps.programs.models import ProgramsApiConfig @@ -810,6 +812,18 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem user, ) ) + + # Retrieve pendingTransactionCourse cookie to show waiting alert to the learner. It conatain encrypted + # course_id for which AuthorizeNet transaction has been perfromed but notification is yet to be received. + transaction_hash = request.COOKIES.get(settings.ECOMMERCE_TRANSACTION_COOKIE_NAME) + if transaction_hash: + decoded_course_id = base64.b64decode(transaction_hash[2:-1]).decode("utf-8") + transaction_course_id = CourseKey.from_string(decoded_course_id) + pending_transaction_course_name = CourseOverview.get_from_id(transaction_course_id).display_name + context.update({ + 'pending_upgrade_course_name': pending_transaction_course_name, + }) + if ecommerce_service.is_enabled(request.user): context.update({ 'use_ecommerce_payment_flow': True, @@ -826,4 +840,9 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem 'resume_button_urls': resume_button_urls }) - return render_to_response('dashboard.html', context) + response = render_to_response('dashboard.html', context) + if transaction_hash: + response.delete_cookie( + settings.ECOMMERCE_TRANSACTION_COOKIE_NAME, domain=settings.SESSION_COOKIE_DOMAIN) + + return response diff --git a/lms/envs/common.py b/lms/envs/common.py index e96abbd0f585..6b082c6a06f7 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -4708,3 +4708,5 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring ################# Settings for Chrome-specific origin trials ######## # Token for " Disable Different Origin Subframe Dialog Suppression" for http://localhost:18000 CHROME_DISABLE_SUBFRAME_DIALOG_SUPPRESSION_TOKEN = 'ArNBN7d1AkvMhJTGWXlJ8td/AN4lOokzOnqKRNkTnLqaqx0HpfYvmx8JePPs/emKh6O5fckx14LeZIGJ1AQYjgAAAABzeyJvcmlnaW4iOiJodHRwOi8vbG9jYWxob3N0OjE4MDAwIiwiZmVhdHVyZSI6IkRpc2FibGVEaWZmZXJlbnRPcmlnaW5TdWJmcmFtZURpYWxvZ1N1cHByZXNzaW9uIiwiZXhwaXJ5IjoxNjM5NTI2Mzk5fQ==' # pylint: disable=line-too-long + +ECOMMERCE_TRANSACTION_COOKIE_NAME = 'pendingTransactionCourse' diff --git a/lms/envs/production.py b/lms/envs/production.py index 135ff904759a..cd36993ef3f0 100644 --- a/lms/envs/production.py +++ b/lms/envs/production.py @@ -1031,3 +1031,5 @@ def get_env_setting(setting): CHROME_DISABLE_SUBFRAME_DIALOG_SUPPRESSION_TOKEN = ENV_TOKENS.get( 'CHROME_DISABLE_SUBFRAME_DIALOG_SUPPRESSION_TOKEN', CHROME_DISABLE_SUBFRAME_DIALOG_SUPPRESSION_TOKEN ) + +ECOMMERCE_TRANSACTION_COOKIE_NAME = 'pendingTransactionCourse' diff --git a/lms/static/sass/multicourse/_dashboard.scss b/lms/static/sass/multicourse/_dashboard.scss index 7d2161d196a3..5314fb4e6499 100644 --- a/lms/static/sass/multicourse/_dashboard.scss +++ b/lms/static/sass/multicourse/_dashboard.scss @@ -1506,6 +1506,7 @@ a.fade-cover { width: flex-grid(12); } +.course-upgrade, .account-activation { .message-copy { position: relative; diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index 5369df1551a5..2216233b0e30 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -140,6 +140,14 @@ %endif + %if pending_upgrade_course_name: +
+ %endif +