Ultimately this app is a fork of https://github.com/texastribune/donations, created by Texas Tribune for their donations app, though both these repositories were originally on Bitbucket. It powers various methods of payment at MinnPost, most commonly with users starting at https://www.minnpost.com/support/, although others start users in this app.
MinnPost's version has a few important differences:
- We have several different page types (the standard one time and recurring donations, plus advertising payments, event sponsorships, pledge payments, and the ability to update or cancel an existing donation)
- We currently don't use Stripe Checkout (we use Stripe.js with Elements instead; integrating Stripe into our UI)
- We have the option of using Plaid for ACH payments
- We have not activated the Amazon Pay functionality
- Our tests are very out of date
- We have some different environment variables
- We don't use Docker
- Our JavaScript environment is mostly just a jQuery plugin
- For Python, we use a Pipfile/pipenv instead of requirements.txt.
To run this app locally, download it and install the environment with Pip. To start:
pipenv shell
The app can then be run locally either with python3 app.py
or heroku local
.
Software to collect donations for nonprofits. It integrates with Saleforce, Stripe, Amazon Pay, Slack and Sentry.
- Python running Flask
- supports single and recurring donations
- easily deployed on Heroku
The recommended method for running this repo locally is to use Docker. If you don't already have Docker set up, you'll want to install Docker for Mac to get a Docker environment set up on your computer.
You'll also need to have an env
file set up with the environment variables for Stripe
and Salesforce so that Docker can find them. By default the Makefile
will look for
env-docker
but this can be overridden with the DOCKER_ENV_FILE
environment variable.
You should also install pre-commit
, which we use for managing Git hooks (including JS formatting via Prettier). Once downloaded, run pre-commit install
at the root of this repo. You'll also need Node version 12.
Python 3.6+ See requirements.txt and dev-requirements.txt for specific Python packages and versions.
Variable | Example |
---|---|
AUTH0_DOMAIN |
domain.com |
AUTH0_PORTAL_AUDIENCE |
foobarbaz |
AUTH0_PORTAL_CLIENT_ID |
stringstringstring |
PUBLISHABLE_KEY |
pk_test_12345 |
SECRET_KEY |
sk_test_12335 |
SALESFORCE_HOST |
test.salesforce.com |
SALESFORCE_CLIENT_ID |
|
SALESFORCE_CLIENT_SECRET |
|
SALESFORCE_USERNAME |
|
SALESFORCE_PASSWORD |
|
SALESFORCE_TOKEN |
|
SALESFORCE_API_VERSION |
v43.0 |
CELERY_BROKER_URL |
amqp://guest:guest@rabbitmq:5672/ |
CELERY_RESULT_BACKEND |
redis://redis:6379/0 |
FLASK_SECRET_KEY |
b'f;\xeb\x9bT2\xcd\xdb\xe1#z\xfb\xab\xf8(\x03' |
ENABLE_SENTRY |
True |
SENTRY_ENVIRONMENT |
test |
SENTRY_DSN |
https://user:pass@sentry/7?timeout=10 |
SENTRY_AUTH_TOKEN |
|
SENTRY_ORG |
your-org |
SENTRY_PROJECT |
donations |
ENABLE_SENTRY_RELEASE |
True |
ENABLE_SLACK |
False |
SLACK_API_KEY |
|
SLACK_CHANNEL |
#donations |
MAIL_SERVER |
mail.server.com |
MAIL_USERNAME |
|
MAIL_PASSWORD |
|
MAIL_PORT |
25 |
MAIL_USE_TLS |
True |
DEFAULT_MAIL_SENDER |
[email protected] |
ACCOUNTING_MAIL_RECIPIENT |
[email protected] |
BUSINESS_MEMBER_RECIPIENT |
[email protected] |
REDIS_URL |
redis://redis:6379 |
REDIS_TLS_URL |
redis://redis:6379 |
REPORT_URI |
https://foo.bar |
ENABLE_PORTAL |
True |
PORTAL_API_DOMAIN |
https://foo.bar/api |
PORTAL_CAMPAIGN_ID |
stringstringstring |
RECAPTCHA_SECRET_KEY |
stringstringstring |
RECAPTCHA_SITE_KEY |
stringstringstring |
BAD_ACTOR_API_URL |
https://foo.bar.api |
BAD_ACTOR_NOTIFICATION_URL |
https://foo.bar.api |
AUTH0_PORTAL_M2M_CLIENT_ID |
string |
AUTH0_PORTAL_M2M_CLIENT_SECRET |
string |
Run make backing
. This will start RabbitMQ and Redis.
Run make
. This will drop you into the Flask app.
Run make restart
. You can interact with the app at localhost:80
. This command will also build CSS and JS in watch mode and allow you to make test transactions.
C_FORCE_ROOT=True celery -A app.celery worker --loglevel=INFO &
celery beat --app app.celery &
# gunicorn app:app --log-file=- --bind=0.0.0.0:5000 --access-logfile=-
The easiest way to develop is by running make restart
. Other more granular commands:
npm run js:dev
: Build JS and put Webpack in watch modenpm run ds-tasks-watch
: Build CSS and icons in watch modenpm run dev
: Run above two commands togethernpm run lint
: Run ESLint
To run the project tests, run
make test
If you find vulnerabilities in this repo please report them to [email protected].