From b9a51b1b66791010501fd5039e554291cf6ffff6 Mon Sep 17 00:00:00 2001 From: Jessica Gava Date: Mon, 10 May 2021 14:45:10 -0300 Subject: [PATCH 1/2] Added API Pix endpoints --- CHANGELOG.md | 8 ++ README.md | 8 +- pom.xml | 25 +++-- .../br/com/gerencianet/gnsdk/APIRequest.java | 48 ++++++---- .../java/br/com/gerencianet/gnsdk/Auth.java | 45 +++++---- .../java/br/com/gerencianet/gnsdk/Config.java | 96 ++++++++++++------- .../br/com/gerencianet/gnsdk/Request.java | 50 ++++++---- .../exceptions/GerencianetException.java | 51 ++++++---- .../br/com/gerencianet/gnsdk/RequestTest.java | 2 + 9 files changed, 209 insertions(+), 124 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da83a0b..ea8109b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# 1.0.1 + +- Fix: Error message + +# 1.0.0 + +- Added: API Pix endpoints + # 0.2.6 - Added: new endpoint (one step) diff --git a/README.md b/README.md index 28eb7f2..5ae7ef1 100755 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ java 7.0 and 8.0 **Via gradle:** ```gradle -compile 'br.com.gerencianet.gnsdk:gn-api-sdk-java:0.2.6' +compile 'br.com.gerencianet.gnsdk:gn-api-sdk-java:1.0.1' ``` **Via maven:** @@ -31,7 +31,7 @@ compile 'br.com.gerencianet.gnsdk:gn-api-sdk-java:0.2.6'     br.com.gerencianet.gnsdk     gn-api-sdk-java -    0.2.6 +    1.0.1 ``` @@ -60,6 +60,7 @@ Instantiate the module passing using your client_id, client_secret and sandbox e JSONObject options = new JSONObject(); options.put("client_id", "client_id"); options.put("client_secret", "client_secret"); +options.put("pix_cert", "./certs/developmentCertificate.p12"); options.put("sandbox", true); Gerencianet gn = new Gerencianet($options); @@ -70,6 +71,7 @@ Or Map options = new HashMap(); options.put("client_id", "client_id"); options.put("client_secret", "client_secret"); +options.put("pix_cert", "./certs/developmentCertificate.p12"); options.put("sandbox", true); Gerencianet gn = new Gerencianet($options); @@ -81,6 +83,7 @@ To change the environment to production, just set the third sandbox to false: JSONObject options = new JSONObject(); options.put("client_id", "client_id"); options.put("client_secret", "client_secret"); +options.put("pix_cert", "./certs/productionCertificate.p12"); options.put("sandbox", false); Gerencianet gn = new Gerencianet($options); @@ -91,6 +94,7 @@ Or Map options = new HashMap(); options.put("client_id", "client_id"); options.put("client_secret", "client_secret"); +options.put("pix_cert", "./certs/productionCertificate.p12"); options.put("sandbox", false); Gerencianet gn = new Gerencianet($options); diff --git a/pom.xml b/pom.xml index 1ef2511..6df9376 100755 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 br.com.gerencianet.gnsdk gn-api-sdk-java - 0.2.6 + 1.0.1 GN API SDK JAVA Java SDK for integrating with Gerencianet API @@ -58,9 +58,9 @@ 1.9.5 - javax.xml.bind - jaxb-api - 2.3.1 + javax.xml.bind + jaxb-api + 2.3.1 @@ -88,6 +88,7 @@ + org.apache.maven.plugins maven-release-plugin 2.5 @@ -104,7 +105,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.3 + 1.6.7 true ossrh @@ -115,10 +116,10 @@ maven-compiler-plugin - 3.2 + 3.8.1 - 1.7 - 1.7 + 1.8 + 1.8 **/test/** @@ -144,6 +145,14 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + true + + org.jacoco diff --git a/src/main/java/br/com/gerencianet/gnsdk/APIRequest.java b/src/main/java/br/com/gerencianet/gnsdk/APIRequest.java index d2ba4eb..ea35369 100644 --- a/src/main/java/br/com/gerencianet/gnsdk/APIRequest.java +++ b/src/main/java/br/com/gerencianet/gnsdk/APIRequest.java @@ -11,66 +11,72 @@ import br.com.gerencianet.gnsdk.exceptions.GerencianetException; /** - * This class instance a Auth Object, to authenticate client credentials in Gerencianet API. After client's credentials - * are validated a client Object send a given request body to a given endpoint throw a given route. + * This class instance a Auth Object, to authenticate client credentials in + * Gerencianet API. After client's credentials are validated a client Object + * send a given request body to a given endpoint throw a given route. + * * @author Filipe Mata * */ public class APIRequest { private Request requester; private Auth authenticator; - private String route; + private String route; private JSONObject body; - - + public APIRequest(String method, String route, JSONObject body, Config config) throws Exception { this.route = route; String authenticateRoute = config.getEndpoints().getJSONObject("authorize").getString("route"); String authenticateMethod = config.getEndpoints().getJSONObject("authorize").getString("method"); this.authenticator = new Auth(config.getOptions(), authenticateMethod, authenticateRoute); - + String url = config.getOptions().getString("baseUri") + route; URL link = new URL(url); HttpURLConnection client = (HttpURLConnection) link.openConnection(); - + this.requester = new Request(method, client); - - if(config.getOptions().has("partnerToken")){ + + if (config.getOptions().has("partnerToken")) { this.requester.addHeader("partner-token", config.getOptions().getString("partnerToken")); } - + + if (config.getOptions().has("headers")) { + this.requester.addHeader("x-skip-mtls-checking", config.getOptions().getString("headers")); + } + this.body = body; } - - public APIRequest(Auth auth, Request request, JSONObject body){ + + public APIRequest(Auth auth, Request request, JSONObject body) { this.authenticator = auth; this.requester = request; this.body = body; } - - public JSONObject send() throws AuthorizationException, GerencianetException, IOException{ + + public JSONObject send() throws AuthorizationException, GerencianetException, IOException { Date expiredDate = this.authenticator.getExpires(); if (this.authenticator.getExpires() == null || expiredDate.compareTo(new Date()) <= 0) { - this.authenticator.authorize(); - } - + + this.authenticator.authorize(); + } + this.requester.addHeader("Authorization", "Bearer " + this.authenticator.getAccessToken()); - try { + try { return this.requester.send(this.body); } catch (AuthorizationException e) { this.authenticator.authorize(); return this.requester.send(body); } } - + public Request getRequester() { return requester; } - + public String getRoute() { return route; } - + public JSONObject getBody() { return body; } diff --git a/src/main/java/br/com/gerencianet/gnsdk/Auth.java b/src/main/java/br/com/gerencianet/gnsdk/Auth.java index fb396ab..85a85ce 100644 --- a/src/main/java/br/com/gerencianet/gnsdk/Auth.java +++ b/src/main/java/br/com/gerencianet/gnsdk/Auth.java @@ -10,8 +10,9 @@ import br.com.gerencianet.gnsdk.exceptions.GerencianetException; /** - * This class is used to create an authenticator Object, - * responsible to send needed Gerencianet credentials (Client_Id and Client_Secret) to it's API. + * This class is used to create an authenticator Object, responsible to send + * needed Gerencianet credentials (Client_Id and Client_Secret) to it's API. + * * @author Filipe Mata * */ @@ -23,58 +24,64 @@ public class Auth { private Request request; private JSONObject authBody; private String authCredentials; - + public Auth(JSONObject credentials, String method, String authorizeRoute) throws Exception { - if(!credentials.has("clientId") || !credentials.has("clientSecret")){ + + if (!credentials.has("clientId") || !credentials.has("clientSecret")) { throw new Exception("Client_Id or Client_Secret not found"); } - + + if (credentials.has("certificadoPix")) { + System.setProperty("javax.net.ssl.keyStore", credentials.getString("certificadoPix")); + } + String url = credentials.getString("baseUri") + authorizeRoute; URL link = new URL(url); HttpURLConnection client = (HttpURLConnection) link.openConnection(); - + this.request = new Request(method, client); - - if(credentials.has("partnerToken")){ + + if (credentials.has("partnerToken")) { this.request.addHeader("partner-token", credentials.getString("partnerToken")); } - + authBody = new JSONObject(); authBody.put("grant_type", "client_credentials"); - + String auth = credentials.getString("clientId") + ":" + credentials.getString("clientSecret"); this.authCredentials = DatatypeConverter.printBase64Binary(auth.getBytes("UTF-8")); + } - + public void setRequest(Request request) { this.request = request; } - - public void authorize() throws IOException, AuthorizationException, GerencianetException{ + + public void authorize() throws IOException, AuthorizationException, GerencianetException { this.request.addHeader("Authorization", "Basic " + this.authCredentials); JSONObject response = this.request.send(authBody); this.accessToken = response.getString("access_token"); this.expires = new Date(new Date().getTime() + response.getLong("expires_in")); this.tokenType = response.getString("token_type"); - + } - + public Date getExpires() { return this.expires; } - + public String getAccessToken() { return this.accessToken; } - + public String getTokenType() { return this.tokenType; } - + public JSONObject getAuthBody() { return authBody; } - + public String getAuthCredentials() { return authCredentials; } diff --git a/src/main/java/br/com/gerencianet/gnsdk/Config.java b/src/main/java/br/com/gerencianet/gnsdk/Config.java index 30d6131..58c15e8 100755 --- a/src/main/java/br/com/gerencianet/gnsdk/Config.java +++ b/src/main/java/br/com/gerencianet/gnsdk/Config.java @@ -1,75 +1,107 @@ package br.com.gerencianet.gnsdk; import org.json.JSONObject; + /** - * This class is used to create an Object with all needed configurations used in Gerencianet API. - * This configurations include the Endpoints and URLs of Gerencianet API, and credential data of Gerencianet client. + * This class is used to create an Object with all needed configurations used in + * Gerencianet API. This configurations include the Endpoints and URLs of + * Gerencianet API, and credential data of Gerencianet client. + * * @author Filipe Mata * */ public class Config { - private final static String version = "0.2.6"; + private final static String version = "1.0.1"; private JSONObject conf = new JSONObject(); private JSONObject endpoints = new JSONObject(); private JSONObject urls = new JSONObject(); - + public Config(JSONObject options, JSONObject config) throws Exception { - if(config.has("ENDPOINTS")) - this.endpoints = (JSONObject)config.get("ENDPOINTS"); - else throw new Exception("Problems to get ENDPOINTS in file config.json"); - - if(config.has("URL")) - this.urls = (JSONObject)config.get("URL"); - else throw new Exception("Problems to get URLs in file config.json"); - + + if (config.has("ENDPOINTS")) { + this.endpoints = (JSONObject) config.get("ENDPOINTS"); + if (setPix(options)) { + if (this.endpoints.has("PIX")) { + this.endpoints = (JSONObject) this.endpoints.get("PIX"); + } + } else { + if (this.endpoints.has("DEFAULT")) { + this.endpoints = (JSONObject) this.endpoints.get("DEFAULT"); + } + } + } else + throw new Exception("Problems to get ENDPOINTS in file config.json"); + + if (config.has("URL")) { + this.urls = (JSONObject) config.get("URL"); + if (setPix(options)) { + if (this.urls.has("PIX")) { + this.urls = (JSONObject) this.urls.get("PIX"); + } + } else if (this.urls.has("DEFAULT")) { + this.urls = (JSONObject) this.urls.get("DEFAULT"); + } + } else + throw new Exception("Problems to get URLs in file config.json"); + this.setConf(options); } - + public JSONObject getEndpoints() { return endpoints; } - + public JSONObject getUrls() { return urls; } - + public void setConf(JSONObject options) { boolean sandbox = false; boolean debug = false; - if(options.has("sandbox")) + if (options.has("sandbox")) sandbox = options.getBoolean("sandbox"); - if(options.has("debug")) + if (options.has("debug")) debug = options.getBoolean("debug"); - + this.conf.put("sandbox", sandbox); this.conf.put("debug", debug); - - if(options.has("client_id")) + + if (options.has("client_id")) this.conf.put("clientId", options.getString("client_id")); - if(options.has("client_secret")) + if (options.has("client_secret")) this.conf.put("clientSecret", options.getString("client_secret")); - - if(options.has("partner_token")) + if (options.has("pix_cert")) + this.conf.put("certificadoPix", options.getString("pix_cert")); + if (options.has("partner_token")) this.conf.put("partnerToken", options.getString("partner_token")); - - if(options.has("url")){ + if (options.has("url")) { this.conf.put("baseUri", options.getString("url")); - } - else{ + } + + else { String baseUri = this.urls.getString("production"); - if(this.conf.getBoolean("sandbox") == true) + if (this.conf.getBoolean("sandbox") == true) baseUri = this.urls.getString("sandbox"); - + this.conf.put("baseUri", baseUri); } + + if (options.has("x-skip-mtls-checking")) { + this.conf.put("headers", options.getString("x-skip-mtls-checking")); + } } - - public JSONObject getOptions(){ + + public JSONObject getOptions() { return this.conf; } public static String getVersion() { return Config.version; } -} + + public boolean setPix(JSONObject options) { + return options.has("pix_cert"); + } + +} \ No newline at end of file diff --git a/src/main/java/br/com/gerencianet/gnsdk/Request.java b/src/main/java/br/com/gerencianet/gnsdk/Request.java index 02ac64d..198d795 100644 --- a/src/main/java/br/com/gerencianet/gnsdk/Request.java +++ b/src/main/java/br/com/gerencianet/gnsdk/Request.java @@ -11,54 +11,62 @@ import br.com.gerencianet.gnsdk.exceptions.GerencianetException; /** - * This class is responsible to create an HttpURLConnection Object, - * generate the request body and send it to a given endpoint. The send method return a response for that request. + * This class is responsible to create an HttpURLConnection Object, generate the + * request body and send it to a given endpoint. The send method return a + * response for that request. + * * @author Filipe Mata * */ public class Request { - + private HttpURLConnection client; - + public Request(String method, HttpURLConnection conn) throws IOException { this.client = conn; this.client.setRequestProperty("Content-Type", "application/json"); this.client.setRequestProperty("charset", "UTF-8"); - this.client.setRequestProperty("api-sdk", "java-"+ Config.getVersion()); - - this.client.setRequestMethod(method.toUpperCase()); + this.client.setRequestProperty("api-sdk", "java-" + Config.getVersion()); + + if (method.toUpperCase().equals("PATCH")) { + this.client.setRequestProperty("X-HTTP-Method-Override", "PATCH"); + this.client.setRequestMethod("POST"); + } else { + this.client.setRequestMethod(method.toUpperCase()); + } + } - - public void addHeader(String key, String value){ - client.setRequestProperty(key, value); + + public void addHeader(String key, String value) { + client.setRequestProperty(key, value); } - - public JSONObject send(JSONObject requestOptions) throws AuthorizationException, GerencianetException, IOException{ - byte[] postDataBytes; + + public JSONObject send(JSONObject requestOptions) throws AuthorizationException, GerencianetException, IOException { + byte[] postDataBytes; postDataBytes = requestOptions.toString().getBytes("UTF-8"); this.client.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length)); - - if(!client.getRequestMethod().toLowerCase().equals("get")){ + if (!client.getRequestMethod().toLowerCase().equals("get")) { client.setDoOutput(true); OutputStream os = client.getOutputStream(); os.write(postDataBytes); os.flush(); os.close(); - } + } int responseCode = client.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK) { + + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED) { InputStream responseStream = client.getInputStream(); JSONTokener responseTokener = new JSONTokener(responseStream); return new JSONObject(responseTokener); - }else if(responseCode == HttpURLConnection.HTTP_UNAUTHORIZED){ + } + else if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED ) { throw new AuthorizationException(); - }else{ + } else { InputStream responseStream = client.getErrorStream(); JSONTokener responseTokener = new JSONTokener(responseStream); JSONObject response = new JSONObject(responseTokener); throw new GerencianetException(response); - } - + } } } diff --git a/src/main/java/br/com/gerencianet/gnsdk/exceptions/GerencianetException.java b/src/main/java/br/com/gerencianet/gnsdk/exceptions/GerencianetException.java index b8ffe3d..1391f19 100644 --- a/src/main/java/br/com/gerencianet/gnsdk/exceptions/GerencianetException.java +++ b/src/main/java/br/com/gerencianet/gnsdk/exceptions/GerencianetException.java @@ -2,7 +2,10 @@ import org.json.JSONObject; -/** This class extends Exception and is developed to deal with Gerencianet API errors +/** + * This class extends Exception and is developed to deal with Gerencianet API + * errors + * * @author Filipe Mata */ @@ -11,46 +14,52 @@ public class GerencianetException extends Exception { private int code = 0; private String error; private String errorDescription; - + public GerencianetException(JSONObject response) { String message = ""; - if(response.has("error_description")) + if (response.has("error_description")) { - if(response.get("error_description").getClass().getSimpleName().equals("JSONObject")){ + if (response.get("error_description").getClass().getSimpleName().equals("JSONObject")) { JSONObject errorDescription = response.getJSONObject("error_description"); - if(errorDescription.has("message")) + if (errorDescription.has("message")) message = errorDescription.getString("message"); - else message = response.get("error_description").toString(); - - if(errorDescription.has("property")) - message += ":" + errorDescription.get("property"); - } - else + else + message = response.get("error_description").toString(); + + if (errorDescription.has("property")) + message += ":" + errorDescription.get("property"); + } else message = response.get("error_description").toString(); - - if(response.has("code")) - this.code = Integer.parseInt(response.get("code").toString()); + + if (response.has("code")) + this.code = Integer.parseInt(response.get("code").toString()); this.error = response.get("error").toString(); this.errorDescription = message; - } + + } else + + message = response.get("mensagem").toString(); + this.error = response.get("nome").toString(); + this.errorDescription = message; } - + public String getError() { return error; } - + public String getErrorDescription() { return errorDescription; } + public int getCode() { return code; } - + @Override public String getMessage() { - if(this.code != 0) + if (this.code != 0) return "Error " + this.code + " - " + this.error + ": " + this.errorDescription; - else return "Error: " + this.errorDescription; + else + return "Error: " + this.errorDescription; } } - diff --git a/src/test/java/br/com/gerencianet/gnsdk/RequestTest.java b/src/test/java/br/com/gerencianet/gnsdk/RequestTest.java index 4109a3c..ee5f19a 100644 --- a/src/test/java/br/com/gerencianet/gnsdk/RequestTest.java +++ b/src/test/java/br/com/gerencianet/gnsdk/RequestTest.java @@ -85,6 +85,8 @@ public void shouldThrowExceptionForServerError() throws GerencianetException { error.put("code", 500); error.put("error_description", "internal error happenned"); error.put("error", "server internal error"); + error.put("mensagem", "internal error happenned"); + error.put("nome", "server internal error"); InputStream stream = new ByteArrayInputStream(error.toString().getBytes(StandardCharsets.UTF_8)); Mockito.when(client.getErrorStream()).thenReturn(stream); From a4e4680c14857da5ab262229de5fe3d4bd883cae Mon Sep 17 00:00:00 2001 From: Jessica Gava Date: Mon, 10 May 2021 14:57:00 -0300 Subject: [PATCH 2/2] Added API Pix endpoints --- src/main/resources/config.json | 416 +++++++++++++++++++++------------ 1 file changed, 266 insertions(+), 150 deletions(-) diff --git a/src/main/resources/config.json b/src/main/resources/config.json index 59a8b44..2f45f44 100755 --- a/src/main/resources/config.json +++ b/src/main/resources/config.json @@ -1,156 +1,272 @@ { "URL": { - "production": "https://api.gerencianet.com.br", - "sandbox": "https://sandbox.gerencianet.com.br" + "DEFAULT" : { + "production": "https://api.gerencianet.com.br", + "sandbox": "https://sandbox.gerencianet.com.br" + }, + "PIX": { + "production": "https://api-pix.gerencianet.com.br", + "sandbox": "https://api-pix-h.gerencianet.com.br" + } }, "ENDPOINTS": { - "authorize": { - "route": "/v1/authorize", - "method": "post" - }, - "createCharge": { - "route": "/v1/charge", - "method": "post" - }, - "oneStep": { - "route": "/v1/charge/one-step", - "method": "post" - }, - "detailCharge": { - "route": "/v1/charge/:id", - "method": "get" - }, - "updateChargeMetadata": { - "route": "/v1/charge/:id/metadata", - "method": "put" - }, - "updateBillet": { - "route": "/v1/charge/:id/billet", - "method": "put" - }, - "payCharge": { - "route": "/v1/charge/:id/pay", - "method": "post" - }, - "cancelCharge": { - "route": "/v1/charge/:id/cancel", - "method": "put" - }, - "createCarnet": { - "route": "/v1/carnet", - "method": "post" - }, - "detailCarnet": { - "route": "/v1/carnet/:id", - "method": "get" - }, - "updateParcel": { - "route": "/v1/carnet/:id/parcel/:parcel", - "method": "put" - }, - "updateCarnetMetadata": { - "route": "/v1/carnet/:id/metadata", - "method": "put" - }, - "getNotification": { - "route": "/v1/notification/:token", - "method": "get" - }, - "getPlans": { - "route": "/v1/plans", - "method": "get" - }, - "createPlan": { - "route": "/v1/plan", - "method": "post" - }, - "deletePlan": { - "route": "/v1/plan/:id", - "method": "delete" - }, - "createSubscription": { - "route": "/v1/plan/:id/subscription", - "method": "post" - }, - "detailSubscription": { - "route": "/v1/subscription/:id", - "method": "get" - }, - "paySubscription": { - "route": "/v1/subscription/:id/pay", - "method": "post" - }, - "cancelSubscription": { - "route": "/v1/subscription/:id/cancel", - "method": "put" - }, - "updateSubscriptionMetadata": { - "route": "/v1/subscription/:id/metadata", - "method": "put" - }, - "getInstallments": { - "route": "/v1/installments", - "method": "get" - }, - "resendBillet": { - "route": "/v1/charge/:id/billet/resend", - "method": "post" - }, - "createChargeHistory": { - "route": "/v1/charge/:id/history", - "method": "post" - }, - "resendCarnet": { - "route": "/v1/carnet/:id/resend", - "method": "post" - }, - "resendParcel": { - "route": "/v1/carnet/:id/parcel/:parcel/resend", - "method": "post" - }, - "createCarnetHistory": { - "route": "/v1/carnet/:id/history", - "method": "post" - }, - "cancelCarnet": { - "route": "/v1/carnet/:id/cancel", - "method": "put" - }, - "cancelParcel": { - "route": "/v1/carnet/:id/parcel/:parcel/cancel", - "method": "put" - }, - "linkCharge": { - "route": "/v1/charge/:id/link", - "method": "post" - }, - "chargeLink": { - "route": "/v1/charge/:id/link", - "method": "post" - }, - "updateChargeLink": { - "route": "/v1/charge/:id/link", - "method": "put" - }, - "updatePlan": { - "route": "/v1/plan/:id", - "method": "put" - }, - "createSubscriptionHistory": { - "route": "/v1/subscription/:id/history", - "method": "post" - }, - "createChargeBalanceSheet": { - "route": "/v1/charge/:id/balance-sheet", - "method": "post" - }, - "settleCharge": { - "route": "/v1/charge/:id/settle", - "method": "PUT" - }, - "settleCarnetParcel": { - "route": "/v1/carnet/:id/parcel/:parcel/settle", - "method": "PUT" - } + "DEFAULT" : { + "authorize": { + "route": "/v1/authorize", + "method": "post" + }, + "createCharge": { + "route": "/v1/charge", + "method": "post" + }, + "oneStep": { + "route": "/v1/charge/one-step", + "method": "post" + }, + "detailCharge": { + "route": "/v1/charge/:id", + "method": "get" + }, + "updateChargeMetadata": { + "route": "/v1/charge/:id/metadata", + "method": "put" + }, + "updateBillet": { + "route": "/v1/charge/:id/billet", + "method": "put" + }, + "payCharge": { + "route": "/v1/charge/:id/pay", + "method": "post" + }, + "cancelCharge": { + "route": "/v1/charge/:id/cancel", + "method": "put" + }, + "createCarnet": { + "route": "/v1/carnet", + "method": "post" + }, + "detailCarnet": { + "route": "/v1/carnet/:id", + "method": "get" + }, + "updateParcel": { + "route": "/v1/carnet/:id/parcel/:parcel", + "method": "put" + }, + "updateCarnetMetadata": { + "route": "/v1/carnet/:id/metadata", + "method": "put" + }, + "getNotification": { + "route": "/v1/notification/:token", + "method": "get" + }, + "getPlans": { + "route": "/v1/plans", + "method": "get" + }, + "createPlan": { + "route": "/v1/plan", + "method": "post" + }, + "deletePlan": { + "route": "/v1/plan/:id", + "method": "delete" + }, + "createSubscription": { + "route": "/v1/plan/:id/subscription", + "method": "post" + }, + "detailSubscription": { + "route": "/v1/subscription/:id", + "method": "get" + }, + "paySubscription": { + "route": "/v1/subscription/:id/pay", + "method": "post" + }, + "cancelSubscription": { + "route": "/v1/subscription/:id/cancel", + "method": "put" + }, + "updateSubscriptionMetadata": { + "route": "/v1/subscription/:id/metadata", + "method": "put" + }, + "getInstallments": { + "route": "/v1/installments", + "method": "get" + }, + "resendBillet": { + "route": "/v1/charge/:id/billet/resend", + "method": "post" + }, + "createChargeHistory": { + "route": "/v1/charge/:id/history", + "method": "post" + }, + "resendCarnet": { + "route": "/v1/carnet/:id/resend", + "method": "post" + }, + "resendParcel": { + "route": "/v1/carnet/:id/parcel/:parcel/resend", + "method": "post" + }, + "createCarnetHistory": { + "route": "/v1/carnet/:id/history", + "method": "post" + }, + "cancelCarnet": { + "route": "/v1/carnet/:id/cancel", + "method": "put" + }, + "cancelParcel": { + "route": "/v1/carnet/:id/parcel/:parcel/cancel", + "method": "put" + }, + "linkCharge": { + "route": "/v1/charge/:id/link", + "method": "post" + }, + "chargeLink": { + "route": "/v1/charge/:id/link", + "method": "post" + }, + "updateChargeLink": { + "route": "/v1/charge/:id/link", + "method": "put" + }, + "updatePlan": { + "route": "/v1/plan/:id", + "method": "put" + }, + "createSubscriptionHistory": { + "route": "/v1/subscription/:id/history", + "method": "post" + }, + "createChargeBalanceSheet": { + "route": "/v1/charge/:id/balance-sheet", + "method": "post" + }, + "settleCharge": { + "route": "/v1/charge/:id/settle", + "method": "put" + }, + "settleCarnetParcel": { + "route": "/v1/carnet/:id/parcel/:parcel/settle", + "method": "put" + } + }, + "PIX": { + "authorize": { + "route": "/oauth/token", + "method": "post" + }, + + "pixConfigWebhook": { + "route": "/v2/webhook/:chave", + "method": "put" + }, + "pixDetailWebhook": { + "route": "/v2/webhook/:chave", + "method": "get" + }, + "pixListWebhook": { + "route": "/v2/webhook", + "method": "get" + }, + "pixDeleteWebhook": { + "route": "/v2/webhook/:chave", + "method": "delete" + }, + + "pixCreateCharge": { + "route": "/v2/cob/:txid", + "method": "put" + }, + "pixCreateImmediateCharge": { + "route": "/v2/cob", + "method": "post" + }, + "pixDetailCharge": { + "route": "/v2/cob/:txid", + "method": "get" + }, + "pixUpdateCharge": { + "route": "/v2/cob/:txid", + "method": "patch" + }, + "pixListCharges": { + "route": "/v2/cob", + "method": "get" + }, + "pixGenerateQRCode": { + "route": "/v2/loc/:id/qrcode", + "method": "get" + }, + "pixDevolution": { + "route": "/v2/pix/:e2eId/devolucao/:id", + "method": "put" + }, + "pixDetailDevolution": { + "route": "/v2/pix/:e2eId/devolucao/:id", + "method": "get" + }, + "pixSend": { + "route": "/v2/pix", + "method": "post" + }, + "pixDetail": { + "route": "/v2/pix/:e2eId", + "method": "get" + }, + "pixListReceived": { + "route": "/v2/pix", + "method": "get" + }, + "pixCreateLocation": { + "route": "/v2/loc", + "method": "post" + }, + "pixListLocation": { + "route": "/v2/loc", + "method": "get" + }, + "pixDetailLocation": { + "route": "/v2/loc/:id", + "method": "get" + }, + "pixUnsetTxid": { + "route": "/v2/loc/:id/txid", + "method": "delete" + }, + "pixCreateEvp": { + "route": "/v2/gn/evp", + "method": "post" + }, + "pixListEvp": { + "route": "/v2/gn/evp", + "method": "get" + }, + "pixDeleteEvp": { + "route": "/v2/gn/evp/:chave", + "method": "delete" + }, + "pixDetailBalance": { + "route": "/v2/gn/saldo", + "method": "get" + }, + "pixUpdateSettings": { + "route": "/v2/gn/config", + "method": "put" + }, + "pixDetailSettings": { + "route": "/v2/gn/config", + "method": "get" + } + } } } \ No newline at end of file