-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a7bdb8
commit a4547f8
Showing
105 changed files
with
1,937 additions
and
74 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...efaults/marketplace/json/Marketplace.java → ...net/defaults/charge/json/Marketplace.java
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tplace/json/OneStepBilletMarketPlace.java → ...charge/json/OneStepBilletMarketPlace.java
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ketplace/json/OneStepCardMarketPlace.java → ...s/charge/json/OneStepCardMarketPlace.java
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/main/java/br/com/gerencianet/defaults/charge/json/OneStepLink.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package br.com.gerencianet.defaults.charge.json; | ||
|
||
import java.util.HashMap; | ||
|
||
import org.json.JSONArray; | ||
import org.json.JSONObject; | ||
|
||
import br.com.gerencianet.Credentials; | ||
import br.com.gerencianet.gnsdk.Gerencianet; | ||
import br.com.gerencianet.gnsdk.exceptions.GerencianetException; | ||
|
||
public class OneStepLink { | ||
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", 500); | ||
|
||
JSONObject item2 = new JSONObject("{\"name\":\"Item 2\", \"amount\":1, \"value\":1000}"); | ||
|
||
items.put(item1); | ||
items.put(item2); | ||
|
||
JSONObject settings = new JSONObject(); | ||
settings.put("payment_method", "all"); | ||
settings.put("billet_discount", 10); | ||
settings.put("card_discount", 10); | ||
settings.put("expire_at", "2022-12-12"); | ||
settings.put("request_delivery_address", false); | ||
|
||
//notification url | ||
JSONObject metadata = new JSONObject(); | ||
metadata.put("notification_url", "https://seu.dominio/retorno"); | ||
|
||
JSONObject body = new JSONObject(); | ||
body.put("items", items); | ||
body.put("settings", settings); | ||
body.put("metadata", metadata); | ||
|
||
try { | ||
Gerencianet gn = new Gerencianet(options); | ||
JSONObject response = gn.call("oneStepLink", new HashMap<String,String>(), body); | ||
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()); | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/br/com/gerencianet/defaults/charge/json/ResendChargeLink.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package br.com.gerencianet.defaults.charge.json; | ||
|
||
import java.util.HashMap; | ||
|
||
import org.json.JSONObject; | ||
|
||
import br.com.gerencianet.Credentials; | ||
import br.com.gerencianet.gnsdk.Gerencianet; | ||
import br.com.gerencianet.gnsdk.exceptions.GerencianetException; | ||
|
||
public class ResendChargeLink { | ||
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<String, String> params = new HashMap<String, String>(); | ||
params.put("id", "0"); | ||
|
||
JSONObject body = new JSONObject(); | ||
body.put("email", "oldbuck@gerencianet.com.br"); | ||
|
||
try { | ||
Gerencianet gn = new Gerencianet(options); | ||
JSONObject response = gn.call("resendChargeLink", params, body); | ||
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()); | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/br/com/gerencianet/defaults/charge/json/UpdateChargeLink.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package br.com.gerencianet.defaults.charge.json; | ||
|
||
import java.util.HashMap; | ||
|
||
import org.json.JSONObject; | ||
|
||
import br.com.gerencianet.Credentials; | ||
import br.com.gerencianet.gnsdk.Gerencianet; | ||
import br.com.gerencianet.gnsdk.exceptions.GerencianetException; | ||
|
||
public class UpdateChargeLink { | ||
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<String, String> params = new HashMap<String, String>(); | ||
params.put("id", "0"); | ||
|
||
JSONObject body = new JSONObject(); | ||
body.put("billet_discount", 0); | ||
body.put("card_discount", 0); | ||
body.put("message", "link test"); | ||
body.put("expire_at", "2022-12-12"); | ||
body.put("request_delivery_address", false); | ||
body.put("payment_method", "all"); | ||
|
||
try { | ||
Gerencianet gn = new Gerencianet(options); | ||
JSONObject response = gn.call("updateChargeLink", params, body); | ||
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()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...defaults/marketplace/map/Marketplace.java → ...anet/defaults/charge/map/Marketplace.java
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...etplace/map/OneStepBilletMarketplace.java → .../charge/map/OneStepBilletMarketplace.java
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rketplace/map/OneStepCardMarketPlace.java → ...ts/charge/map/OneStepCardMarketPlace.java
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/main/java/br/com/gerencianet/defaults/charge/map/OneStepLink.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package br.com.gerencianet.defaults.charge.map; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import br.com.gerencianet.Credentials; | ||
import br.com.gerencianet.gnsdk.Gerencianet; | ||
import br.com.gerencianet.gnsdk.exceptions.GerencianetException; | ||
public class OneStepLink { | ||
public static void main(String[] args) { | ||
/* ********* Set credentials parameters ******** */ | ||
Credentials credentials = new Credentials(); | ||
HashMap<String, Object> options = new HashMap<String, Object>(); | ||
options.put("client_id", credentials.getClientId()); | ||
options.put("client_secret", credentials.getClientSecret()); | ||
options.put("sandbox", credentials.isSandbox()); | ||
/* ************************************************* */ | ||
|
||
List<Object> items = new ArrayList<Object>(); | ||
Map<String, Object> item1 = new HashMap<String, Object>(); | ||
item1.put("name", "Item 1"); | ||
item1.put("amount", 1); | ||
item1.put("value", 1000); | ||
Map<String, Object> item2 = new HashMap<String, Object>(); | ||
item2.put("name", "Item 2"); | ||
item2.put("amount", 1); | ||
item2.put("value", 2000); | ||
items.add(item1); | ||
items.add(item2); | ||
|
||
Map<String, Object> settings = new HashMap<String, Object>(); | ||
settings.put("payment_method", "all"); | ||
settings.put("billet_discount", 0); | ||
settings.put("card_discount", 0); | ||
settings.put("expire_at", "2020-12-12"); | ||
settings.put("request_delivery_address", false); | ||
|
||
Map<String, Object> metadata = new HashMap<String, Object>(); | ||
metadata.put("notification_url", "http://domain.com/notification"); | ||
|
||
Map<String, Object> body = new HashMap<String, Object>(); | ||
body.put("items", items); | ||
body.put("settings", settings); | ||
body.put("metadata", metadata); | ||
|
||
try { | ||
Gerencianet gn = new Gerencianet(options); | ||
Map<String, Object> response = gn.call("oneStepLink", new HashMap<String,String>(), body); | ||
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()); | ||
} | ||
} | ||
} |
Oops, something went wrong.