-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path297a6405.4df00cad.js
1 lines (1 loc) · 19.3 KB
/
297a6405.4df00cad.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[33],{134:function(e,n,a){"use strict";a.r(n),a.d(n,"frontMatter",(function(){return s})),a.d(n,"metadata",(function(){return l})),a.d(n,"rightToc",(function(){return b})),a.d(n,"default",(function(){return p}));var t=a(2),r=a(6),o=(a(0),a(250)),c=a(257),i=a(258),s={id:"PessoaJuridica",title:"Pagar com Pessoa Jur\xeddica",hide_title:!0,sidebar_label:"Paying with Juridical Person"},l={id:"OutrosRecursos/PessoaJuridica",isDocsHomePage:!1,title:"Pagar com Pessoa Jur\xeddica",description:"Paying with Juridical Person",source:"@site/docs\\OutrosRecursos\\PessoaJuridica.md",permalink:"/documentation/docs/OutrosRecursos/PessoaJuridica",sidebar_label:"Paying with Juridical Person",sidebar:"someSidebar",previous:{title:"Marcar como Pago",permalink:"/documentation/docs/OutrosRecursos/MarcarPago"},next:{title:"Reenvio de Transa\xe7\xf5es",permalink:"/documentation/docs/OutrosRecursos/ReenvioTransacoes"}},b=[{value:"a) Hierarchical structure of Schema attributes that can be used:",id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used",children:[]},{value:"b) Attributes to be sent (legal entity data):",id:"b-attributes-to-be-sent-legal-entity-data",children:[]}],u={rightToc:b};function p(e){var n=e.components,a=Object(r.a)(e,["components"]);return Object(o.b)("wrapper",Object(t.a)({},u,a,{components:n,mdxType:"MDXLayout"}),Object(o.b)("h1",{className:"titulo"},"Paying with Juridical Person"),Object(o.b)("div",{className:"subtitulo"},Object(o.b)("p",null,"The customer associated with the transaction can be a ",Object(o.b)("strong",{parentName:"p"},"Juridical Person"),". In this case, the Company's Corporate Name and CNPJ must be informed. "),Object(o.b)("p",null,"For ",Object(o.b)("strong",{parentName:"p"},"Juridical Person"),", in the case of issuance of slips, it will not be mandatory to send name and CPF, only the other customer data. However, if you want to send your name and CPF, they will be useful to identify the person who is making the payment on behalf of the company. Otherwise, you can omit the ",Object(o.b)("code",null,"cpf")," attribute in the ",Object(o.b)("code",null,"customer")," ",Object(o.b)("em",{parentName:"p"},"array")," and proceed with providing the ",Object(o.b)("code",null,"cnpj"),". "),Object(o.b)("p",null,"The rest of this page has the detailed procedures, but you need to install one of our libraries on your server to run the sample code. ",Object(o.b)("a",Object(t.a)({parentName:"p"},{href:"../Instalacao/introducao"}),"Make sure that the Gerencianet SDK has been installed"),"."),Object(o.b)("p",null,"The example below shows how this can be done, using the SDK's available:"),Object(o.b)(c.a,{defaultValue:"php",values:[{label:"PHP",value:"php"},{label:"Python",value:"python"},{label:"NodeJS",value:"js"},{label:".NET",value:"c"},{label:"Java",value:"java"},{label:"GO",value:"go"},{label:"Ruby",value:"ruby"},{label:"Delphi",value:"delphi"}],mdxType:"Tabs"},Object(o.b)(i.a,{value:"php",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(t.a)({parentName:"pre"},{className:"language-php"}),"<?php\n \nrequire __DIR__.'/../../vendor/autoload.php'; // SDK-related path\n \nuse Gerencianet\\Exception\\GerencianetException;\nuse Gerencianet\\Gerencianet;\n \n$clientId = 'informe_seu_client_id'; // enter your Client_Id, depending on the environment (Des or Prod)\n$clientSecret = 'informe_seu_client_secret'; // enter your Client_Secret, depending on the environment (Des or Prod)\n\n$options = [\n 'client_id' => $clientId,\n 'client_secret' => $clientSecret,\n 'sandbox' => true // change according to the environment (true = development and false = production)\n];\n \n// $charge_id refers to the transaction ID (\"charge_id\")\n$params = [\n 'id' => $charge_id\n];\n \n$juridical_data = [\n 'corporate_name' => 'Nome da Empresa', // name of company name\n 'cnpj' => '99794567000144' // CNPJ of the company, with 14 characters\n];\n \n$customer = [\n 'name' => 'Gorbadoc Oldbuck', // client name\n 'cpf' => '94271564656', // client cpf [optional]\n 'phone_number' => '5144916523', // customer phone\n 'juridical_person' => $juridical_data\n];\n \n$banking_billet = [\n 'expire_at' => '2017-12-20',\n 'customer' => $customer\n];\n \n$payment = [\n 'banking_billet' => $banking_billet \n];\n \n$body = [\n 'payment' => $payment\n];\n \ntry {\n $api = new Gerencianet($options);\n $charge = $api->payCharge($params, $body);\n \n print_r($charge);\n} catch (GerencianetException $e) {\n print_r($e->code);\n print_r($e->error);\n print_r($e->errorDescription);\n} catch (Exception $e) {\n print_r($e->getMessage());\n}\n"))),Object(o.b)(i.a,{value:"python",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(t.a)({parentName:"pre"},{className:"language-py"}),"from gerencianet import Gerencianet\n \noptions = {\n 'client_id': 'client_id',\n 'client_secret': 'client_secret',\n 'sandbox': True\n}\n \ngn = Gerencianet(options)\n \nparams = {\n 'id': 1000\n}\n \nbody = {\n 'payment': {\n 'banking_billet': {\n 'expire_at': '2020-12-12',\n 'customer': {\n 'name': 'Gorbadoc Oldbuck',\n 'cpf': '94271564656',\n 'phone_number': '5144916523',\n 'juridical_person': {\n 'corporate_name': 'Company Name',\n 'cnpj': '99794567000144'\n }\n }\n }\n }\n}\n \ngn.pay_charge(params=params, body=body)\n"))),Object(o.b)(i.a,{value:"js",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n \nvar moment = require('moment');\nvar Gerencianet = require('gn-api-sdk-node');\n \nvar clientId = 'your_client_id';\nvar clientSecret = 'your_client_secret';\n \nvar options = {\n client_id: clientId,\n client_secret: clientSecret,\n sandbox: true\n}\n \nvar tomorrow = moment()\n .add(1, 'days')\n .format('YYYY-MM-DD');\n \nvar params = {\n id: 1000\n}\n \nvar body = {\n payment: {\n banking_billet: {\n expire_at: tomorrow,\n customer: {\n name: 'Gorbadoc Oldbuck',\n cpf: '94271564656',\n phone_number: '5144916523',\n juridical_person: {\n corporate_name: 'Company Name',\n cnpj: '99794567000144'\n }\n }\n }\n }\n}\n \nvar gerencianet = new Gerencianet(options);\n \ngerencianet\n .payCharge(params, body)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(o.b)(i.a,{value:"c",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'dynamic endpoints = new Endpoints("client_id", "client_secret", true);\n \nvar params = new {\n id = 1000\n};\n \n var body = new {\n payment = new {\n banking_billet = new {\n expire_at = "2017-12-12",\n customer = new {\n name = "Gorbadoc Oldbuck",\n email = "[email protected]",\n cpf = "94271564656",\n birth = "1977-01-15",\n phone_number = "5144916523",\n juridical_person = new {\n corporate_name = "Company Name",\n cnpj = "99794567000144"\n }\n }\n }\n }\n };\n \nvar response = endpoints.PayCharge(params, body);\n'))),Object(o.b)(i.a,{value:"java",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(t.a)({parentName:"pre"},{className:"language-java"}),'/* Para que a SDK Java funcione corretamente, \xe9 necess\xe1rio que a instancia\xe7\xe3o do m\xf3dulo seja feita atrav\xe9s da cria\xe7\xe3o de um objeto do tipo Gerencianet.\n\nSempre que quisermos chamar uma fun\xe7\xe3o da API, basta invocar o m\xe9todo call do objeto Gerencianet, passando como par\xe2metro o nome do m\xe9todo, os par\xe2metros da requisi\xe7\xe3o (sempre ser\xe1 um HashMap<String, String>), e o "body", que consiste nas propriedades a serem passadas como argumento na chamada de um fun\xe7\xe3o da SDK. O "body" pode ser declarado de duas formas: um JSONObject ou um Map<String, Object>.\n\nEsta estrutura \xe9 necess\xe1ria para representar o corpo da requisi\xe7\xe3o http que \xe9 enviada \xe0 um determinado endpoint. Se o "body" for um JSONObject, o retorno do m\xe9todo call ser\xe1 um JSONObject, se for um Map<String, Object>, o retorno do m\xe9todo call ser\xe1 um Map<String, Object>\n\nA seguir, disponibilizamos links de nosso Github mostrando duas formas diferentes de retorno: JSONObject\ne Map<String, Object>\n\n\nJSONObject (pagamento pessoa jur\xeddica - boleto)\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/charge/json/JuridicalPersonBilletPayment.java\n\n\nJSONObject (pagamento pessoa jur\xeddica - cart\xe3o)\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/charge/json/JuridicalPersonCardPayment.java\n\n\n\nMap<String, Object> (pagamento pessoa jur\xeddica - boleto)\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/charge/map/JuridicalPersonBilletPayment.java\n\n\nMap<String, Object> (pagamento pessoa jur\xeddica - cart\xe3o)\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/charge/map/JuridicalPersonCardPayment.java\n\n\n\n*/\n'))),Object(o.b)(i.a,{value:"go",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(t.a)({parentName:"pre"},{className:"language-go"}),'// No c\xf3digo de exemplo de uso da SDK de Go, definimos as credenciais de acesso \xe0 API (Client_Id e Client_Secret) e o ambiente a ser usado (sandbox como \'true\' ou \'false\') dentro de um arquivo espec\xedfico (configs.go), que est\xe1 localizado no diret\xf3rio "_examples/configs". Essas credenciais s\xe3o exportadas atrav\xe9s da vari\xe1vel \'Credentials\'.\n\npackage main\n\nimport (\n "fmt"\n "github.com/gerencianet/gn-api-sdk-go/gerencianet"\n "github.com/gerencianet/gn-api-sdk-go/_examples/configs"\n)\n\nfunc main(){\n \n credentials := configs.Credentials\n gn := gerencianet.NewGerencianet(credentials)\n\n juridical_data := map[string]interface{}{\n "corporate_name": "Company Name",\n "cnpj": "99794567000144",\n }\n\n customer := map[string]interface{}{\n "name": "Gorbadoc Oldbuck",\n "cpf": "04267484171",\n "phone_number": "5144916523",\n "juridical_person": juridical_data,\n }\n\n body := map[string]interface{} {\n "payment": map[string]interface{} {\n "banking_billet": map[string]interface{} {\n "expire_at": "2018-12-12",\n "customer": customer,\n },\n },\n }\n\n res, err := gn.PayCharge(1, body) // no lugar do 1 coloque o charge_id certo\n\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(o.b)(i.a,{value:"ruby",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),"require \"gerencianet\"\n \noptions = {\n client_id: \"client_id\",\n client_secret: \"client_secret\",\n sandbox: true\n}\n \nparams = {\n id: 1000\n}\n \nbody = {\n payment: {\n banking_billet: {\n expire_at: tomorrow,\n customer: {\n name: 'Gorbadoc Oldbuck',\n cpf: '94271564656',\n phone_number: '5144916523',\n juridical_person: {\n corporate_name: 'Company Name',\n cnpj: '99794567000144'\n }\n }\n }\n }\n}\n \ngerencianet = Gerencianet.new(options)\ngerencianet.pay_charge(params: params, body: body)\n"))),Object(o.b)(i.a,{value:"delphi",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(t.a)({parentName:"pre"},{className:"language-json"}),"interface\nfunction PayChargeWithBilletAsPJ(Id: String): String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nfunction PayChargeWithBilletAsPJ(Id: String): String;\nvar \n Body : String;\n PaymentParams: String; \nconst \n BodyText = \n'{'+\n '\"payment\": {'+\n '\"banking_billet\": {'+\n '\"customer\": {'+\n '\"email\": \"[email protected]\",'+\n '\"phone_number\": \"5144916523\",'+\n '\"birth\": \"1977-07-17\",'+\n '\"address\": {'+\n '\"street\": \"Avenida Juscelino Kubitschek\",'+\n '\"number\": 909,'+\n '\"neighborhood\": \"Bauxita\",'+\n '\"complement\": \"\",'+\n '\"city\": \"Ouro Preto\",'+\n '\"state\": \"MG\",'+\n '\"zipcode\": \"35400000\"'+\n '},'+\n '\"name\": \"Gorbadoc Oldbuck\",'+\n '\"cpf\": \"94271564656\",'+\n '\"juridical_person\": {'+\n '\"corporate_name\": \"Nome da Empresa\",'+\n '\"cnpj\": \"99794567000144\"'+\n '}'+\n '},'+\n '\"configurations\": {' +\n '\"fine\": 200,' +\n '\"interest\": 33' +\n '},'+\n '\"message\": \"Este \xe9 um espa\xe7o de at\xe9 80 caracteres para informar algo a seu cliente\",'+\n '\"expire_at\": \"2019-02-21\"'+\n '}'+\n '}'+\n '}';\n\nbegin\n EnableService( 'GerenciaNet.dll' ); \n ConfigureService( ToPAnsiChar( 'client_id' ),ToPAnsiChar( 'client_secret' ),'sandbox','config.json',''); \n GerenciaNetAuthorize();\n\n PaymentParams := CreateRequestParams( [ 'id='+Id ] ).Text; // Passa o id da transa\xe7\xe3o\n Body := BodyText;\n\n Result := ExecuteGerenciaNetRequest( 'payCharge',PaymentParams,'',Body );\nend;\n")))),Object(o.b)("br",null),Object(o.b)("br",null),Object(o.b)("h3",{id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used"},"a) Hierarchical structure of Schema attributes that can be used:"),Object(o.b)("pre",null,Object(o.b)("code",Object(t.a)({parentName:"pre"},{}),'"juridical_person"\n "corporate_name"\n "cnpj"\n')),Object(o.b)("br",null),Object(o.b)("br",null),Object(o.b)("h3",{id:"b-attributes-to-be-sent-legal-entity-data"},"b) Attributes to be sent (legal entity data):"),Object(o.b)("table",null,Object(o.b)("thead",{parentName:"table"},Object(o.b)("tr",{parentName:"thead"},Object(o.b)("th",Object(t.a)({parentName:"tr"},{align:null}),"Attribute"),Object(o.b)("th",Object(t.a)({parentName:"tr"},{align:null}),"Description"),Object(o.b)("th",Object(t.a)({parentName:"tr"},{align:null}),"Required"),Object(o.b)("th",Object(t.a)({parentName:"tr"},{align:null}),"Type"))),Object(o.b)("tbody",{parentName:"table"},Object(o.b)("tr",{parentName:"tbody"},Object(o.b)("td",Object(t.a)({parentName:"tr"},{align:null}),Object(o.b)("inlineCode",{parentName:"td"},"corporate_name")),Object(o.b)("td",Object(t.a)({parentName:"tr"},{align:null}),"Company name"),Object(o.b)("td",Object(t.a)({parentName:"tr"},{align:null}),"Yes"),Object(o.b)("td",Object(t.a)({parentName:"tr"},{align:null}),"String")),Object(o.b)("tr",{parentName:"tbody"},Object(o.b)("td",Object(t.a)({parentName:"tr"},{align:null}),Object(o.b)("inlineCode",{parentName:"td"},"cnpj")),Object(o.b)("td",Object(t.a)({parentName:"tr"},{align:null}),"CNPJ of the company. Size: 14 characters."),Object(o.b)("td",Object(t.a)({parentName:"tr"},{align:null}),"Yes"),Object(o.b)("td",Object(t.a)({parentName:"tr"},{align:null}),"String"))))))}p.isMDXComponent=!0},250:function(e,n,a){"use strict";a.d(n,"a",(function(){return u})),a.d(n,"b",(function(){return m}));var t=a(0),r=a.n(t);function o(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function c(e,n){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),a.push.apply(a,t)}return a}function i(e){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{};n%2?c(Object(a),!0).forEach((function(n){o(e,n,a[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):c(Object(a)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))}))}return e}function s(e,n){if(null==e)return{};var a,t,r=function(e,n){if(null==e)return{};var a,t,r={},o=Object.keys(e);for(t=0;t<o.length;t++)a=o[t],n.indexOf(a)>=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t<o.length;t++)a=o[t],n.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=r.a.createContext({}),b=function(e){var n=r.a.useContext(l),a=n;return e&&(a="function"==typeof e?e(n):i(i({},n),e)),a},u=function(e){var n=b(e.components);return r.a.createElement(l.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},d=r.a.forwardRef((function(e,n){var a=e.components,t=e.mdxType,o=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=b(a),d=t,m=u["".concat(c,".").concat(d)]||u[d]||p[d]||o;return a?r.a.createElement(m,i(i({ref:n},l),{},{components:a})):r.a.createElement(m,i({ref:n},l))}));function m(e,n){var a=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var o=a.length,c=new Array(o);c[0]=d;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:t,c[1]=i;for(var l=2;l<o;l++)c[l]=a[l];return r.a.createElement.apply(null,c)}return r.a.createElement.apply(null,a)}d.displayName="MDXCreateElement"},254:function(e,n,a){"use strict";function t(e){var n,a,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(n=0;n<e.length;n++)e[n]&&(a=t(e[n]))&&(r&&(r+=" "),r+=a);else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}n.a=function(){for(var e,n,a=0,r="";a<arguments.length;)(e=arguments[a++])&&(n=t(e))&&(r&&(r+=" "),r+=n);return r}},255:function(e,n,a){"use strict";var t=a(0);const r=Object(t.createContext)({tabGroupChoices:{},setTabGroupChoices:()=>{},isAnnouncementBarClosed:!1,closeAnnouncementBar:()=>{}});n.a=r},256:function(e,n,a){"use strict";var t=a(0),r=a(255);n.a=function(){return Object(t.useContext)(r.a)}},257:function(e,n,a){"use strict";var t=a(0),r=a.n(t),o=a(256),c=a(254),i=a(92),s=a.n(i);const l=37,b=39;n.a=function(e){const{block:n,children:a,defaultValue:i,values:u,groupId:p}=e,{tabGroupChoices:d,setTabGroupChoices:m}=Object(o.a)(),[g,j]=Object(t.useState)(i);if(null!=p){const e=d[p];null!=e&&e!==g&&u.some(n=>n.value===e)&&j(e)}const h=e=>{j(e),null!=p&&m(p,e)},O=[];return r.a.createElement("div",null,r.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(c.a)("tabs",{"tabs--block":n})},u.map(({value:e,label:n})=>r.a.createElement("li",{role:"tab",tabIndex:"0","aria-selected":g===e,className:Object(c.a)("tabs__item",s.a.tabItem,{"tabs__item--active":g===e}),key:e,ref:e=>O.push(e),onKeyDown:e=>((e,n,a)=>{switch(a.keyCode){case b:((e,n)=>{const a=e.indexOf(n)+1;e[a]?e[a].focus():e[0].focus()})(e,n);break;case l:((e,n)=>{const a=e.indexOf(n)-1;e[a]?e[a].focus():e[e.length-1].focus()})(e,n)}})(O,e.target,e),onFocus:()=>h(e),onClick:()=>h(e)},n))),r.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},t.Children.toArray(a).filter(e=>e.props.value===g)[0]))}},258:function(e,n,a){"use strict";var t=a(0),r=a.n(t);n.a=function(e){return r.a.createElement("div",null,e.children)}}}]);