diff --git a/eox_nelp/payment_notifications/templates/payment_notifications.html b/eox_nelp/payment_notifications/templates/payment_notifications.html index 24e75526..86f9657b 100644 --- a/eox_nelp/payment_notifications/templates/payment_notifications.html +++ b/eox_nelp/payment_notifications/templates/payment_notifications.html @@ -1,5 +1,6 @@ <%namespace name='static' file='/static_content.html'/> <%! +from django.conf import settings from django.utils.translation import ugettext as _ from django.contrib.auth import get_user_model from lms.djangoapps.grades.api import CourseGradeFactory @@ -7,6 +8,7 @@ from eox_nelp.edxapp_wrapper.course_overviews import CourseOverview +payment_links = getattr(settings, "PAYMENT_LINKS_BY_COURSE", {}) User = get_user_model() %> @@ -55,21 +57,21 @@ % for payment_notification in payment_notifications: <% - course_name = "" + passed = False try: + payment_link = payment_links.get(payment_notification.cdtrans_course_id, "link-not-set") user = User.objects.get(id=payment_notification.cdtrans_lms_user_id) course_key = CourseKey.from_string(payment_notification.cdtrans_course_id) grade = CourseGradeFactory().read(user, course_key=course_key) course_overview = CourseOverview.objects.get(id=course_key) - - if grade and grade.passed: - course_name = course_overview.display_name + course_name = course_overview.display_name + passed = grade and grade.passed except: pass %> - % if payment_notification.show_msg_case0 and course_name: + % if payment_notification.show_msg_case0 and passed and payment_notification.internal_status == "case_0":
@@ -79,14 +81,15 @@ % endif - % if payment_notification.show_msg_case1: + % if payment_notification.show_msg_case1 and payment_notification.internal_status == "case_1": %if payment_notification.call_to_action_1_url: