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 Aug 23, 2023
1 parent ed71eeb commit 0d402b9
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions eox_nelp/signals/receivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,19 @@ 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.exclude(
internal_status="resolution_by_case_1",
).filter(
cdtrans_lms_user_id=user.id,
cdtrans_course_id=str(course_key),
)

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 0d402b9

Please sign in to comment.