Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated files to integrate authorizenet notifications #281

Open
wants to merge 2 commits into
base: open-release/lilac.master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion common/djangoapps/student/views/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import datetime
import logging
import base64
from collections import defaultdict

from django.conf import settings
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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
2 changes: 2 additions & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 2 additions & 0 deletions lms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
1 change: 1 addition & 0 deletions lms/static/sass/multicourse/_dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1506,6 +1506,7 @@ a.fade-cover {
width: flex-grid(12);
}

.course-upgrade,
.account-activation {
.message-copy {
position: relative;
Expand Down
8 changes: 8 additions & 0 deletions lms/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@
</div>
%endif

%if pending_upgrade_course_name:
<div class="course-upgrade aa-icon info" role="alert">
<div class="message-copy" >
Please wait for the confirmation email as your request is being processed. Course: ${ pending_upgrade_course_name } will be upgraded soon.
</div>
</div>
%endif

</div>

<main id="main" aria-label="Content" tabindex="-1">
Expand Down