donor-tools-api-java provides a Java client for the Donor Tools (donortools.com) API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main
.gitignore
README.md
lgpl-3.0.txt
pom.xml

README.md

Donor Tools Java Client

donor-tools-api-java provides a Java client for the Donor Tools (donortools.com) API

Usage

Add the following Maven dependency:

<dependency>
    <groupId>org.threeriverdev</groupId>
    <artifactId>donor-tools-api-java</artifactId>
    <version>1.0.0.Final</version>
</dependency>

Code example:

import org.threeriverdev.donortools.*;

...

DonorToolsClient client = new DonorToolsClient("https://[USERNAME].donortools.com", "username", "password");

// create Persona

Persona persona = new Persona();
Persona.Name name = new Persona.Name(firstName, lastName);
persona.addName(name);

Persona.Address address = new Persona.Address();
address.setStreetAddress(streetAddress);
address.setCity(city);
address.setState(state);
address.setPostalCode(zip);
persona.addAddress(address);

Persona.EmailAddress emailAddress = new Persona.EmailAddress(email);
persona.addEmailAddress(emailAddress);

personaId = donorToolsClient.create(persona);

// store the personaId for re-use

// create Donation

Donation donation = new Donation();

donation.setDonationTypeId(14); // Donor Tools built-in donation type: Online Donation
donation.setPersonaId(personaId);
donation.setSourceId(sourceId);
donation.setAmountInCents(amountInCents);
donation.setMemo("This is a test.");

// Splits allow you to split a single donation up into multiple target funds.
Donation.Split split = new Donation.Split();
split.setAmountInCents(splitAmountInCents);
split.setFundId(fundId);
donation.addSplit(split);

donorToolsClient.create(donation);

// list all Personas
List<Persona> personas = client.listPersonas();

How to Deploy a Snapshot

  1. Add the following to ~/.m2/settings.xml
<server>
  <id>ossrh</id>
  <username>USERNAME</username>
  <password>PASSWORD</password>
</server>
  1. mvn clean deploy

How to Deploy a Release

  1. Add the following to ~/.m2/settings.xml
<server>
  <id>ossrh</id>
  <username>USERNAME</username>
  <password>PASSWORD</password>
</server>
  1. mvn versions:set -DnewVersion=1.2.3.Final
  2. git add .
  3. git commit -m "1.2.3.Final release"
  4. git tag 1.2.3.Final
  5. mvn clean deploy -P release
  6. mvn versions:set -DnewVersion=1.2.4-SNAPSHOT
  7. git add .
  8. git commit -m "1.2.4-SNAPSHOT"
  9. git push origin master 1.2.3.Final

License

Licensed under the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) V3. See lgpl-3.0.txt for more information.