code_corps v0.0.1 CodeCorps.StripeService.Validators.ProjectCanEnableDonations View Source

Ensures a CodeCorps.Project is able to receive subscriptions.

Link to this section Summary

Functions

Determines if the provided CodeCorps.Project can enable donations

Link to this section Functions

Determines if the provided CodeCorps.Project can enable donations.

For a project to be able to enable donations, it needs to have proper associations set up.

These are:

  • At least one CodeCorps.DonationGoal
  • Organization with a StripeConnectAccount which has charges_enabled: true and payouts_enabled: true

If the project has these relationships set up, it returns {:ok, project}

In any other case, it returns {:error, :project_not_ready}