Skip to content

sheamunion/braintree_refunder

Repository files navigation

braintree_refunder

Table of Contents

Purpose:

Automatically void or refund Braintree transactions.

Input

  1. [required] Sandbox or Production API keys for a user with API access and the following permissions:
  • Credit Previous Transactions (Refunds)
  • Void Transactions
  1. [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
  1. [optional] A valid U.S. phone number to receive an SMS notification when the job is complete.

Output

  1. 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.
  1. If phone number was provided, an SMS notification.

Contributing

See CONTRIBUTING.md.

TODO

See TODO.md.

Requirements

Run the project locally

  1. Clone the repo.
  2. Create a virtual environment
python3 -m venv venv
  1. Activate the venv
source venv/bin/activate
  1. Install requirements
pip3 install -r requirements.txt
  1. Copy example.env file to .env file in project root and add keys.
  1. Create a files directory in the refunder/ app.
mkdir refunder/files
  1. Run the development server
python3 manage.py runserver

Run the tests

  1. Run the development server.
python3 manage.py runserver
  1. Run the functional tests.
python3 manage.py test functional_tests
  1. Run the unit tests
python3 manage.py test refunder
  1. Run unit tests for a specific module
python3 manage.py test refunder.test_module_name

About

Automatically void or refund Braintree transactions from a CSV.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published