donor-tools-api-java provides a Java client for the Donor Tools API
Impact Upgrade is a tech and operations consulting company that solely partners with nonprofits and for-good businesses. We make the complex simple, focusing on back-office operations and making big ideas a reality. Don't fight a multiple-front battle! You know your mission. We know tech.
Add the following Maven dependency:
<dependency>
<groupId>com.impactupgrade.integration</groupId>
<artifactId>donor-tools-api-java</artifactId>
<version>1.0.3.Final</version>
</dependency>
Code example:
import com.impactupgrade.integration.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();
- Add the following to ~/.m2/settings.xml
<server>
<id>ossrh</id>
<username>USERNAME</username>
<password>PASSWORD</password>
</server>
- mvn clean deploy
- Add the following to ~/.m2/settings.xml
<server>
<id>ossrh</id>
<username>USERNAME</username>
<password>PASSWORD</password>
</server>
- mvn versions:set -DnewVersion=1.2.3.Final
- git add .
- git commit -m "1.2.3.Final release"
- git tag 1.2.3.Final
- mvn clean deploy -P release
- mvn versions:set -DnewVersion=1.2.4-SNAPSHOT
- git add .
- git commit -m "1.2.4-SNAPSHOT"
- git push origin master 1.2.3.Final
Licensed under the Apache License, Version 2.0. See LICENSE-2.0.txt for more information.