Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1 from plaid/mk-carryover
Browse files Browse the repository at this point in the history
Fork plaid-java@0.3.2; set up plaid-java-legacy
  • Loading branch information
michaelckelly committed Mar 9, 2017
2 parents d8c92c7 + bcf788b commit 08a30eb
Show file tree
Hide file tree
Showing 60 changed files with 3,555 additions and 1 deletion.
20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
The MIT License

Copyright (c) 2014-2016 Plaid Technologies, Inc. <support@plaid.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
88 changes: 87 additions & 1 deletion README.md
@@ -1 +1,87 @@
# plaid-java-legacy
plaid-java-legacy
=================

Java Bindings for the Plaid API (https://www.plaid.com/docs)

These bindings are under active development and currently support the main usecases of the Plaid API. There are some parts that are as yet unimplemented so pull requests are welcome!

### Installation

Plaid-java is available at [Maven Central](https://search.maven.org/#search%7Cga%7C1%7Cplaid-java) with the following coordinates (latest release 0.3.2):

```xml

<dependency>
<groupId>com.plaid</groupId>
<artifactId>plaid-java-legacy</artifactId>
<version>0.3.2</version>
</dependency>

```

### Basic Usage

```java

// Add Amex user, get 30 days of transactions

PlaidUserClient plaidUserClient = PlaidClients.testUserClient("test_id", "test_secret");
Credentials testCredentials = new Credentials("plaid_test", "plaid_good");
TransactionsResponse response = plaidUserClient.addUser(testCredentials, "amex", "test@test.com", null);

List<Transaction> transactions = response.getTransactions();


// Get all Categories

PlaidPublicClient plaidPublicClient = PlaidClients.testPublicClient();
CategoriesResponse categoriesResponse = plaidPublicClient.getAllCategories();

List<Category> categories = categoriesResponse.getCategories();
```

Check the Junit test classes for examples of more use cases.

### Exchange a Plaid Link public_token for an API access_token

```java
// Initialize a Plaid client with your client_id and secret
PlaidUserClient plaidUserClient = PlaidClients.testUserClient("test_id", "test_secret");

// Exchange the Link public_token ("test,bofa,connected") for an API access_token
PlaidUserResponse response = plaidUserClient.exchangeToken("test,bofa,connected");

// Initialize the user with the access_token returned by the exchangeToken call
plaidUserClient.setAccessToken(response.getAccessToken());

// Pull accounts for the user
// Note: This assumes you are using Link with the "auth" product
AccountsResponse response = plaidUserClient.updateAuth();
```

To use [Stripe ACH + Plaid Integration](https://plaid.com/docs/link/stripe/) exchange a `public_token` and `account_id` to retrive a Stripe bank account token

```java
// Initialize a Plaid client with your client_id and secret
PlaidUserClient plaidUserClient = PlaidClients.testUserClient("test_id", "test_secret");

// Exchange the Link public_token ("test,bofa,connected") and account_id ("test_account_id")
PlaidUserResponse response = plaidUserClient.exchangeToken("test,bofa,connected", "test_account_id");

// Get the Stripe bank account token from response
String stripeToken = response.getStripeBankAccountToken();
```

### Dependencies

There are two main dependencies (of course automatically managed by Maven):

1. [Apache HTTPComponents Client](http://hc.apache.org/httpcomponents-client-ga/index.html). One reason for this, besides it being a nice library, is that the native JDK HttpUrlConnection doesn't have support for the HTTP Patch method, that is required by the Plaid API. The bindings are, however, designed so that you can replace HTTPComponents client with the HTTP library of your choice, by creating a different implementation of the HttpDelegate interface.

2. The [Jackson JSON Parser](http://jackson.codehaus.org/).

The project also has a test scope dependency on [Wiremock](http://wiremock.org), which is really useful in order to avoid hitting the sandbox API all the time.

### Contributors

- [@erimag](https://github.com/erimag) (Qapital Insight AB)
239 changes: 239 additions & 0 deletions pom.xml
@@ -0,0 +1,239 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.plaid</groupId>
<artifactId>plaid-java-legacy</artifactId>
<version>0.3.3-SNAPSHOT</version>
<packaging>jar</packaging>

<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>9</version>
</parent>
<name>${project.groupId}:${project.artifactId}</name>
<description>Bindings for the Plaid (plaid.com) API. Original code contributed by Qapital Insight AB (qapital.com)</description>
<url>http://github.com/plaid/plaid-java-legacy</url>
<scm>
<connection>scm:git:git://github.com/plaid/plaid-java-legacy.git</connection>
<developerConnection>scm:git:git@github.com:plaid/plaid-java-legacy.git</developerConnection>
<url>http://github.com/plaid/plaid-java-legacy</url>
<tag>HEAD</tag>
</scm>
<organization>
<name>Plaid Technologies, Inc.</name>
<url>http://plaid.com</url>
</organization>
<inceptionYear>2014</inceptionYear>
<licenses>
<license>
<name>The MIT License (MIT)</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>
<developers>
<developer>
<name>Rahul Ramakrishnan</name>
<email>rahul@plaid.com</email>
<id>raha936</id>
<organization>Plaid Technologies, Inc</organization>
<organizationUrl>http://plaid.com</organizationUrl>
</developer>
<developer>
<name>Erik Akterin</name>
<email>erik.akterin@qapital.com</email>
<id>erimag</id>
<organization>Qapital</organization>
<organizationUrl>https://www.qapital.com</organizationUrl>
</developer>
<developer>
<name>Adam Langsner</name>
<email>adamlangsner@gmail.com</email>
<id>adamlangsner</id>
<organization>Betterment</organization>
<organizationUrl>https://www.betterment.com</organizationUrl>
</developer>
</developers>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.7</java.version>
</properties>

<dependencies>

<!-- compile scope dependencies -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.2</version>
</dependency>

<!-- runtime scope dependencies -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.7.6</version>
<scope>runtime</scope>
</dependency>

<!-- test scope dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
<version>1.44</version>
<scope>test</scope>
<!-- Include this if you have dependency conflicts for Guava, Jetty, Jackson
or Apache HTTP Client -->
<classifier>standalone</classifier>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<configuration>
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<name>Sonatype Nexus snapshot repository</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<name>Sonatype Nexus release repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<configuration>
<passphrase>${gpg.passphrase}</passphrase>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit 08a30eb

Please sign in to comment.