Skip to content

[SSF-146] handle recurring donations#114

Open
amywng wants to merge 12 commits intomainfrom
acw/SSF-146-recurring-emails
Open

[SSF-146] handle recurring donations#114
amywng wants to merge 12 commits intomainfrom
acw/SSF-146-recurring-emails

Conversation

@amywng
Copy link
Member

@amywng amywng commented Feb 22, 2026

ℹ️ Issue

Closes SSF-146

📝 Description

Implemented logic for processing recurring donations - every day, the cron job calls the service to check whether any scheduled donation dates have passed, send an email to the FM (placeholder log for now), and reschedule the next occurrence.
handleRecurringDonations():

  • fetches all donations and filters for ones with past dates in nextDonationDates
  • for each past date, log a placeholder for sending an automated email to the FM
  • decrements occurrencesRemaining and removes the date from nextDonationDates
  • calculates the next scheduled date using recurrence and recurrenceFreq (in a helper called calculateNextDate()) and adds it to nextDonationDates if there are remaining occurrences
  • handles cascading recalculation - if the replacement date is also in the past, it continues advancing and decrementing occurrencesRemaining until a future date is reached or occurrences run out

Added service tests to cover all cases

  • I added an insertDonation() helper to easily insert a new donation with custom recurrence info

✔️ Verification

Tests pass

@dburkhart07 dburkhart07 self-requested a review February 22, 2026 20:32
Copy link

@dburkhart07 dburkhart07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks really good so far! this function looked like it was kinda evil to do 😅

Copy link

@dburkhart07 dburkhart07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few small things for the tests ✈️ 🌵

Copy link
Collaborator

@Yurika-Kan Yurika-Kan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yayayya donations are being recurred. big things happening.

responded back to bigger comments & one test case!

thanks amy <3

@amywng amywng requested review from Yurika-Kan and dburkhart07 March 1, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants