Skip to content

Latest commit

 

History

History
115 lines (87 loc) · 3.41 KB

README.md

File metadata and controls

115 lines (87 loc) · 3.41 KB

SDK GERENCIANET FOR JAVA

Sdk for Gerencianet Pagamentos' API. For more informations about parameters and values, please refer to Gerencianet documentation.

Em caso de dúvidas, você pode verificar a Documentação da API na Gerencianet e, necessitando de mais detalhes ou informações, entre em contato com nossa consultoria técnica, via nossos Canais de Comunicação.

Build Status Coverage Status [Maven Central] (http://search.maven.org/#search|ga|1|g:"br.com.gerencianet.gnsdk" AND a:"gn-api-sdk-java")

Requirements

  • Java >= 7.0

Installation

Via gradle:

compile 'br.com.gerencianet.gnsdk:gn-api-sdk-java:0.2.1'

Via maven:

<dependency>
    <groupId>br.com.gerencianet.gnsdk</groupId>
    <artifactId>gn-api-sdk-java</artifactId>
    <version>0.2.1</version>
</dependency>

Getting started

Require the module and packages:

import br.com.gerencianet.gnsdk.Gerencianet;
import br.com.gerencianet.gnsdk.exceptions.GerencianetException;

Although the web services responses are in json format, the sdk will convert any server response to a JSONObject or a Map<String, Object>. The code must be within a try-catch and exceptions can be handled as follow:

```java
try {
  /* code */
} catch(GerencianetException e) {
  /* Gerencianet's api errors will come here */
} catch(Exception ex) {
  /* Other errors will come here */
}

For development environment

Instantiate the module passing using your client_id, client_secret and sandbox equals true:

JSONObject options = new JSONObject();
options.put("client_id", "client_id");
options.put("client_secret", "client_secret");
options.put("sandbox", true);

Gerencianet gn = new Gerencianet($options);

Or

Map<String, Object> options = new HashMap<String, Object>();
options.put("client_id", "client_id");
options.put("client_secret", "client_secret");
options.put("sandbox", true);

Gerencianet gn = new Gerencianet($options);

For production environment

To change the environment to production, just set the third sandbox to false:

JSONObject options = new JSONObject();
options.put("client_id", "client_id");
options.put("client_secret", "client_secret");
options.put("sandbox", false);

Gerencianet gn = new Gerencianet($options);

Or

Map<String, Object> options = new HashMap<String, Object>();
options.put("client_id", "client_id");
options.put("client_secret", "client_secret");
options.put("sandbox", false);

Gerencianet gn = new Gerencianet($options);

Running tests

To run the test suite with coverage:

mvn clean test jacoco:report

Running examples

To run some existing examples follow the steps described at gn-api-sdk-java-examples.

Additional Documentation

The full documentation with all available endpoints is in https://dev.gerencianet.com.br/.

Changelog

CHANGELOG

License

MIT