Automatically void or refund Braintree transactions.
- [required] Sandbox or Production API keys for a user with API access and the following permissions:
- Credit Previous Transactions (Refunds)
- Void Transactions
- [required] A CSV file that includes a header, Braintree transaction IDs, and, optionally, the amount to refund.
id | amount |
---|---|
de48m2c7 | 3.50 |
c929kphn | |
jn3g8509 | |
1geft1mj | 1,000,000 |
rqgqy6yn |
- [optional] A valid U.S. phone number to receive an SMS notification when the job is complete.
- A CSV formatted file that logs the result of every attempted void or refund.
transaction_id | refunded_transaction_id | status | message |
---|---|---|---|
de48m2c7 | FAILURE | Credit transactions cannot be refunded. | |
c929kphn | FAILURE | Transaction has already been completely refunded. | |
jn3g8509 | NO OPERATION | Transaction must have a status in "Authorized, Submitted For Settlement, Settlement Pending, Settling, or Settled." | |
1geft1mj | 1geft1mj | SUCCESS | Transaction voided. |
rqgqy6yn | qweby7pq | SUCCESS | Transaction refunded. |
- If phone number was provided, an SMS notification.
See CONTRIBUTING.md.
See TODO.md.
- Python3
- pip3
- Django
- Chrome web driver. Get it here.
- An APP_SECRET_KEY. From the Django docs, "A secret key for a particular Django installation. This is used to provide cryptographic signing, and should be set to a unique, unpredictable value." Follow these instructions to generate an
APP_SECRET_KEY
. - Braintree Sandbox or Production API keys
- Twilio SID and Token. Find these in your Twilio account.
- Clone the repo.
- Create a virtual environment
python3 -m venv venv
- Activate the venv
source venv/bin/activate
- Install requirements
pip3 install -r requirements.txt
- Copy example.env file to .env file in project root and add keys.
- See requirements
- Create a
files
directory in therefunder/
app.
mkdir refunder/files
- Run the development server
python3 manage.py runserver
- Run the development server.
python3 manage.py runserver
- Run the functional tests.
python3 manage.py test functional_tests
- Run the unit tests
python3 manage.py test refunder
- Run unit tests for a specific module
python3 manage.py test refunder.test_module_name