Skip to content

Commit

Permalink
feat: include duplicate payment notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-canon committed Sep 5, 2023
1 parent 25daa40 commit 9f1aff5
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions eox_nelp/signals/receivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

0 comments on commit 9f1aff5

Please sign in to comment.