diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..973ec05
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1e926af
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+target/
+.settings
+src/main/java/br/com/efi/open_accounts/
\ No newline at end of file
diff --git a/.project b/.project
new file mode 100644
index 0000000..e96cd86
--- /dev/null
+++ b/.project
@@ -0,0 +1,34 @@
+
+
+ sdk-java-examples-apis-efi
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+
+
+
+ 1665497833948
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/README-en.md b/README-en.md
new file mode 100644
index 0000000..01d3f9c
--- /dev/null
+++ b/README-en.md
@@ -0,0 +1,26 @@
+
Java SDK for APIs Efí Pay using Examples
+
+![Banner APIs Efí Pay](https://gnetbr.com/BJgSIUhlYs)
+
+
+ Portuguese |
+ English
+
+
+This project has some java file examples to test the Java SDK for efi API.
+
+## Requirements
+* Java >= 7.0
+
+## Running examples
+Update the src/main/resources/credentials.json file with client_id, client_secret and certificate of your application.
+
+You can run using any Java IDE, like Eclipse or Netbeans, with Maven plugin installed, and follow these steps:
+1. clone this git repository in a local directory of your choice;
+2. on your IDE, open the folder as a Maven project. It'll download sdk-java-apis-efi as a dependencie;
+3. choose any project's example and run it as a Java Application. The result will be displayed on the console.
+
+**Warning:** Some examples require you to change some parameters to work, like br.com.efi.charges.carnet.json.DetailCarnet.java where you must change the id parameter.
+
+
+
diff --git a/README.md b/README.md
index ac7e0fd..a995ca6 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,30 @@
-# sdk-java-examples-apis-efi
+SDK Java para APIs Efí Pay usando Examplos
+
+![Banner APIs Efí Pay](https://gnetbr.com/BJgSIUhlYs)
+
+
+ Português |
+ Inglês
+
+
Este projeto contém alguns exemplos de arquivos java para testar a SDK Java para APIs Efí Pay
+
+## Requisitos
+* Java >= 7.0
+
+## Execução de exemplos
+
+Atualize o arquivo src/main/resources/credentials.json com client_id, client_secret e certificate de seu aplicativo.
+
+Você pode rodar usando qualquer IDE Java, como Eclipse ou Netbeans, com o plugin Maven instalado, e seguir os seguintes passos:
+1. clone este repositório git em um diretório local de sua escolha;
+2. em sua IDE, abra a pasta como um projeto Maven. Ele fará o download do sdk-java-apis-efi como uma dependência;
+3. escolha qualquer exemplo de projeto e execute-o como um aplicativo Java. O resultado será exibido no console.
+
+**Aviso:** Alguns exemplos requerem que você altere alguns parâmetros para funcionar, como br.com.efi.charges.carnet.json.DetailCarnet.java onde você deve alterar o parâmetro id.
+
+
+
+
+
+
diff --git a/certs/developmentCertificate.p12 b/certs/developmentCertificate.p12
new file mode 100644
index 0000000..e69de29
diff --git a/certs/productionCertificate.p12 b/certs/productionCertificate.p12
new file mode 100644
index 0000000..e69de29
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..e0baa20
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,35 @@
+
+ 4.0.0
+ br.com.efipay
+ sdk-java-examples-apis-efi
+ 0.0.1-SNAPSHOT
+
+
+ UTF-8
+ UTF-8
+
+
+
+
+ br.com.efipay.efisdk
+ sdk-java-apis-efi
+ 1.0.0
+
+
+ javax.xml.bind
+ jaxb-api
+ 2.3.1
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ 2.3.0
+
+
+ com.sun.xml.bind
+ jaxb-core
+ 2.3.0
+
+
+
diff --git a/src/main/java/br/com/efi/Credentials.java b/src/main/java/br/com/efi/Credentials.java
new file mode 100644
index 0000000..5ca5ab9
--- /dev/null
+++ b/src/main/java/br/com/efi/Credentials.java
@@ -0,0 +1,53 @@
+package br.com.efi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+
+public class Credentials {
+ private String clientId;
+ private String clientSecret;
+ private String certificate;
+ private boolean sandbox;
+ private boolean debug;
+
+ public Credentials() {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ InputStream credentialsFile = classLoader.getResourceAsStream("credentials.json");
+ JSONTokener tokener = new JSONTokener(credentialsFile);
+ JSONObject credentials = new JSONObject(tokener);
+ try {
+ credentialsFile.close();
+ } catch (IOException e) {
+ System.out.println("Impossible to close file credentials.json");
+ }
+
+ this.clientId = credentials.getString("client_id");
+ this.clientSecret = credentials.getString("client_secret");
+ this.certificate = credentials.getString("certificate");
+ this.sandbox = credentials.getBoolean("sandbox");
+ this.debug = credentials.getBoolean("debug");
+ }
+
+ public String getClientId() {
+ return clientId;
+ }
+
+ public String getClientSecret() {
+ return clientSecret;
+ }
+
+ public String getCertificate() {
+ return certificate;
+ }
+
+ public boolean isSandbox() {
+ return sandbox;
+ }
+
+ public boolean isDebug() {
+ return debug;
+ }
+
+}
diff --git a/src/main/java/br/com/efi/charges/billet/json/CancelBillet.java b/src/main/java/br/com/efi/charges/billet/json/CancelBillet.java
new file mode 100644
index 0000000..ca144e3
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/json/CancelBillet.java
@@ -0,0 +1,40 @@
+package br.com.efi.charges.billet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CancelBillet {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("cancelCharge", params, new JSONObject());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/json/CreateBilletHistory.java b/src/main/java/br/com/efi/charges/billet/json/CreateBilletHistory.java
new file mode 100644
index 0000000..6133183
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/json/CreateBilletHistory.java
@@ -0,0 +1,43 @@
+package br.com.efi.charges.billet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CreateBilletHistory {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ JSONObject body = new JSONObject();
+ body.put("description", "This charge was not fully paid");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("createChargeHistory", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/json/CreateCharge.java b/src/main/java/br/com/efi/charges/billet/json/CreateCharge.java
new file mode 100644
index 0000000..b84e649
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/json/CreateCharge.java
@@ -0,0 +1,52 @@
+package br.com.efi.charges.billet.json;
+
+import java.util.HashMap;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CreateCharge {
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ JSONArray items = new JSONArray();
+
+ JSONObject item1 = new JSONObject();
+ item1.put("name", "Item 1");
+ item1.put("amount", 1);
+ item1.put("value", 2000);
+
+ JSONObject item2 = new JSONObject("{\"name\":\"Item 1\", \"amount\":1, \"value\":1}");
+
+ items.put(item1);
+ items.put(item2);
+
+ JSONObject body = new JSONObject();
+ body.put("items", items);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("createCharge", new HashMap(), body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/json/CreateOneStepBillet.java b/src/main/java/br/com/efi/charges/billet/json/CreateOneStepBillet.java
new file mode 100644
index 0000000..858204e
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/json/CreateOneStepBillet.java
@@ -0,0 +1,95 @@
+package br.com.efi.charges.billet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CreateOneStepBillet {
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ // items
+ JSONArray items = new JSONArray();
+
+ JSONObject item1 = new JSONObject();
+ item1.put("name", "Item 4");
+ item1.put("amount", 1);
+ item1.put("value", 5000);
+
+ JSONObject item2 = new JSONObject("{\"name\":\"Item 2\", \"amount\":1, \"value\":1000}");
+
+ items.put(item1);
+ items.put(item2);
+
+ //customer
+ JSONObject customer = new JSONObject();
+ customer.put("name", "Gorbadoc Oldbuck");
+ customer.put("cpf", "94271564656");
+ customer.put("phone_number", "5144916523");
+
+ //notification url
+ JSONObject metadata = new JSONObject();
+ metadata.put("notification_url", "https://seudominio.com.br");
+
+ //discount
+ JSONObject discount = new JSONObject();
+ discount.put("type","currency");
+ discount.put("value",599);
+
+ //configurations
+ JSONObject configurations = new JSONObject();
+ configurations.put("fine", 200);
+ configurations.put("interest", 100);
+
+ //conditional discount
+ JSONObject conditional_discount = new JSONObject();
+ conditional_discount.put("type","percentage");
+ conditional_discount.put("value", 500);
+ conditional_discount.put("until_date", "2023-01-29");
+
+
+ JSONObject bankingBillet = new JSONObject();
+ bankingBillet.put("expire_at", "2023-01-30");
+ bankingBillet.put("customer", customer);
+ bankingBillet.put("discount", discount);
+ bankingBillet.put("configurations", configurations);
+ bankingBillet.put("conditional_discount", conditional_discount);
+ bankingBillet.put("message", "Pague pelo código de barras ou pelo QR Code");
+
+
+ JSONObject payment = new JSONObject();
+ payment.put("banking_billet", bankingBillet);
+
+ JSONObject body = new JSONObject();
+ body.put("payment", payment);
+ body.put("items", items);
+ body.put("metadata", metadata);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("createOneStepCharge", new HashMap(), body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/json/DefineBalanceSheetBillet.java b/src/main/java/br/com/efi/charges/billet/json/DefineBalanceSheetBillet.java
new file mode 100644
index 0000000..682575b
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/json/DefineBalanceSheetBillet.java
@@ -0,0 +1,123 @@
+package br.com.efi.charges.billet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class DefineBalanceSheetBillet {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ JSONObject defOne = new JSONObject();
+ defOne.put("align", "left");
+ defOne.put("color", "#000000");
+ defOne.put("style", "bold");
+ defOne.put("text", "Exemplo de despesa");
+ defOne.put("colspan", 2);
+
+ JSONObject defTwo = new JSONObject();
+ defTwo.put("align", "left");
+ defTwo.put("color", "#000000");
+ defTwo.put("style", "bold");
+ defTwo.put("text", "Total lan�ado");
+ defTwo.put("colspan", 2);
+
+ JSONArray rowOne = new JSONArray();
+ rowOne.put(defOne);
+ rowOne.put(defTwo);
+
+ JSONObject defThree = new JSONObject();
+ defThree.put("align", "left");
+ defThree.put("color", "#000000");
+ defThree.put("style", "normal");
+ defThree.put("text", "Instala��o");
+ defThree.put("colspan", 2);
+
+ JSONObject defFour = new JSONObject();
+ defFour.put("align", "left");
+ defFour.put("color", "#000000");
+ defFour.put("style", "normal");
+ defFour.put("text", "R$ 100,00");
+ defFour.put("colspan", 2);
+
+ JSONArray rowTwo = new JSONArray();
+ rowTwo.put(defThree);
+ rowTwo.put(defFour);
+
+ JSONArray rowsSideOne = new JSONArray();
+ rowsSideOne.put(rowOne);
+ rowsSideOne.put(rowTwo);
+
+ JSONObject rowObjectSideOne = new JSONObject();
+ rowObjectSideOne.put("rows", rowsSideOne);
+
+ JSONArray tablesSideOne = new JSONArray();
+ tablesSideOne.put(rowObjectSideOne);
+
+ JSONObject sideOne = new JSONObject();
+ sideOne.put("header", "Demonstrativo de Consumo");
+ sideOne.put("tables", tablesSideOne);
+
+ JSONObject defFive = new JSONObject();
+ defFive.put("align", "left");
+ defFive.put("color", "#000000");
+ defFive.put("style", "normal");
+ defFive.put("text", "Confira na documenta��o da efi todas as configura��es poss�veis de um boleto balancete.");
+ defFive.put("colspan", 4);
+
+ JSONArray rowThree = new JSONArray();
+ rowThree.put(defFive);
+
+ JSONArray rowsSideTwo = new JSONArray();
+ rowsSideTwo.put(rowThree);
+
+ JSONObject rowObjectSideTwo = new JSONObject();
+ rowObjectSideTwo.put("rows", rowsSideTwo);
+
+ JSONArray tablesSideTwo = new JSONArray();
+ tablesSideTwo.put(rowObjectSideTwo);
+
+ JSONObject sideTwo = new JSONObject();
+ sideTwo.put("header", "Balancete Geral");
+ sideTwo.put("tables", tablesSideTwo);
+
+ JSONArray balanceSheet = new JSONArray();
+ balanceSheet.put(sideOne);
+ balanceSheet.put(sideTwo);
+
+ JSONObject body = new JSONObject();
+ body.put("title", "Balancete Demonstrativo");
+ body.put("body", balanceSheet);
+
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("defineBalanceSheetBillet", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/json/DefineBilletPayMethod.java b/src/main/java/br/com/efi/charges/billet/json/DefineBilletPayMethod.java
new file mode 100644
index 0000000..b597377
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/json/DefineBilletPayMethod.java
@@ -0,0 +1,56 @@
+package br.com.efi.charges.billet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class DefineBilletPayMethod {
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ JSONObject customer = new JSONObject();
+ customer.put("name", "Gorbadoc Oldbuck");
+ customer.put("cpf", "94271564656");
+ customer.put("phone_number", "5144916523");
+
+ JSONObject bankingBillet = new JSONObject();
+ bankingBillet.put("expire_at", "2023-12-12");
+ bankingBillet.put("customer", customer);
+
+ JSONObject payment = new JSONObject();
+ payment.put("banking_billet", bankingBillet);
+
+ JSONObject body = new JSONObject();
+ body.put("payment", payment);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("definePayMethod", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/json/DetailBillet.java b/src/main/java/br/com/efi/charges/billet/json/DetailBillet.java
new file mode 100644
index 0000000..ed71e1d
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/json/DetailBillet.java
@@ -0,0 +1,40 @@
+package br.com.efi.charges.billet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class DetailBillet {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("detailCharge", params, new JSONObject());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/json/SendBilletEmail.java b/src/main/java/br/com/efi/charges/billet/json/SendBilletEmail.java
new file mode 100644
index 0000000..fba5869
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/json/SendBilletEmail.java
@@ -0,0 +1,43 @@
+package br.com.efi.charges.billet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class SendBilletEmail {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ JSONObject body = new JSONObject();
+ body.put("email", "client_email@server.com.br");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("sendBilletEmail", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/json/SettleBillet.java b/src/main/java/br/com/efi/charges/billet/json/SettleBillet.java
new file mode 100644
index 0000000..63a697e
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/json/SettleBillet.java
@@ -0,0 +1,40 @@
+package br.com.efi.charges.billet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class SettleBillet {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("settleCharge", params, new JSONObject());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/json/UpdateBillet.java b/src/main/java/br/com/efi/charges/billet/json/UpdateBillet.java
new file mode 100644
index 0000000..2d4b4f3
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/json/UpdateBillet.java
@@ -0,0 +1,43 @@
+package br.com.efi.charges.billet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class UpdateBillet {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ JSONObject body = new JSONObject();
+ body.put("expire_at", "2020-12-12");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("updateBillet", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/json/UpdateBilletMetadata.java b/src/main/java/br/com/efi/charges/billet/json/UpdateBilletMetadata.java
new file mode 100644
index 0000000..6987873
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/json/UpdateBilletMetadata.java
@@ -0,0 +1,44 @@
+package br.com.efi.charges.billet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class UpdateBilletMetadata {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ JSONObject body = new JSONObject();
+ body.put("custom_id", "Product 0001");
+ body.put("notification_url", "http://domain.com/notification");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("updateChargeMetadata", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/map/CancelBillet.java b/src/main/java/br/com/efi/charges/billet/map/CancelBillet.java
new file mode 100644
index 0000000..07c12c8
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/map/CancelBillet.java
@@ -0,0 +1,39 @@
+package br.com.efi.charges.billet.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CancelBillet {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("cancelCharge", params, new HashMap());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/map/CreateBilletHistory.java b/src/main/java/br/com/efi/charges/billet/map/CreateBilletHistory.java
new file mode 100644
index 0000000..93ad4dc
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/map/CreateBilletHistory.java
@@ -0,0 +1,42 @@
+package br.com.efi.charges.billet.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CreateBilletHistory {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ Map body = new HashMap();
+ body.put("description", "This charge was not fully paid");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("createChargeHistory", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/map/CreateCharge.java b/src/main/java/br/com/efi/charges/billet/map/CreateCharge.java
new file mode 100644
index 0000000..4407172
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/map/CreateCharge.java
@@ -0,0 +1,56 @@
+package br.com.efi.charges.billet.map;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CreateCharge {
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ List items = new ArrayList();
+
+ Map item1 = new HashMap();
+ item1.put("name", "Item 1");
+ item1.put("amount", 1);
+ item1.put("value", 1000);
+
+ Map item2 = new HashMap();
+ item2.put("name", "Item 2");
+ item2.put("amount", 1);
+ item2.put("value", 2000);
+
+ items.add(item1);
+ items.add(item2);
+
+ Map body = new HashMap();
+ body.put("items", items);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("createCharge", new HashMap(), body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/map/CreateOneStepBillet.java b/src/main/java/br/com/efi/charges/billet/map/CreateOneStepBillet.java
new file mode 100644
index 0000000..7908deb
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/map/CreateOneStepBillet.java
@@ -0,0 +1,65 @@
+package br.com.efi.charges.billet.map;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CreateOneStepBillet {
+ public static void main(String[] args) {
+
+ /* ********* Set credentials parameters ******** */
+ Credentials credentials = new Credentials();
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+ List items = new ArrayList();
+ Map item1 = new HashMap();
+ item1.put("name", "Item 1");
+ item1.put("amount", 1);
+ item1.put("value", 1000);
+
+ Map item2 = new HashMap();
+ item2.put("name", "Item 2");
+ item2.put("amount", 1);
+ item2.put("value", 2000);
+ items.add(item1);
+ items.add(item2);
+
+ Map customer = new HashMap();
+ customer.put("name", "Gorbadoc Oldbuck");
+ customer.put("cpf", "94271564656");
+ customer.put("phone_number", "5144916523");
+
+ Map bankingBillet = new HashMap();
+ bankingBillet.put("expire_at", "2019-08-29");
+ bankingBillet.put("customer", customer);
+
+ Map payment = new HashMap();
+ payment.put("banking_billet", bankingBillet);
+
+ Map body = new HashMap();
+ body.put("payment", payment);
+ body.put("items", items);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("createOneStepCharge", new HashMap(), body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/map/DefineBalanceSheetBillet.java b/src/main/java/br/com/efi/charges/billet/map/DefineBalanceSheetBillet.java
new file mode 100644
index 0000000..ffedf76
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/map/DefineBalanceSheetBillet.java
@@ -0,0 +1,122 @@
+package br.com.efi.charges.billet.map;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class DefineBalanceSheetBillet {
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "1");
+
+ Map defOne = new HashMap();
+ defOne.put("align", "left");
+ defOne.put("color", "#000000");
+ defOne.put("style", "bold");
+ defOne.put("text", "Exemplo de despesa");
+ defOne.put("colspan", 2);
+
+ Map defTwo = new HashMap();
+ defTwo.put("align", "left");
+ defTwo.put("color", "#000000");
+ defTwo.put("style", "bold");
+ defTwo.put("text", "Total lan�ado");
+ defTwo.put("colspan", 2);
+
+ List rowOne = new ArrayList();
+ rowOne.add(defOne);
+ rowOne.add(defTwo);
+
+ Map defThree = new HashMap();
+ defThree.put("align", "left");
+ defThree.put("color", "#000000");
+ defThree.put("style", "normal");
+ defThree.put("text", "Instala��o");
+ defThree.put("colspan", 2);
+
+ Map defFour = new HashMap();
+ defFour.put("align", "left");
+ defFour.put("color", "#000000");
+ defFour.put("style", "normal");
+ defFour.put("text", "R$ 100,00");
+ defFour.put("colspan", 2);
+
+ List rowTwo = new ArrayList();
+ rowTwo.add(defThree);
+ rowTwo.add(defFour);
+
+ List rowsSideOne = new ArrayList();
+ rowsSideOne.add(rowOne);
+ rowsSideOne.add(rowTwo);
+
+ Map rowObjectSideOne = new HashMap();
+ rowObjectSideOne.put("rows", rowsSideOne);
+
+ List tablesSideOne = new ArrayList();
+ tablesSideOne.add(rowObjectSideOne);
+
+ Map sideOne = new HashMap();
+ sideOne.put("header", "Demonstrativo de Consumo");
+ sideOne.put("tables", tablesSideOne);
+
+ Map defFive = new HashMap();
+ defFive.put("align", "left");
+ defFive.put("color", "#000000");
+ defFive.put("style", "normal");
+ defFive.put("text", "Confira na documenta��o da efi todas as configura��es poss�veis de um boleto balancete.");
+ defFive.put("colspan", 4);
+
+ List rowThree = new ArrayList();
+ rowThree.add(defFive);
+
+ List rowsSideTwo = new ArrayList();
+ rowsSideTwo.add(rowThree);
+
+ Map rowObjectSideTwo = new HashMap();
+ rowObjectSideTwo.put("rows", rowsSideTwo);
+
+ List tablesSideTwo = new ArrayList();
+ tablesSideTwo.add(rowObjectSideTwo);
+
+ Map sideTwo = new HashMap();
+ sideTwo.put("header", "Balancete Geral");
+ sideTwo.put("tables", tablesSideTwo);
+
+ List balanceSheet = new ArrayList();
+ balanceSheet.add(sideOne);
+ balanceSheet.add(sideTwo);
+
+ Map body = new HashMap();
+ body.put("title", "Balancete Demonstrativo");
+ body.put("body", balanceSheet);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("defineBalanceSheetBillet", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/map/DefineBilletPayMethod.java b/src/main/java/br/com/efi/charges/billet/map/DefineBilletPayMethod.java
new file mode 100644
index 0000000..dbdb3a3
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/map/DefineBilletPayMethod.java
@@ -0,0 +1,54 @@
+package br.com.efi.charges.billet.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class DefineBilletPayMethod {
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ Map customer = new HashMap();
+ customer.put("name", "Gorbadoc Oldbuck");
+ customer.put("cpf", "94271564656");
+ customer.put("phone_number", "5144916523");
+
+ Map bankingBillet = new HashMap();
+ bankingBillet.put("expire_at", "2018-12-12");
+ bankingBillet.put("customer", customer);
+
+ Map payment = new HashMap();
+ payment.put("banking_billet", bankingBillet);
+
+ Map body = new HashMap();
+ body.put("payment", payment);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("definePayMethod", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/map/DetailBillet.java b/src/main/java/br/com/efi/charges/billet/map/DetailBillet.java
new file mode 100644
index 0000000..2ada9e5
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/map/DetailBillet.java
@@ -0,0 +1,39 @@
+package br.com.efi.charges.billet.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class DetailBillet {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("detailCharge", params, new HashMap());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/map/SendBilletEmail.java b/src/main/java/br/com/efi/charges/billet/map/SendBilletEmail.java
new file mode 100644
index 0000000..aaeb4f9
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/map/SendBilletEmail.java
@@ -0,0 +1,42 @@
+package br.com.efi.charges.billet.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class SendBilletEmail {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ Map body = new HashMap();
+ body.put("email", "client_email@server.com.br");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("sendBilletEmail", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/map/SettleBillet.java b/src/main/java/br/com/efi/charges/billet/map/SettleBillet.java
new file mode 100644
index 0000000..13ab2e2
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/map/SettleBillet.java
@@ -0,0 +1,39 @@
+package br.com.efi.charges.billet.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class SettleBillet {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("settleCharge", params, new HashMap());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/map/UpdateBillet.java b/src/main/java/br/com/efi/charges/billet/map/UpdateBillet.java
new file mode 100644
index 0000000..a1fef3d
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/map/UpdateBillet.java
@@ -0,0 +1,42 @@
+package br.com.efi.charges.billet.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class UpdateBillet {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ Map body = new HashMap();
+ body.put("expire_at", "2020-12-12");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("updateBillet", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/billet/map/UpdateBilletMetadata.java b/src/main/java/br/com/efi/charges/billet/map/UpdateBilletMetadata.java
new file mode 100644
index 0000000..35d6c66
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/billet/map/UpdateBilletMetadata.java
@@ -0,0 +1,43 @@
+package br.com.efi.charges.billet.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class UpdateBilletMetadata {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ Map body = new HashMap();
+ body.put("custom_id", "Product 0001");
+ body.put("notification_url", "http://domain.com/notification");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("updateChargeMetadata", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/json/CancelCard.java b/src/main/java/br/com/efi/charges/card/json/CancelCard.java
new file mode 100644
index 0000000..8dcbea1
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/json/CancelCard.java
@@ -0,0 +1,40 @@
+package br.com.efi.charges.card.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CancelCard {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("cancelCharge", params, new JSONObject());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/json/CreateCardHistory.java b/src/main/java/br/com/efi/charges/card/json/CreateCardHistory.java
new file mode 100644
index 0000000..1bacba8
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/json/CreateCardHistory.java
@@ -0,0 +1,43 @@
+package br.com.efi.charges.card.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CreateCardHistory {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ JSONObject body = new JSONObject();
+ body.put("description", "This charge was not fully paid");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("createChargeHistory", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/json/CreateCharge.java b/src/main/java/br/com/efi/charges/card/json/CreateCharge.java
new file mode 100644
index 0000000..05d19da
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/json/CreateCharge.java
@@ -0,0 +1,52 @@
+package br.com.efi.charges.card.json;
+
+import java.util.HashMap;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CreateCharge {
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ JSONArray items = new JSONArray();
+
+ JSONObject item1 = new JSONObject();
+ item1.put("name", "Item 1");
+ item1.put("amount", 1);
+ item1.put("value", 2000);
+
+ JSONObject item2 = new JSONObject("{\"name\":\"Item 1\", \"amount\":1, \"value\":1}");
+
+ items.put(item1);
+ items.put(item2);
+
+ JSONObject body = new JSONObject();
+ body.put("items", items);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("createCharge", new HashMap(), body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/json/CreateOneStepCard.java b/src/main/java/br/com/efi/charges/card/json/CreateOneStepCard.java
new file mode 100644
index 0000000..1c510b5
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/json/CreateOneStepCard.java
@@ -0,0 +1,89 @@
+package br.com.efi.charges.card.json;
+
+import java.util.HashMap;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CreateOneStepCard {
+ public static void main(String[] args) {
+
+ /* ********* Set credentials parameters ******** */
+ Credentials credentials = new Credentials();
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+ /* ************************************************* */
+ String paymentToken = "insira_seu_payment_token";
+
+ // items
+ JSONArray items = new JSONArray();
+ JSONObject item1 = new JSONObject();
+ item1.put("name", "Item 4");
+ item1.put("amount", 1);
+ item1.put("value", 600);
+ JSONObject item2 = new JSONObject("{\"name\":\"Item 2\", \"amount\":1, \"value\":1000}");
+ items.put(item1);
+ items.put(item2);
+
+ //customer
+ JSONObject customer = new JSONObject();
+ customer.put("name", "Gorbadoc Oldbuck");
+ customer.put("cpf", "94271564656");
+ customer.put("phone_number", "5144916523");
+ customer.put("email", "client_email@server.com.br");
+ customer.put("birth", "1990-05-04");
+
+ //address
+ JSONObject billingAddress = new JSONObject();
+ billingAddress.put("street", "Av. JK");
+ billingAddress.put("number", 909);
+ billingAddress.put("neighborhood", "Bauxita");
+ billingAddress.put("zipcode", "35400000");
+ billingAddress.put("city", "Ouro Preto");
+ billingAddress.put("state", "MG");
+
+ //notification URL
+ JSONObject metadata = new JSONObject();
+ metadata.put("notification_url", "https://requestb.in/16rpx6y1");
+ metadata.put("custom_id", "id_0007");
+
+ //discount
+ JSONObject discount = new JSONObject();
+ discount.put("type","currency");
+ discount.put("value",599);
+
+ JSONObject creditCard = new JSONObject();
+ creditCard.put("installments", 1);
+ creditCard.put("billing_address", billingAddress);
+ creditCard.put("payment_token", paymentToken);
+ creditCard.put("customer", customer);
+ creditCard.put("discount", discount);
+
+ JSONObject payment = new JSONObject();
+ payment.put("credit_card", creditCard);
+
+ JSONObject body = new JSONObject();
+ body.put("payment", payment);
+ body.put("items", items);
+ body.put("metadata", metadata);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("createOneStepCharge", new HashMap(), body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/br/com/efi/charges/card/json/DefineCardPayMethod.java b/src/main/java/br/com/efi/charges/card/json/DefineCardPayMethod.java
new file mode 100644
index 0000000..d3d912b
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/json/DefineCardPayMethod.java
@@ -0,0 +1,69 @@
+package br.com.efi.charges.card.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class DefineCardPayMethod {
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ String paymentToken = "Insira_aqui_o_payment_token";
+
+ JSONObject customer = new JSONObject();
+ customer.put("name", "Gorbadoc Oldbuck");
+ customer.put("cpf", "94271564656");
+ customer.put("phone_number", "5144916523");
+ customer.put("email", "client_email@server.com.br");
+ customer.put("birth", "1977-01-15");
+
+ JSONObject billingAddress = new JSONObject();
+ billingAddress.put("street", "Av. JK");
+ billingAddress.put("number", 909);
+ billingAddress.put("neighborhood", "Bauxita");
+ billingAddress.put("zipcode", "5400000");
+ billingAddress.put("city", "Ouro Preto");
+ billingAddress.put("state", "MG");
+
+ JSONObject creditCard = new JSONObject();
+ creditCard.put("installments", 1);
+ creditCard.put("billing_address", billingAddress);
+ creditCard.put("payment_token", paymentToken);
+ creditCard.put("customer", customer);
+
+ JSONObject payment = new JSONObject();
+ payment.put("credit_card", creditCard);
+
+ JSONObject body = new JSONObject();
+ body.put("payment", payment);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("definePayMethod", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/json/DetailCard.java b/src/main/java/br/com/efi/charges/card/json/DetailCard.java
new file mode 100644
index 0000000..8ec82ee
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/json/DetailCard.java
@@ -0,0 +1,40 @@
+package br.com.efi.charges.card.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class DetailCard {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("detailCharge", params, new JSONObject());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/json/GetInstallments.java b/src/main/java/br/com/efi/charges/card/json/GetInstallments.java
new file mode 100644
index 0000000..9778bfd
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/json/GetInstallments.java
@@ -0,0 +1,41 @@
+package br.com.efi.charges.card.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class GetInstallments {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("total", "20000");
+ params.put("brand", "visa");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("getInstallments", params, new JSONObject());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/json/UpdateCardMetadata.java b/src/main/java/br/com/efi/charges/card/json/UpdateCardMetadata.java
new file mode 100644
index 0000000..434317c
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/json/UpdateCardMetadata.java
@@ -0,0 +1,44 @@
+package br.com.efi.charges.card.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class UpdateCardMetadata {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ JSONObject body = new JSONObject();
+ body.put("custom_id", "Product 0001");
+ body.put("notification_url", "http://domain.com/notification");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("updateChargeMetadata", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/map/CancelCard.java b/src/main/java/br/com/efi/charges/card/map/CancelCard.java
new file mode 100644
index 0000000..925363f
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/map/CancelCard.java
@@ -0,0 +1,39 @@
+package br.com.efi.charges.card.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CancelCard {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("cancelCharge", params, new HashMap());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/map/CreateCardHistory.java b/src/main/java/br/com/efi/charges/card/map/CreateCardHistory.java
new file mode 100644
index 0000000..c5fdd07
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/map/CreateCardHistory.java
@@ -0,0 +1,42 @@
+package br.com.efi.charges.card.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CreateCardHistory {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ Map body = new HashMap();
+ body.put("description", "This charge was not fully paid");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("createChargeHistory", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/map/CreateCharge.java b/src/main/java/br/com/efi/charges/card/map/CreateCharge.java
new file mode 100644
index 0000000..3a43176
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/map/CreateCharge.java
@@ -0,0 +1,56 @@
+package br.com.efi.charges.card.map;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CreateCharge {
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ List items = new ArrayList();
+
+ Map item1 = new HashMap();
+ item1.put("name", "Item 1");
+ item1.put("amount", 1);
+ item1.put("value", 1000);
+
+ Map item2 = new HashMap();
+ item2.put("name", "Item 2");
+ item2.put("amount", 1);
+ item2.put("value", 2000);
+
+ items.add(item1);
+ items.add(item2);
+
+ Map body = new HashMap();
+ body.put("items", items);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("createCharge", new HashMap(), body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/map/CreateOneStepCard.java b/src/main/java/br/com/efi/charges/card/map/CreateOneStepCard.java
new file mode 100644
index 0000000..2fc774b
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/map/CreateOneStepCard.java
@@ -0,0 +1,73 @@
+package br.com.efi.charges.card.map;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+public class CreateOneStepCard {
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+ Credentials credentials = new Credentials();
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+ /* ************************************************* */
+
+ List items = new ArrayList();
+ Map item1 = new HashMap();
+ item1.put("name", "Item 1");
+ item1.put("amount", 1);
+ item1.put("value", 1000);
+ Map item2 = new HashMap();
+ item2.put("name", "Item 2");
+ item2.put("amount", 1);
+ item2.put("value", 2000);
+ items.add(item1);
+ items.add(item2);
+
+ String paymentToken = "Insira_aqui_o_payment_token";
+
+ Map customer = new HashMap();
+ customer.put("name", "Gorbadoc Oldbuck");
+ customer.put("cpf", "94271564656");
+ customer.put("phone_number", "5144916523");
+ customer.put("email", "client_email@server.com.br");
+ customer.put("birth", "1977-01-15");
+
+ Map billingAddress = new HashMap();
+ billingAddress.put("street", "Av. JK");
+ billingAddress.put("number", 909);
+ billingAddress.put("neighborhood", "Bauxita");
+ billingAddress.put("zipcode", "35400000");
+ billingAddress.put("city", "Ouro Preto");
+ billingAddress.put("state", "MG");
+
+ Map creditCard = new HashMap();
+ creditCard.put("installments", 1);
+ creditCard.put("billing_address", billingAddress);
+ creditCard.put("payment_token", paymentToken);
+ creditCard.put("customer", customer);
+ Map payment = new HashMap();
+ payment.put("credit_card", creditCard);
+ Map body = new HashMap();
+ body.put("items", items);
+ body.put("payment", payment);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("createOneStepCharge", new HashMap(), body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/br/com/efi/charges/card/map/DefineCardPayMethod.java b/src/main/java/br/com/efi/charges/card/map/DefineCardPayMethod.java
new file mode 100644
index 0000000..339ca48
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/map/DefineCardPayMethod.java
@@ -0,0 +1,68 @@
+package br.com.efi.charges.card.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class DefineCardPayMethod {
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ Map options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ String paymentToken = "Insira_aqui_o_payment_token";
+
+ Map customer = new HashMap();
+ customer.put("name", "Gorbadoc Oldbuck");
+ customer.put("cpf", "94271564656");
+ customer.put("phone_number", "5144916523");
+ customer.put("email", "client_email@server.com.br");
+ customer.put("birth", "1977-01-15");
+
+ Map billingAddress = new HashMap();
+ billingAddress.put("street", "Av. JK");
+ billingAddress.put("number", 909);
+ billingAddress.put("neighborhood", "Bauxita");
+ billingAddress.put("zipcode", "5400000");
+ billingAddress.put("city", "Ouro Preto");
+ billingAddress.put("state", "MG");
+
+ Map creditCard = new HashMap();
+ creditCard.put("installments", 1);
+ creditCard.put("billing_address", billingAddress);
+ creditCard.put("payment_token", paymentToken);
+ creditCard.put("customer", customer);
+
+ Map payment = new HashMap();
+ payment.put("credit_card", creditCard);
+
+ Map body = new HashMap();
+ body.put("payment", payment);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("definePayMethod", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/map/DetailCard.java b/src/main/java/br/com/efi/charges/card/map/DetailCard.java
new file mode 100644
index 0000000..483c3eb
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/map/DetailCard.java
@@ -0,0 +1,39 @@
+package br.com.efi.charges.card.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class DetailCard {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("detailCharge", params, new HashMap());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/map/GetInstallments.java b/src/main/java/br/com/efi/charges/card/map/GetInstallments.java
new file mode 100644
index 0000000..a90fb73
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/map/GetInstallments.java
@@ -0,0 +1,40 @@
+package br.com.efi.charges.card.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class GetInstallments {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("total", "20000");
+ params.put("brand", "visa");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("getInstallments", params, new HashMap());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/card/map/UpdateCardMetadata.java b/src/main/java/br/com/efi/charges/card/map/UpdateCardMetadata.java
new file mode 100644
index 0000000..ed7b58d
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/card/map/UpdateCardMetadata.java
@@ -0,0 +1,43 @@
+package br.com.efi.charges.card.map;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class UpdateCardMetadata {
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ HashMap options = new HashMap();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ Map body = new HashMap();
+ body.put("custom_id", "Product 0001");
+ body.put("notification_url", "http://domain.com/notification");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ Map response = efi.call("updateChargeMetadata", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/br/com/efi/charges/carnet/json/CancelCarnet.java b/src/main/java/br/com/efi/charges/carnet/json/CancelCarnet.java
new file mode 100644
index 0000000..c473b4c
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/carnet/json/CancelCarnet.java
@@ -0,0 +1,42 @@
+package br.com.efi.charges.carnet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CancelCarnet {
+
+ public static void main(String[] args) {
+ /* ********* Set credential parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("cancelCarnet", params, new JSONObject());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+}
diff --git a/src/main/java/br/com/efi/charges/carnet/json/CancelCarnetParcel.java b/src/main/java/br/com/efi/charges/carnet/json/CancelCarnetParcel.java
new file mode 100644
index 0000000..09595dd
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/carnet/json/CancelCarnetParcel.java
@@ -0,0 +1,43 @@
+package br.com.efi.charges.carnet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CancelCarnetParcel {
+
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+ HashMap params = new HashMap();
+ params.put("id", "0");
+ params.put("parcel", "1");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("cancelCarnetParcel", params, new JSONObject());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+
+ }
+
+}
diff --git a/src/main/java/br/com/efi/charges/carnet/json/CreateCarnet.java b/src/main/java/br/com/efi/charges/carnet/json/CreateCarnet.java
new file mode 100644
index 0000000..3a009d7
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/carnet/json/CreateCarnet.java
@@ -0,0 +1,66 @@
+package br.com.efi.charges.carnet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CreateCarnet {
+
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ JSONArray items = new JSONArray();
+
+ JSONObject item1 = new JSONObject();
+ item1.put("name", "Item 1");
+ item1.put("amount", 1);
+ item1.put("value", 2000);
+
+ JSONObject item2 = new JSONObject("{\"name\":\"Item 1\", \"amount\":1, \"value\":1000}");
+
+ items.put(item1);
+ items.put(item2);
+
+ JSONObject customer = new JSONObject();
+ customer.put("name", "Gorbadoc Oldbuck");
+ customer.put("cpf", "94271564656");
+ customer.put("phone_number", "5144916523");
+
+ JSONObject body = new JSONObject();
+ body.put("items", items);
+ body.put("customer", customer);
+ body.put("expire_at", "2022-12-30");
+ body.put("repeats", 4);
+ body.put("message", "Pague pelo código de barras ou pelo QR Code");
+ body.put("split_items", false);
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("createCarnet", new HashMap(), body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+
+ }
+
+}
diff --git a/src/main/java/br/com/efi/charges/carnet/json/CreateCarnetHistory.java b/src/main/java/br/com/efi/charges/carnet/json/CreateCarnetHistory.java
new file mode 100644
index 0000000..d774ef6
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/carnet/json/CreateCarnetHistory.java
@@ -0,0 +1,46 @@
+package br.com.efi.charges.carnet.json;
+
+import java.util.HashMap;
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class CreateCarnetHistory {
+
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ JSONObject body = new JSONObject();
+ body.put("description", "This carnet is about a service");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("createCarnetHistory", params, body);
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ System.out.println(e.getMessage());
+ }
+
+ }
+
+}
diff --git a/src/main/java/br/com/efi/charges/carnet/json/DetailCarnet.java b/src/main/java/br/com/efi/charges/carnet/json/DetailCarnet.java
new file mode 100644
index 0000000..19dc9e2
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/carnet/json/DetailCarnet.java
@@ -0,0 +1,44 @@
+package br.com.efi.charges.carnet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class DetailCarnet {
+
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap();
+ params.put("id", "0");
+
+ try {
+ EfiPay efi = new EfiPay(options);
+ JSONObject response = efi.call("detailCarnet", params, new JSONObject());
+ System.out.println(response);
+ }catch (EfiPayException e){
+ System.out.println(e.getCode());
+ System.out.println(e.getError());
+ System.out.println(e.getErrorDescription());
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ System.out.println(e.getMessage());
+ }
+
+ }
+
+}
diff --git a/src/main/java/br/com/efi/charges/carnet/json/SendCarnetEmail.java b/src/main/java/br/com/efi/charges/carnet/json/SendCarnetEmail.java
new file mode 100644
index 0000000..f82e71b
--- /dev/null
+++ b/src/main/java/br/com/efi/charges/carnet/json/SendCarnetEmail.java
@@ -0,0 +1,47 @@
+package br.com.efi.charges.carnet.json;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+import br.com.efi.Credentials;
+import br.com.efi.efisdk.EfiPay;
+import br.com.efi.efisdk.exceptions.EfiPayException;
+
+public class SendCarnetEmail {
+
+ public static void main(String[] args) {
+ /* ********* Set credentials parameters ******** */
+
+ Credentials credentials = new Credentials();
+
+ JSONObject options = new JSONObject();
+ options.put("client_id", credentials.getClientId());
+ options.put("client_secret", credentials.getClientSecret());
+ options.put("sandbox", credentials.isSandbox());
+
+ /* ************************************************* */
+
+ HashMap params = new HashMap