Skip to content

Commit

Permalink
Atualização dos exemplos
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoliveiraGN committed Dec 21, 2022
1 parent fd1354b commit ecc711f
Show file tree
Hide file tree
Showing 161 changed files with 2,292 additions and 1,718 deletions.
16 changes: 16 additions & 0 deletions examples/charges/billet/cancelBillet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let params = {
id: 0,
}

const gerencianet = new Gerencianet(options)

gerencianet.cancelCharge(params)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
20 changes: 20 additions & 0 deletions examples/charges/billet/createBilletHistory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let params = {
id: 1001,
}

let body = {
description: 'This charge was not fully paid',
}

const gerencianet = new Gerencianet(options)

gerencianet.createChargeHistory(params, body)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
28 changes: 28 additions & 0 deletions examples/charges/billet/createCharge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let body = {
items: [
{
name: 'Product 1',
value: 1000,
amount: 2,
},
],
shippings: [
{
name: 'Default Shipping Cost',
value: 100,
},
],
}

const gerencianet = new Gerencianet(options)

gerencianet.createCharge({}, body)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
41 changes: 41 additions & 0 deletions examples/charges/billet/createOneStepBillet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let body = {
payment: {
banking_billet: {
expire_at: '2024-09-20',
customer: {
name: 'Gorbadoc Oldbuck',
email: '[email protected]',
cpf: '94271564656',
birth: '1977-01-15',
phone_number: '5144916523',
},
},
},

items: [
{
name: 'Product 1',
value: 500,
amount: 1,
},
],
shippings: [
{
name: 'Default Shipping Cost',
value: 100,
},
],
}

const gerencianet = new Gerencianet(options)

gerencianet.createOneStepCharge([], body)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
81 changes: 81 additions & 0 deletions examples/charges/billet/defineBalanceSheetBillet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let params = {
id: 0,
}

let body = {
title: 'Balancete Demonstrativo',
body: [
{
header: 'Demonstrativo de Consumo',
tables: [
{
rows: [
[
{
align: 'left',
color: '#000000',
style: 'bold',
text: 'Exemplo de despesa',
colspan: 2,
},
{
align: 'left',
color: '#000000',
style: 'bold',
text: 'Total lançado',
colspan: 2,
},
],
[
{
align: 'left',
color: '#000000',
style: 'normal',
text: 'Instalação',
colspan: 2,
},
{
align: 'left',
color: '#000000',
style: 'normal',
text: 'R$ 100,00',
colspan: 2,
},
],
],
},
],
},
{
header: 'Balancete Geral',
tables: [
{
rows: [
[
{
align: 'left',
color: '#000000',
style: 'normal',
text: 'Confira na documentação da Gerencianet todas as configurações possíveis de um boleto balancete.',
colspan: 4,
},
],
],
},
],
},
],
}

const gerencianet = new Gerencianet(options)

gerencianet.defineBalanceSheetBillet(params, body)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
31 changes: 31 additions & 0 deletions examples/charges/billet/defineBilletPayMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let params = {
id: 0,
}

let body = {
payment: {
banking_billet: {
expire_at: '2023-12-01',
customer: {
name: 'Gorbadoc Oldbuck',
email: '[email protected]',
cpf: '94271564656',
birth: '1977-01-15',
phone_number: '5144916523',
},
},
},
}

const gerencianet = new Gerencianet(options)

gerencianet.definePayMethod(params, body)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
16 changes: 16 additions & 0 deletions examples/charges/billet/detailBillet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let params = {
id: 0,
}

const gerencianet = new Gerencianet(options)

gerencianet.detailCharge(params)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
20 changes: 20 additions & 0 deletions examples/charges/billet/sendBilletEmail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let params = {
id: 1000,
}

let body = {
email: '[email protected]',
}

const gerencianet = new Gerencianet(options)

gerencianet.sendBilletEmail(params, body)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
16 changes: 16 additions & 0 deletions examples/charges/billet/settleBillet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let params = {
id: 553834,
}

const gerencianet = new Gerencianet(options)

gerencianet.settleCharge(params)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
20 changes: 20 additions & 0 deletions examples/charges/billet/updateBillet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let params = {
id: 1008,
}

let body = {
expire_at: '2024-12-12',
}

const gerencianet = new Gerencianet(options)

gerencianet.updateBillet(params, body)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
21 changes: 21 additions & 0 deletions examples/charges/billet/updateBilletMetadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let params = {
id: 1008,
}

let body = {
notification_url: 'http://yourdomain.com',
custom_id: 'my_new_id',
}

const gerencianet = new Gerencianet(options)

gerencianet.updateChargeMetadata(params, body)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
16 changes: 16 additions & 0 deletions examples/charges/card/cancelCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let params = {
id: 0,
}

const gerencianet = new Gerencianet(options)

gerencianet.cancelCharge(params)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
20 changes: 20 additions & 0 deletions examples/charges/card/createCardHistory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let params = {
id: 1001,
}

let body = {
description: 'This charge was not fully paid',
}

const gerencianet = new Gerencianet(options)

gerencianet.createChargeHistory(params, body)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
28 changes: 28 additions & 0 deletions examples/charges/card/createCharge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const Gerencianet = require('gn-api-sdk-node')
const options = require('../../credentials')

let body = {
items: [
{
name: 'Product 1',
value: 1000,
amount: 2,
},
],
shippings: [
{
name: 'Default Shipping Cost',
value: 100,
},
],
}

const gerencianet = new Gerencianet(options)

gerencianet.createCharge({}, body)
.then((resposta) => {
console.log(resposta)
})
.catch((error) => {
console.log(error)
})
Loading

0 comments on commit ecc711f

Please sign in to comment.