Skip to content

Lapsed Donor Logic #69

@aaronashby

Description

@aaronashby

Overview

Eventually, we want our backend to have the ability to identify donors who haven't donated in a while. We can then use this information to send them emails reminding them to donate to FCC. The goal of this ticket is to implement the former half of this functionality.

Tasks

  • Add findLapsedDonors method to DonationsRepository: This method should use a QueryBuilder to efficiently identify unique donor emails.
  • Create a new GET endpoint in the donations controller donations/lapsed
  • In the service: Create a getLapsedDonors method that the controller will call. This method should act as the orchestrator, invoking the Repository to fetch the data and applying any final business logic or DTO mapping.
  • Write unit tests that ensure the following:
    • The list returned should include donors who haven't donated in numMonths months
    • The list returned should include unique donors to prevent sending emails to the same person more than once
    • Only include donations that successfully went through (status === DonationStatus.SUCCEEDED)
    • If a donor has an active recurring donation (i.e. at least one of a given donor's donations satisfies donationType === DonationType.RECURRING), that donor wouldn't be considered lapsed, and thus shouldn't appear in the returned list

Acceptance Criteria

  • All unit tests should pass
  • Controller route should have effective Swagger documentation

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions