Salesforce - Stripe connector
Clone or download
Latest commit 71358bc Dec 6, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci py.test moved? Oct 19, 2018
.github Update pull request template Oct 30, 2018
static use webpack for legacy css Dec 3, 2018
templates fresh template Dec 3, 2018
webpack use webpack for legacy css Dec 3, 2018
.babelrc webpackify Apr 11, 2018
.dockerignore add .editorconfig Sep 25, 2018
.editorconfig use 2-space indents for front-end code Oct 24, 2018
.eslintrc webpackify Apr 11, 2018
.gitignore ignore production-compiled static assets Nov 21, 2018
Dockerfile upgrade pip Oct 19, 2018
Dockerfile.py2 add a new Dockerfile since salesforce-bulk doesn't support Python 3 Mar 22, 2016
Dockerfile.sample add TODO Oct 18, 2018
LICENSE add MIT license Feb 18, 2016
Makefile Merge branch 'master' into dockerfile Oct 22, 2018
Procfile add CloudAMQP-specific setting recommendations Oct 22, 2018
README.md update README Dec 4, 2018
STYLEGUIDE.md add a style guide Oct 17, 2018
_config.yml Set theme jekyll-theme-minimal Nov 6, 2018
app.json Add Heroku generated app.json Nov 30, 2018
app.py refinements to how it's recorded in Salesforce Dec 6, 2018
app_celery.py Merge branch 'master' into sec Oct 22, 2018
apple-developer-merchantid-domain-association add merchant ID verification file May 17, 2017
batch.py hotfix change of function name Nov 17, 2018
charges.py create a Task when a Circle charge fails Nov 29, 2018
config.py refinements to how it's recorded in Salesforce Dec 6, 2018
dev-requirements.txt add dev requirements file Sep 25, 2018
forms.py fix length of reason field Nov 6, 2018
npsp.py (hotfix) fix csv initial space Dec 5, 2018
package.json pin version number for vue-stripe-elements-plus Aug 29, 2018
reconcile-email.py clean up imports Sep 21, 2018
reprocess.py style fixes Oct 3, 2018
requirements.txt Merge branch 'master' into libsass Dec 5, 2018
runtime.txt upgrade Python runtime Oct 30, 2018
tests.py update test Nov 28, 2018
util.py style changes Oct 5, 2018
yarn.lock pin version number for vue-stripe-elements-plus Aug 29, 2018

README.md

Donations

Collecting donations for the Texas Tribune.

  • Python running Flask
  • integrates with Stripe
  • integrates with Salesforce
  • supports single and recurring donations
  • easily deployed on Heroku

Getting Started

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.

Requirements

Python 3.6+ See requirements.txt and dev-requirements.txt for specific Python packages and versions.

Environment

Variable Example
PUBLISABLE_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
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 False
SENTRY_DSN https://user:pass@sentry/7?timeout=10
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 foo@bar.org
ACCOUNTING_MAIL_RECIPIENT foo@bar.org
BUSINESS_MEMBER_RECIPIENT foo@bar.org
REDIS_URL redis://redis:6379
SALESFORCE_API_VERSION v43.0
REPORT-URI https://foo.bar

Running the Project

Run make backing. This will start RabbitMQ and Redis. Run make. This will drop you into the Flask app. Run yarn run dev. You should then be able to interact with the app at local.texastribune.org:80

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=-

Front-end commands:

  • yarn run dev: Start Flask development server and watch for JS and CSS changes
  • yarn run js:dev: Just watch for JS and CSS changes

Front-end notes:

  • On yarn run dev, all files are built to /static/js/build, which is ignored from version control. That way you can make as many changes as you want when developing, Webpack will recompile the files, and they'll never show up in VC.
  • On deploy, all files are built to /static/js/prod/. This is not ignored from VC because Heroku cannot create directories and thus needs it to exist in the repo. That's why it contains a .gitkeep file.
  • On deploy, the production JS has to be built via the postinstall script. This means that, if you run yarn or yarn add <package> locally inside Docker, you'll get some compiled files in /static/js/prod/ that show up in version control. Delete them!

Important note: To build our JS on deployment, Heroku needs to run a postinstall script in package.json. This also means every time you run yarn or yarn add <package>, it's going to trigger that build and generate a bunch of files in static/js/prod/. Don't commit these!

Running tests

To run the project tests, run make test

Deploy

If you're not invited to the Trib's Heroku group, get someone to invite you. Log in to Heroku on your console. Follow Heroku instructions for deploying. Specifically, you'll run the command heroku git:remote -a donations-prod to add heroku to the project.

Replace the `[remote "heroku"] stanza in your .git/config file with the following to tell Heroku/Git where to push your branch, production or test:

[remote "production"]
  url = https://git.heroku.com/donations-prod.git
  fetch = +refs/heads/*:refs/remotes/production/*
[remote "test"]
  url = https://git.heroku.com/donations-testing.git
  fetch = +refs/heads/*:refs/remotes/heroku/*

Then deploy to test with the command git push test master or production with git push production master.

If you need to deploy a branch other than master to the test server, use the command git push <server> <branch>:master. For example git push test your-branch-name:master.

Test URL: http://donations-testing.texastribune.org/

Security

If you find vulnerabilities in this repo please report them to security@texastribune.org.