Giter VIP home page Giter VIP logo

gerencianet / gn-api-sdk-java-examples Goto Github PK

View Code? Open in Web Editor NEW
16.0 9.0 8.0 100 KB

Exemplos de consumo da SDK em Java integrada a API Gerencianet. Neste repositório você encontra exemplos de integração à API Pix e API Boletos da Gerencianet, que lhe permite realizar o gerenciamento de cobranças Pix com QR Code e Pix Copia e Cola, boleto/Bolix, carnê, cartão de crédito e muito mais.

Home Page: https://dev.gerencianet.com.br/docs/instalacao-sdk-java

Java 100.00%
java sdk marketplace split subscription assinatura qrcode pix pix-copia-e-cola card

gn-api-sdk-java-examples's People

Contributors

filipemata avatar jessica-gavagn avatar sadycoimbraefi avatar thiagogresende avatar whintergoncalves avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gn-api-sdk-java-examples's Issues

Erro ao gerar Charge

Quando eu tento gerar um charge com minhas credenciais utilizando a API no meu servidor tomcat 7, utilizando JAVA 7, recebo a seguinte exception, alguma orientação de como resolver?

java.lang.IllegalStateException: Already connected at sun.net.www.protocol.http.HttpURLConnection.setRequestProperty(HttpURLConnection.java:3071)

Meu código:

` try {

		/* Setando credenciais */
		JSONObject options = new JSONObject();
		options.put("client_id", "meu_id");
		options.put("client_secret", "meu_secret");
		options.put("sandbox", true);


		JSONArray items = new JSONArray();

		JSONObject item = new JSONObject();
		item.put("name", "Teste");
		item.put("amount", 1);
		item.put("value", 5000);

		items.put(item);
		
		/* Definindo body da transação */
		JSONObject body = new JSONObject();
		body.put("items", items);
	
		/* Requisitando transação, retorno setado em charge */
	    Gerencianet gn = new Gerencianet(options);
	    JSONObject responseCharge = gn.call("createCharge", new HashMap<String,String>(), body);
	    System.out.println(responseCharge);
	} catch(Exception e) {
		e.printStackTrace();
	}`

Erro ao tentar baixar título manualmente

Ao tentar fazer a baixa do título manualmente, está apresentando o seguinte erro.

nonexistent endpoint

public static void main(String[] args) {
		/* *********  Set credentials parameters ******** */
minha credenciais
		/* ************************************************* */
		
		HashMap<String, String> params = new HashMap<String, String>();
		params.put("id", id_charge);

		try {
			Gerencianet gn = new Gerencianet(options);
			Map<String, Object> response = gn.call("settleCharge", params, new HashMap<String, Object>());
			System.out.println(response);
		}catch (GerencianetException e){
			System.out.println(e.getCode());
			System.out.println(e.getError());
			System.out.println(e.getErrorDescription());
		}
		catch (Exception e) {
			System.out.println(e.getMessage());
		}
	}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.