Skip to content

Commit

Permalink
Atualização de exemplos
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoliveiraGN committed Dec 22, 2022
1 parent 1499f18 commit aa0c015
Show file tree
Hide file tree
Showing 161 changed files with 2,512 additions and 1,714 deletions.
19 changes: 19 additions & 0 deletions examples/charges/billet/cancelBillet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* eslint-disable import/no-unresolved */
/* eslint-disable import/extensions */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../credentials';

const params = {
id: 0,
};

const gerencianet = new Gerencianet(options);

gerencianet
.cancelCharge(params)
.then((resposta: Promise<any>) => {
console.log(resposta);
})
.catch((error: Promise<any>) => {
console.log(error);
});
22 changes: 22 additions & 0 deletions examples/charges/billet/createBilletHistory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable import/extensions */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../credentials';

const params = {
id: 1001,
};

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

const gerencianet = new Gerencianet(options);

gerencianet
.createChargeHistory(params, body)
.then((resposta: Promise<any>) => {
console.log(resposta);
})
.catch((error: Promise<any>) => {
console.log(error);
});
30 changes: 30 additions & 0 deletions examples/charges/billet/createCharge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint-disable import/extensions */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../credentials';

const 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: Promise<any>) => {
console.log(resposta);
})
.catch((error: Promise<any>) => {
console.log(error);
});
43 changes: 43 additions & 0 deletions examples/charges/billet/createOneStepBillet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* eslint-disable import/extensions */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../credentials';

const body = {
payment: {
banking_billet: {
expire_at: '2024-09-20',
customer: {
name: 'Gorbadoc Oldbuck',
email: 'oldbuck@gerencianet.com.br',
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: Promise<any>) => {
console.log(resposta);
})
.catch((error: Promise<any>) => {
console.log(error);
});
83 changes: 83 additions & 0 deletions examples/charges/billet/defineBalanceSheetBillet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/* eslint-disable import/extensions */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../credentials';

const params = {
id: 0,
};

const 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: Promise<any>) => {
console.log(resposta);
})
.catch((error: Promise<any>) => {
console.log(error);
});
33 changes: 33 additions & 0 deletions examples/charges/billet/defineBilletPayMethod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable import/extensions */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../credentials';

const params = {
id: 0,
};

const body = {
payment: {
banking_billet: {
expire_at: '2023-12-01',
customer: {
name: 'Gorbadoc Oldbuck',
email: 'oldbuck@gerencianet.com.br',
cpf: '94271564656',
birth: '1977-01-15',
phone_number: '5144916523',
},
},
},
};

const gerencianet = new Gerencianet(options);

gerencianet
.definePayMethod(params, body)
.then((resposta: Promise<any>) => {
console.log(resposta);
})
.catch((error: Promise<any>) => {
console.log(error);
});
18 changes: 18 additions & 0 deletions examples/charges/billet/detailBillet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable import/extensions */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../credentials';

const params = {
id: 0,
};

const gerencianet = new Gerencianet(options);

gerencianet
.detailCharge(params)
.then((resposta: Promise<any>) => {
console.log(resposta);
})
.catch((error: Promise<any>) => {
console.log(error);
});
22 changes: 22 additions & 0 deletions examples/charges/billet/sendBilletEmail.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable import/extensions */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../credentials';

const params = {
id: 1000,
};

const body = {
email: 'oldbuck@gerencianet.com.br',
};

const gerencianet = new Gerencianet(options);

gerencianet
.sendBilletEmail(params, body)
.then((resposta: Promise<any>) => {
console.log(resposta);
})
.catch((error: Promise<any>) => {
console.log(error);
});
18 changes: 18 additions & 0 deletions examples/charges/billet/settleBillet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable import/extensions */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../credentials';

const params = {
id: 553834,
};

const gerencianet = new Gerencianet(options);

gerencianet
.settleCharge(params)
.then((resposta: Promise<any>) => {
console.log(resposta);
})
.catch((error: Promise<any>) => {
console.log(error);
});
22 changes: 22 additions & 0 deletions examples/charges/billet/updateBillet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable import/extensions */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../credentials';

const params = {
id: 1008,
};

const body = {
expire_at: '2024-12-12',
};

const gerencianet = new Gerencianet(options);

gerencianet
.updateBillet(params, body)
.then((resposta: Promise<any>) => {
console.log(resposta);
})
.catch((error: Promise<any>) => {
console.log(error);
});
23 changes: 23 additions & 0 deletions examples/charges/billet/updateBilletMetadata.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-disable import/extensions */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../credentials';

const params = {
id: 1008,
};

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

const gerencianet = new Gerencianet(options);

gerencianet
.updateChargeMetadata(params, body)
.then((resposta: Promise<any>) => {
console.log(resposta);
})
.catch((error: Promise<any>) => {
console.log(error);
});
18 changes: 18 additions & 0 deletions examples/charges/card/cancelCard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable import/extensions */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../credentials';

const params = {
id: 0,
};

const gerencianet = new Gerencianet(options);

gerencianet
.cancelCharge(params)
.then((resposta: Promise<any>) => {
console.log(resposta);
})
.catch((error: Promise<any>) => {
console.log(error);
});
22 changes: 22 additions & 0 deletions examples/charges/card/createCardHistory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable import/extensions */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../credentials';

const params = {
id: 1001,
};

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

const gerencianet = new Gerencianet(options);

gerencianet
.createChargeHistory(params, body)
.then((resposta: Promise<any>) => {
console.log(resposta);
})
.catch((error: Promise<any>) => {
console.log(error);
});
Loading

0 comments on commit aa0c015

Please sign in to comment.