Skip to content

Comments

[SSF-146] handle recurring donations#114

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

[SSF-146] handle recurring donations#114
amywng wants to merge 6 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
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.

1 participant