-
Notifications
You must be signed in to change notification settings - Fork 0
/
01df23fa.335687f9.js
1 lines (1 loc) · 35.1 KB
/
01df23fa.335687f9.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{101:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return l})),n.d(t,"metadata",(function(){return s})),n.d(t,"rightToc",(function(){return b})),n.d(t,"default",(function(){return d}));var a=n(2),r=n(6),o=(n(0),n(250)),c=n(257),i=n(258),l={id:"Endpoints",title:"Endpoints",hide_title:!0,sidebar_label:"Endpoints"},s={id:"apiPagamentos/Endpoints",isDocsHomePage:!1,title:"Endpoints",description:"Endpoints",source:"@site/docs\\apiPagamentos\\Endpoints.md",permalink:"/documentation/docs/apiPagamentos/Endpoints",sidebar_label:"Endpoints",sidebar:"someSidebar",previous:{title:"Introdu\xe7\xe3o",permalink:"/documentation/docs/apiPagamentos/Introducao"},next:{title:"Introduction",permalink:"/documentation/docs/AberturadeContas/Introduction"}},b=[{value:"Base routes",id:"base-routes",children:[]},{value:"Get authorization",id:"get-authorization",children:[{value:"Examples of authorization using the certificate. P12",id:"examples-of-authorization-using-the-certificate-p12",children:[]}]},{value:"Getting the barcode to pay",id:"getting-the-barcode-to-pay",children:[]},{value:"Request barcode payment",id:"request-barcode-payment",children:[{value:"Get payment request",id:"get-payment-request",children:[]},{value:"Get list of payment requests",id:"get-list-of-payment-requests",children:[]}]}],u={rightToc:b};function d(e){var t=e.components,n=Object(r.a)(e,["components"]);return Object(o.b)("wrapper",Object(a.a)({},u,n,{components:t,mdxType:"MDXLayout"}),Object(o.b)("h1",{className:"titulo"},"Endpoints"),Object(o.b)("div",{className:"subtitulo"},Object(o.b)("p",null,"On this page you will find all available endpoints of the Gerencianet Payment API. We recommend that you join our community in Discord to keep up with api developments, including the release of new endpoints."),Object(o.b)("p",null,"Use the summary below to quickly navigate between api endpoint groups."),Object(o.b)("h2",{id:"base-routes"},"Base routes"),Object(o.b)("p",null,"Base route or base URL's for environments, use the route below to communicate your application with the production environment offered by Gerencianet."),Object(o.b)(c.a,{defaultValue:"production",values:[{label:"Production",value:"production"}],mdxType:"Tabs"},Object(o.b)(i.a,{value:"production",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),' "URL": {\n "Production": "https://apis.gerencianet.com.br/"\n }\n')))),Object(o.b)("h2",{id:"get-authorization"},"Get authorization"),Object(o.b)("div",{class:"gn-endpoint"},Object(o.b)("span",{class:"http-method post"},"POST"),Object(o.b)("span",{class:"endpoint"},"/oauth/token")),Object(o.b)("br",null),Object(o.b)("p",null,"This endpoint is used to authorize an application's credentials and get the scopes that the application has to access the other API endpoints. The P12/PEM certificate must be present in the authorization request for the handshake with the API server to be allowed."),Object(o.b)("h3",{id:"examples-of-authorization-using-the-certificate-p12"},"Examples of authorization using the certificate. P12"),Object(o.b)("p",null,"To use the Gerencianet Payment API, the client and server must communicate on a verified connection to each other. Verification is done by the two-way certificate (.PEM or .P12), that is, the server and client have implemented a private key certificate and a public key certificate that allows one to ensure the identity of the other."),Object(o.b)("p",null,"Therefore to make any HTTP request to the Payments API, including the authorization request with OAuth2, it is necessary the certificate .P12, or .pem, in the request headers."),Object(o.b)("p",null,"Below are examples of how to consume the Authorization of the Gerencianet Payment API by incorporating this certificate into the request."),Object(o.b)(c.a,{defaultValue:"php",values:[{label:"php",value:"php"},{label:"Node",value:"Node"},{label:"Python",value:"Python"},{label:"C#",value:"C#"},{label:"Ruby",value:"Ruby"},{label:"Java",value:"Java"},{label:"Go",value:"Go"}],mdxType:"Tabs"},Object(o.b)(i.a,{value:"php",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-php"}),'<?php //Desenvolvido pela Consultoria T\xe9cnica da Gerencianet\n\n$config = [\n "certificado" => "./certificado.pem",\n "client_id" => "YOUR-CLIENT-ID",\n "client_secret" => "YOUR-CLIENT-SECRET"\n];\n$autorizacao = base64_encode($config["client_id"] . ":" . $config["client_secret"]);\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n CURLOPT_URL => "https://apis.gerencianet.com.br/oauth/token", // Rota base, homologa\xe7\xe3o ou produ\xe7\xe3o\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => "",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 0,\n CURLOPT_FOLLOWLOCATION => true,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => "POST",\n CURLOPT_POSTFIELDS => \'{"grant_type": "client_credentials"}\',\n CURLOPT_SSLCERT => $config["certificado"], // Caminho do certificado\n CURLOPT_SSLCERTPASSWD => "",\n CURLOPT_HTTPHEADER => array(\n "Authorization: Basic $autorizacao",\n "Content-Type: application/json"\n ),\n));\n\n$response = curl_exec($curl);\n\ncurl_close($curl);\n\necho "<pre>";\necho $response;\necho "</pre>";\n'))),Object(o.b)(i.a,{value:"Node",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'//Desenvolvido pela Consultoria T\xe9cnica da Gerencianet\n\n"use strict";\nconst https = require("https");\nvar axios = require("axios");\nvar fs = require("fs");\n\n//Insira o caminho de seu certificado .p12 dentro de seu projeto\nvar certificado = fs.readFileSync("./certificado.p12");\n\n//Insira os valores de suas credenciais em desenvolvimento do pix\nvar credenciais = {\n client_id: "YOUR-CLIENT-ID",\n client_secret: "YOUR-CLIENT-SECRET",\n};\n\nvar data = JSON.stringify({ grant_type: "client_credentials" });\nvar data_credentials = credenciais.client_id + ":" + credenciais.client_secret;\n\n// Codificando as credenciais em base64\nvar auth = Buffer.from(data_credentials).toString("base64");\n\nconst agent = new https.Agent({\n pfx: certificado,\n passphrase: "",\n});\n//Consumo em desenvolvimento da rota post oauth/token\nvar config = {\n method: "POST",\n url: "https://apis.gerencianet.com.br/oauth/token",\n headers: {\n Authorization: "Basic " + auth,\n "Content-Type": "application/json",\n },\n httpsAgent: agent,\n data: data,\n};\n\naxios(config)\n .then(function (response) {\n console.log(JSON.stringify(response.data));\n })\n .catch(function (error) {\n console.log(error);\n });\n'))),Object(o.b)(i.a,{value:"Python",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-py"}),'#Desenvolvido pela Consultoria T\xe9cnica da Gerencianet\n\nimport requests\nimport base64\n\ncredentials = {\n "client_id": "YOUR-CLIENT-ID",\n "client_secret": "YOUR-CLIENT-SECRET",\n}\n\ncertificado = \'./certificado.pem\' # A vari\xe1vel certificado \xe9 o diret\xf3rio em que seu certificado em formato .pem deve ser inserido\n\nauth = base64.b64encode(\n (f"{credentials[\'client_id\']}:{credentials[\'client_secret\']}"\n ).encode()).decode()\n\nurl = "https://apis.gerencianet.com.br/oauth/token" #Para ambiente de Desenvolvimento\n\npayload="{\\r\\n \\"grant_type\\": \\"client_credentials\\"\\r\\n}"\nheaders = {\n \'Authorization\': f"Basic {auth}",\n \'Content-Type\': \'application/json\'\n}\n\nresponse = requests.request("POST",\n url,\n headers=headers,\n data=payload,\n cert=certificado)\n\nprint(response.text)\n'))),Object(o.b)(i.a,{value:"C#",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'//Desenvolvido pela Consultoria T\xe9cnica da Gerencianet\n\nusing System;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Collections.Generic;\nusing RestSharp;\n\nnamespace PixGerencianet\n{\n class Authorize\n {\n public static string Base64Encode(string plainText)\n {\n var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);\n return System.Convert.ToBase64String(plainTextBytes);\n }\n\n static void Main(string[] args)\n {\n\n var credencials = new Dictionary<string, string>{\n {"client_id", "YOUR-CLIENT-ID"},\n {"client_secret", "YOUR-CLIENT-SECRET"}\n };\n var authorization = Base64Encode(credencials["client_id"] + ":" + credencials["client_secret"]);\n var client = new RestSharp.RestClient("https://apis.gerencianet.com.br/oauth/token");\n var request = new RestRequest(Method.POST);\n\n X509Certificate2 uidCert = new X509Certificate2("./certificado.p12", "");\n client.ClientCertificates = new X509CertificateCollection() { uidCert };\n\n request.AddHeader("Authorization", "Basic " + authorization);\n request.AddHeader("Content-Type", "application/json");\n request.AddParameter("application/json", "{\\r\\n \\"grant_type\\": \\"client_credentials\\"\\r\\n}", ParameterType.RequestBody);\n \n IRestResponse restResponse = client.Execute(request);\n string response = restResponse.Content;\n\n Console.WriteLine(response);\n }\n }\n}\n'))),Object(o.b)(i.a,{value:"Ruby",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'#Desenvolvido pela Consultoria T\xe9cnica da Gerencianet\n\nrequire "uri"\nrequire "net/http"\nrequire "openssl"\n\nclient_id = "YOUR-CLIENT-ID";\nclient_secret = "YOUR-CLIENT-SECRET";\n\ncertfile = File.read("certificado.pem") # A vari\xe1vel certfile \xe9 o diret\xf3rio em que seu certificado em formato .pem deve ser inserido\n\nurl = URI("https://apis.gerencianet.com.br/oauth/token") #Para ambiente de Desenvolvimento\n\nhttps = Net::HTTP.new(url.host, url.port);\nhttps.use_ssl = true\nhttps.cert = OpenSSL::X509::Certificate.new(certfile)\nhttps.key = OpenSSL::PKey::RSA.new(certfile)\n\nrequest = Net::HTTP::Post.new(url)\nrequest.basic_auth(client_id, client_secret)\nrequest["Content-Type"] = "application/json"\nrequest.body = "{\\r\\n \\"grant_type\\": \\"client_credentials\\"\\r\\n}"\n\nresponse = https.request(request)\nputs response.read_body\n'))),Object(o.b)(i.a,{value:"Java",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-java"}),'//Desenvolvido pela Consultoria T\xe9cnica da Gerencianet\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.net.URL;\nimport java.util.Base64;\n\nimport javax.net.ssl.HttpsURLConnection;\nimport javax.net.ssl.SSLSocketFactory;\n\npublic class Auth {\n public static void main(String[] args) throws Exception {\n String client_id = "YOUR-CLIENT-ID";\n String client_secret = "YOUR-CLIENT-SECRET";;\n String basicAuth = Base64.getEncoder().encodeToString(((client_id+\':\'+client_secret).getBytes()));\n \n //Diret\xf3rio em que seu certificado em formato .p12 deve ser inserido\n System.setProperty("javax.net.ssl.keyStore", "certificado.p12"); \n SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();\n \n URL url = new URL ("https://apis.gerencianet.com.br/oauth/token"); //Para ambiente de Desenvolvimento \n HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();\n conn.setDoOutput(true);\n conn.setRequestMethod("POST");\n conn.setRequestProperty("Content-Type", "application/json");\n conn.setRequestProperty("Authorization", "Basic "+ basicAuth);\n conn.setSSLSocketFactory(sslsocketfactory);\n String input = "{\\"grant_type\\": \\"client_credentials\\"}";\n \n OutputStream os = conn.getOutputStream();\n os.write(input.getBytes());\n os.flush(); \n\n InputStreamReader reader = new InputStreamReader(conn.getInputStream());\n BufferedReader br = new BufferedReader(reader);\n\n String response;\n while ((response = br.readLine()) != null) {\n System.out.println(response);\n }\n conn.disconnect();\n\n }\n}\n'))),Object(o.b)(i.a,{value:"Go",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-go"}),'//Desenvolvido pela Consultoria T\xe9cnica da Gerencianet\npackage main\n\nimport (\n "fmt"\n "strings"\n "net/http"\n "io/ioutil"\n "crypto/tls"\n)\n\nconst(\n client_id = "YOUR-CLIENT-ID"\n client_secret = "YOUR-CLIENT-SECRET"\n)\n\nfunc main() {\n\n url := "https://apis.gerencianet.com.br/oauth/token"// Rota base, homologa\xe7\xe3o ou produ\xe7\xe3o\n method := "POST"\n\n payload := strings.NewReader(`{"grant_type": "client_credentials"}`)\n\n\n cert, _ := tls.LoadX509KeyPair("CA.crt.pem", "KEY.crt.pem")// Seu certificado e chave privada gerada a partir dos comandos de convers\xe3o OpenSSL\n\n client := &http.Client{\n Transport: &http.Transport{\n TLSClientConfig: &tls.Config{\n Certificates: []tls.Certificate{cert},\n },\n },\n}\n\n req, err := http.NewRequest(method, url, payload)\n\n if err != nil {\n fmt.Println(err)\n return\n }\n req.SetBasicAuth(client_id, client_secret)\n req.Header.Add("Content-Type", "application/json")\n\n res, err := client.Do(req)\n if err != nil {\n fmt.Println(err)\n return\n }\n defer res.Body.Close()\n\n body, err := ioutil.ReadAll(res.Body)\n if err != nil {\n fmt.Println(err)\n return\n }\n fmt.Println(string(body))\n}\n')))),Object(o.b)("br",null),Object(o.b)("b",null,"Authorization example of response"),Object(o.b)("br",null),"The code snippet below represents an example of OAuth's response to your authorization request.",Object(o.b)(c.a,{defaultValue:"response",values:[{label:"Response",value:"response"}],mdxType:"Tabs"},Object(o.b)(i.a,{value:"response",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",\n "token_type": "Bearer",\n "expires_in": 3600,\n "scope": "gn.barcode.read gn.barcode.pay.write gn.barcode.pay.read"\n}\n')))),Object(o.b)("h1",{id:"payments"},"Payments"),Object(o.b)("h2",{id:"getting-the-barcode-to-pay"},"Getting the barcode to pay"),Object(o.b)("div",{class:"gn-endpoint"},Object(o.b)("span",{class:"http-method get"},"GET"),Object(o.b)("span",{class:"endpoint"},"/pagamento/codBarras/",Object(o.b)("span",{class:"variable"},":codBarras")))," ",Object(o.b)("br",null),Object(o.b)("p",null,"This endpoint should be used to get the information linked to a barcode of any type of billing. The use of this endpoint is mandatory before making a payment, as it helps prevent errors in processing."),Object(o.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"Important")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"There are two types of charges and they can return different information. Are they:"),Object(o.b)("ol",{parentName:"div"},Object(o.b)("li",{parentName:"ol"},Object(o.b)("p",{parentName:"li"},'Tribute type \u2013 also known as bonds and agreements, this type of charge is issued by services such as: water, electricity, telephone and gas bills. They are not registered with the "C\xe2mara Interbanc\xe1ria de Pagamento" (CIP) and, therefore, do not return the same information that a boleto registered with the CIP presents.')),Object(o.b)("li",{parentName:"ol"},Object(o.b)("p",{parentName:"li"},'Boleto type \u2013 registered with the "C\xe2mara Interbanc\xe1ria de Pagamento" (CIP) and, therefore, after being consulted, the endpoint returns more complete information about the payment.'))),Object(o.b)("p",{parentName:"div"},"In the item \u201cResponses\u201d, below, you can check the return of the queries of each type of charge."))),Object(o.b)("b",null,"Requires authorization for the scope: ",Object(o.b)("code",null,"gn.barcode.read")),Object(o.b)("br",null),Object(o.b)("br",null),Object(o.b)("b",null,"Request"),Object(o.b)("br",null),"This endpoint uses query params in its operation, so they must be sent via the URL, as exemplified in the code snippet below.",Object(o.b)("br",null),Object(o.b)("br",null),Object(o.b)("code",null,"/pagamento/codBarras/:codBarras"),Object(o.b)("br",null),Object(o.b)("br",null),Object(o.b)("h4",{id:"parameters-definition"},"Parameters Definition"),Object(o.b)("table",null,Object(o.b)("tbody",null,Object(o.b)("tr",null,Object(o.b)("th",null,"Attribute"),Object(o.b)("th",{align:"center"},"Description"),Object(o.b)("th",{align:"center"},"Required"),Object(o.b)("th",{align:"center"},"Type")),Object(o.b)("tr",null,Object(o.b)("td",null,Object(o.b)("b",null,"codBarras")),Object(o.b)("td",{align:"left"},"Charge barcode, this code can also be the typeable line returned via API by the 'barcode'."),Object(o.b)("td",{align:"center"},"yes"),Object(o.b)("td",null,"String ",Object(o.b)("br",null))))),Object(o.b)("b",null,"Response")," ",Object(o.b)("br",null),"The answers below represent Success and Failures of consumption.",Object(o.b)(c.a,{defaultValue:"200",values:[{label:"200 (barcode type)",value:"200"},{label:"200 (tributte type)",value:"200t"},{label:"400",value:"400"}],mdxType:"Tabs"},Object(o.b)(i.a,{value:"200",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{{\n "tipo": "boleto",\n "banco": {\n "codigo": 364,\n "nome": "Gerencianet S.A."\n },\n "codBarras": "0000000000000000000000000000000000",\n "linhaDigitavel": "000000000000000000000000000000000",\n "datas": {\n "vencimento": "2021-06-22 14:23:42",\n "limitePagamento": "2021-09-22 14:23:42"\n },\n "beneficiario": {\n "nome": "Jo\xe3o da Silva",\n "fantasia": "Padaria do Jo\xe3o",\n "documento": "00000000000000"\n },\n "pagador": {\n "nome": "Gorbadock Oldbuck",\n "documento": "00000000000"\n },\n "valores": {\n "original": 1000,\n "abatimento": 0,\n "multa": 200,\n "juros": 2,\n "desconto": 300,\n "final": 902\n },\n "informacoesPagamento": {\n "divergente": {\n "deveAceitar": false,\n "valorMinimo": 0,\n "valorMaximo": 0\n },\n "parcial": {\n "deveAceitar": false,\n "limiteDePagamentos": 0\n },\n "podeSerPago": true\n }\n}\n'))),Object(o.b)(i.a,{value:"200t",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "tipo": "tributo",\n "banco": null,\n "codBarras": "84620000000470000113222928260060772936353800",\n "linhaDigitavel": "846200000004470000113220292826006077729363538004",\n "datas": {\n "vencimento": "contraApresentacao",\n "limitePagamento": null\n },\n "beneficiario": null,\n "pagador": null,\n "sacadorAvalista": null,\n "valores": {\n "original": 4700,\n "abatimento": null,\n "pago": null,\n "final": 4700\n },\n "informacoesPagamento": null\n}\n'))),Object(o.b)(i.a,{value:"400",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "erro": 0,\n "descricao": "C\xf3digo de barras inv\xe1lido"\n}\n\nOr\n\n{\n "nome": "erro_de_validacao",\n "mensagem": "C\xf3digo de barras inv\xe1lido"\n}\n\nOr\n\n{\n "mensagem": "must NOT have more than 48 characters"\n}\n\n{\n "mensagem": "must NOT have fewer than 44 characters"\n}\n\nOr\n\n{\n "nome": "Error",\n "mensagem": "must be number"\n}\n\nOr\n\n{\n "nome": "erro_de_validacao",\n "mensagem": "C\xf3digo de barras n\xe3o localizado na base centralizada"\n}\n')))),Object(o.b)("h2",{id:"request-barcode-payment"},"Request barcode payment"),Object(o.b)("div",{class:"gn-endpoint"},Object(o.b)("span",{class:"http-method post"},"POST"),Object(o.b)("span",{class:"endpoint"},"/pagamento/codBarras/",Object(o.b)("span",{class:"variable"},":codBarras")))," ",Object(o.b)("br",null),Object(o.b)("p",null,"This endpoint should be used to request payment for a barcode for the current or future date."),Object(o.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"Important")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"Barcode payments are accepted until 10pm. Tax payments and bills (water, energy, cable TV, gas and telephone) are until 6pm."))),Object(o.b)("b",null,"Requires the scope: ",Object(o.b)("code",null,"gn.barcode.pay.write")),Object(o.b)("br",null),Object(o.b)("br",null),Object(o.b)("b",null,"Request"),Object(o.b)("br",null),"This endpoint uses query params, so they should be sent by the URL, as exemplified in the code snippet below.",Object(o.b)("br",null),Object(o.b)("br",null),Object(o.b)("code",null,"/pagamento/codBarras/:codBarras"),Object(o.b)("br",null),Object(o.b)("b",null,"Request body"),Object(o.b)(c.a,{defaultValue:"example",values:[{label:"Example",value:"example"}],mdxType:"Tabs"},Object(o.b)(i.a,{value:"example",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "valor": 500,\n "dataPagamento": "2022-03-10",\n "descricao": "Pagamento de boleto, teste API Pagamentos"\n}\n\n')))),Object(o.b)("h4",{id:"params-definition"},"Params definition"),Object(o.b)("table",null,Object(o.b)("tbody",null,Object(o.b)("tr",null,Object(o.b)("th",null,"Attribute"),Object(o.b)("th",{align:"center"},"Description"),Object(o.b)("th",{align:"center"},"Required"),Object(o.b)("th",{align:"center"},"Type")),Object(o.b)("tr",null,Object(o.b)("td",null,Object(o.b)("b",null,"codBarras")),Object(o.b)("td",{align:"left"},"barcode of the bill that is about to pay."),Object(o.b)("td",{align:"center"},"yes"),Object(o.b)("td",null,"String ",Object(o.b)("br",null))),Object(o.b)("tr",null,Object(o.b)("td",null,Object(o.b)("b",null,"dataPagamento")),Object(o.b)("td",{align:"left"},"Payment due date."),Object(o.b)("td",{align:"center"},"yes"),Object(o.b)("td",null,"string. In the format YYYY-MM-DD",Object(o.b)("br",null))),Object(o.b)("tr",null,Object(o.b)("td",null,Object(o.b)("b",null,"valor")),Object(o.b)("td",{align:"left"},"Charge amount."),Object(o.b)("td",{align:"center"},"yes"),Object(o.b)("td",null,"Integer. Value in BRL cents. Ex: R$10,00 = 1000 ",Object(o.b)("br",null))),Object(o.b)("tr",null,Object(o.b)("td",null,Object(o.b)("b",null,"descricao")),Object(o.b)("td",{align:"left"},"payment description."),Object(o.b)("td",{align:"center"},"no"),Object(o.b)("td",null,"String ",Object(o.b)("br",null))))),Object(o.b)("b",null,"Response"),Object(o.b)("br",null),"The answers below represent Success and Consumption Failures.",Object(o.b)(c.a,{defaultValue:"200",values:[{label:"200",value:"200"},{label:"400",value:"400"}],mdxType:"Tabs"},Object(o.b)(i.a,{value:"200",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "idPagamento": "31234652",\n "valorPago": 500,\n "status": "LIQUIDADO",\n "data": {\n "solicitacao": "2021-06-22 14:23:42",\n "pagamento": "2021-06-25 13:03:20"\n }\n}\n\n'))),Object(o.b)(i.a,{value:"400",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "erro": 0,\n "descricao": "C\xf3digo de barras inv\xe1lido"\n}\n\n')))),Object(o.b)("br",null),Object(o.b)("br",null),Object(o.b)("h3",{id:"get-payment-request"},"Get payment request"),Object(o.b)("div",{class:"gn-endpoint"},Object(o.b)("span",{class:"http-method get"},"GET"),Object(o.b)("span",{class:"endpoint"},"/pagamento/",Object(o.b)("span",{class:"variable"},":idPagamento")))," ",Object(o.b)("br",null),Object(o.b)("p",null,"Check the status of the payment request previously using the ",Object(o.b)("code",null,"idPagamento"),"."),Object(o.b)("b",null,"Requires the scope: ",Object(o.b)("code",null,"gn.barcode.pay.read")),Object(o.b)("br",null),Object(o.b)("br",null),Object(o.b)("b",null,"Request"),Object(o.b)("br",null),"This endpoint uses query params, so they should be sent by the URL, as exemplified in the code snippet below.",Object(o.b)("br",null),Object(o.b)("br",null),Object(o.b)("code",null,"/pagamento/:idPagamento"),Object(o.b)("h4",{id:"params-definition-1"},"Params definition"),Object(o.b)("table",null,Object(o.b)("tbody",null,Object(o.b)("tr",null,Object(o.b)("th",null,"Attribute"),Object(o.b)("th",{align:"center"},"Description"),Object(o.b)("th",{align:"center"},"Required"),Object(o.b)("th",{align:"center"},"Type")),Object(o.b)("tr",null,Object(o.b)("td",null,Object(o.b)("b",null,"idPagamento")),Object(o.b)("td",{align:"left"},"Id generated in the payment request"),Object(o.b)("td",{align:"center"},"yes"),Object(o.b)("td",null,"String ",Object(o.b)("br",null))),Object(o.b)("tr",null,Object(o.b)("td",null,Object(o.b)("b",null,"status")),Object(o.b)("td",{align:"left"},"The status field represents the status of the requested payment. It can assume the following states:",Object(o.b)("br",null),Object(o.b)("code",null,"EM_PROCESSAMENTO")," - (processing) The payment request has been received and is being processed.",Object(o.b)("br",null),Object(o.b)("code",null,"AGENDADO")," - (scheduled) Payment was scheduled to be made on the requested date.",Object(o.b)("br",null),Object(o.b)("code",null,"REALIZADO")," - (done) Payment has been successfully sent to be settled.",Object(o.b)("br",null),Object(o.b)("code",null,"LIQUIDADO")," - (settled) Payment has been successfully settled.",Object(o.b)("br",null),Object(o.b)("code",null,"CANCELADO")," - (canceled) The payment was canceled and the amount refunded.",Object(o.b)("br",null),Object(o.b)("code",null,"NAO_REALIZADO")," - (not done) The payment had an error and was not sent for settlement.",Object(o.b)("br",null)),Object(o.b)("td",{align:"center"},"no"),Object(o.b)("td",null,"String",Object(o.b)("br",null))))),Object(o.b)("b",null,"Response"),Object(o.b)("br",null),"The answers below represent Success and Consumption Failures.",Object(o.b)(c.a,{defaultValue:"200",values:[{label:"200 (settled)",value:"200"},{label:"200 (Fail)",value:"200f"},{label:"400",value:"400"}],mdxType:"Tabs"},Object(o.b)(i.a,{value:"200",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "idPagamento": "304578214",\n "valorPago": 1000,\n "status": "LIQUIDADO",\n "motivoRecusa": null,\n "data": {\n "solicitacao": "2021-09-22 14:23:42",\n "pagamento": "2021-09-22 10:23:42"\n }\n}\n\n'))),Object(o.b)(i.a,{value:"200f",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "idPagamento": 524090299,\n "codBarras": "36400000000000000000000000000000000000000000",\n "linhaDigitavel": "36400000000000000000000000000000000000000000000",\n "valorPago": 2000,\n "status": "NAO_REALIZADO",\n "retornoBancario": "Limite mensal excedido.",\n "protocolo": null,\n "descricao": "Gerencianet S.A.",\n "horario": {\n "solicitacao": "2022-04-01T12:47:04.000Z"\n }\n}\n'))),Object(o.b)(i.a,{value:"400",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "erro": 0,\n "descricao": "Pagamento n\xe3o encontrado"\n}\n\n')))),Object(o.b)("h3",{id:"get-list-of-payment-requests"},"Get list of payment requests"),Object(o.b)("div",{class:"gn-endpoint"},Object(o.b)("span",{class:"http-method get"},"GET"),Object(o.b)("span",{class:"endpoint"},"/pagamento/resumo"))," ",Object(o.b)("br",null),Object(o.b)("b",null,"Requires the scope: ",Object(o.b)("code",null,"gn.barcode.pay.read")),Object(o.b)("p",null,"This endpoint should be used to request a summary of payment requests made within an informed period."),Object(o.b)("b",null,"Request"),Object(o.b)("br",null),"This endpoint uses query params, so they should be sent by the URL, as exemplified in the code snippet below.",Object(o.b)("table",null,Object(o.b)("tbody",null,Object(o.b)("tr",null,Object(o.b)("th",null,"Attribute"),Object(o.b)("th",{align:"center"},"Description"),Object(o.b)("th",{align:"center"},"Required"),Object(o.b)("th",{align:"center"},"Type")),Object(o.b)("tr",null,Object(o.b)("td",null,Object(o.b)("b",null,"dataInicio")),Object(o.b)("td",{align:"left"},"Inicial date to show the list."),Object(o.b)("td",{align:"center"},"yes"),Object(o.b)("td",null,"string Ex: XXXX-XX-XX",Object(o.b)("br",null))),Object(o.b)("tr",null,Object(o.b)("td",null,Object(o.b)("b",null,"dataFim")),Object(o.b)("td",{align:"left"},"Final date to show on the list."),Object(o.b)("td",{align:"center"},"yes"),Object(o.b)("td",null,"string Ex: XXXX-XX-XX",Object(o.b)("br",null))))),Object(o.b)("b",null,"Responses"),Object(o.b)("br",null),"The answers below represent Success and Failures.",Object(o.b)(c.a,{defaultValue:"200",values:[{label:"200",value:"200"},{label:"400",value:"400"}],mdxType:"Tabs"},Object(o.b)(i.a,{value:"200",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "idPagamento": "304578214",\n "valorPago": 1000,\n "status": "LIQUIDADO",\n "motivoRecusa": null,\n "data": {\n "solicitacao": "2021-09-22 14:23:42",\n "pagamento": "2021-09-22 10:23:42"\n }\n}\n\n'))),Object(o.b)(i.a,{value:"400",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "nome": "string",\n "mensagem": "string"\n}\n\n'))))))}d.isMDXComponent=!0},250:function(e,t,n){"use strict";n.d(t,"a",(function(){return u})),n.d(t,"b",(function(){return m}));var a=n(0),r=n.n(a);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=r.a.createContext({}),b=function(e){var t=r.a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=b(e.components);return r.a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},p=r.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=b(n),p=a,m=u["".concat(c,".").concat(p)]||u[p]||d[p]||o;return n?r.a.createElement(m,i(i({ref:t},s),{},{components:n})):r.a.createElement(m,i({ref:t},s))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,c=new Array(o);c[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,c[1]=i;for(var s=2;s<o;s++)c[s]=n[s];return r.a.createElement.apply(null,c)}return r.a.createElement.apply(null,n)}p.displayName="MDXCreateElement"},254:function(e,t,n){"use strict";function a(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=a(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}t.a=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=a(e))&&(r&&(r+=" "),r+=t);return r}},255:function(e,t,n){"use strict";var a=n(0);const r=Object(a.createContext)({tabGroupChoices:{},setTabGroupChoices:()=>{},isAnnouncementBarClosed:!1,closeAnnouncementBar:()=>{}});t.a=r},256:function(e,t,n){"use strict";var a=n(0),r=n(255);t.a=function(){return Object(a.useContext)(r.a)}},257:function(e,t,n){"use strict";var a=n(0),r=n.n(a),o=n(256),c=n(254),i=n(92),l=n.n(i);const s=37,b=39;t.a=function(e){const{block:t,children:n,defaultValue:i,values:u,groupId:d}=e,{tabGroupChoices:p,setTabGroupChoices:m}=Object(o.a)(),[O,j]=Object(a.useState)(i);if(null!=d){const e=p[d];null!=e&&e!==O&&u.some(t=>t.value===e)&&j(e)}const h=e=>{j(e),null!=d&&m(d,e)},g=[];return r.a.createElement("div",null,r.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(c.a)("tabs",{"tabs--block":t})},u.map(({value:e,label:t})=>r.a.createElement("li",{role:"tab",tabIndex:"0","aria-selected":O===e,className:Object(c.a)("tabs__item",l.a.tabItem,{"tabs__item--active":O===e}),key:e,ref:e=>g.push(e),onKeyDown:e=>((e,t,n)=>{switch(n.keyCode){case b:((e,t)=>{const n=e.indexOf(t)+1;e[n]?e[n].focus():e[0].focus()})(e,t);break;case s:((e,t)=>{const n=e.indexOf(t)-1;e[n]?e[n].focus():e[e.length-1].focus()})(e,t)}})(g,e.target,e),onFocus:()=>h(e),onClick:()=>h(e)},t))),r.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},a.Children.toArray(n).filter(e=>e.props.value===O)[0]))}},258:function(e,t,n){"use strict";var a=n(0),r=n.n(a);t.a=function(e){return r.a.createElement("div",null,e.children)}}}]);