Skip to content

Commit

Permalink
Merge pull request openedx#34917 from openedx/mrossier/SONIC-521
Browse files Browse the repository at this point in the history
feat: Added extra info logs for refundable method
  • Loading branch information
MushtaqRossier authored Jun 5, 2024
2 parents fe07dda + eb2b51d commit f12322f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/djangoapps/student/models/course_enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,18 +1016,22 @@ def refundable(self):
self.course_id
)
if certificate and not CertificateStatuses.is_refundable_status(certificate.status):
log.info(f"{self.user} has already been given a certificate therefore cannot be refunded.")
return False

# If it is after the refundable cutoff date they should not be refunded.
refund_cutoff_date = self.refund_cutoff_date()
# `refund_cuttoff_date` will be `None` if there is no order. If there is no order return `False`.
if refund_cutoff_date is None:
log.info("Refund cutoff date is null")
return False
if datetime.now(UTC) > refund_cutoff_date:
log.info(f"Refund cutoff date: {refund_cutoff_date} has passed")
return False

course_mode = CourseMode.mode_for_course(self.course_id, 'verified', include_expired=True)
if course_mode is None:
log.info(f"Course mode for {self.course_id} doesn't exist.")
return False
else:
return True
Expand Down

0 comments on commit f12322f

Please sign in to comment.