Chargehound bindings for Java
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.
config/checkstyle
gradle/wrapper
src
.gitignore
.travis.yml
CHANGELOG
LICENSE
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

Chargehound Java bindings

Chargehound bindings for Java

Build Status

Installation

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.chargehound</groupId>
  <artifactId>chargehound-java</artifactId>
  <version>1.1.0</version>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.chargehound:chargehound-java:1.1.0"

Others

You'll need to manually install the following JARs:

Requests

Java requests use defined structs to represent parameters.

import com.chargehound.Chargehound;
import com.chargehound.models.Dispute;

Chargehound chargehound = new Chargehound("test_123");

Map<String, Object> fields = new HashMap<String, Object>();
fields.put("customer_name", "Susie Chargeback");

Dispute result = chargehound.disputes.submit("dp_123",
  new Dispute.UpdateParams.Builder()
  .template("unrecognized")
  .fields(fields)
  .finish()
);

Responses

Responses from the API are automatically parsed from JSON and returned as Java objects.

Responses also include the HTTP status code on the response object.

import com.chargehound.Chargehound;
import com.chargehound.models.Dispute;

Dispute result = chargehound.disputes.retrieve("dp_123");

System.out.println(result.state);
// "needs_response"
System.out.println(result.response.getStatusCode());
// 200

Documentation

Disputes

Errors

The Java library returns adapted objects rather than JSON from API calls.

Google AppEngine

If you're using the library in a Google App Engine environment, you can set the Chargehound client to use the supported HTTP transport.

import com.chargehound.Chargehound;
import com.google.api.client.extensions.appengine.http.UrlFetchTransport;

Chargehound chargehound = new Chargehound("test_123");

chargehound.setHttpTransport(new UrlFetchTransport());

Development

Clone the latest source and run the tests:

$ git clone git@github.com:chargehound/chargehound-java.git
$ ./gradlew build

Deployment

To deploy a new version of the SDK, perform the following steps:

  1. Update the CHANGELOG to describe what features have been added.
  2. Bump the version number in gradle.properties.
  3. Bump the version number in the Chargehound class in Chargehound.java.
  4. Bump the version number in this README.
  5. Deploy the Jar to the Maven central repository with gradle clean build uploadArchives
  6. Navigate here https://oss.sonatype.org/#stagingRepositories and release the build (https://central.sonatype.org/pages/releasing-the-deployment.html)

Deployment configuration

You will need the Sonatype login. Set the OSSRH_USERNAME/OSSRH_PASSWORD in your local ~/.gradle/gradle.properties file.

You will also need to setup a PGP key. Follow the instructions here: https://docs.gradle.org/current/userguide/signing_plugin.html#sec:signatory_credentials