From c0fe7e37c9b236033a92663be084a40677e5e388 Mon Sep 17 00:00:00 2001 From: andrey-canon Date: Wed, 23 Aug 2023 10:22:25 -0500 Subject: [PATCH] feat: include duplicate payment notifications --- eox_nelp/signals/receivers.py | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/eox_nelp/signals/receivers.py b/eox_nelp/signals/receivers.py index 22e71d13..45319364 100644 --- a/eox_nelp/signals/receivers.py +++ b/eox_nelp/signals/receivers.py @@ -199,21 +199,18 @@ def update_payment_notifications(instance, **kwargs): user = instance.user course_key = instance.course_id - try: - payment_notification = PaymentNotification.objects.exclude( - internal_status="resolution_by_case_1", - ).get( - cdtrans_lms_user_id=user.id, - cdtrans_course_id=str(course_key), - ) - except PaymentNotification.DoesNotExist: - return + payment_notifications = PaymentNotification.objects.filter( + cdtrans_lms_user_id=user.id, + cdtrans_course_id=str(course_key), + internal_status="case_1", + ) - payment_notification.internal_status = "resolution_by_case_1" - payment_notification.save() + for payment_notification in payment_notifications: + payment_notification.internal_status = "resolution_by_case_1" + payment_notification.save() - LOGGER.info( - "The internal status of the payment notification with id %s has been updated to %s", - payment_notification.id, - payment_notification.internal_status, - ) + LOGGER.info( + "The internal status of the payment notification with id %s has been updated to %s", + payment_notification.id, + payment_notification.internal_status, + )