Skip to content

Commit

Permalink
Merge pull request #1 from jvoliveiraGN/main
Browse files Browse the repository at this point in the history
Release 1.0
  • Loading branch information
jvoliveiraGN authored May 12, 2021
2 parents 72a6510 + e4f0d39 commit 6684890
Show file tree
Hide file tree
Showing 79 changed files with 2,122 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"airbnb-base",
"plugin:prettier/recommended",
"prettier"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prettier"
],
"rules": {

},
"settings": {
"import/resolver": {
"node": {
"paths": [
"src",
"examples"
],
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
}
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
*.p12
simulaMod.ts
teste.ts
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 100,
"tabWidth": 4,
"singleQuote": true,
"jsxBracketSameLine": true,
"trailingComma": "es5",
"semi": true
}
18 changes: 18 additions & 0 deletions examples/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export = {
// PRODUÇÃO = false
// HOMOLOGAÇÃO = true
sandbox: false,

// CREDENCIAIS DE PRODUÇÃO
clientIdProducao: '',
clientSecretProducao: '',
pathCertProducao: '',

// CREDENCIAIS DE HOMOLOGAÇÃO
clientIdHomologacao: '',
clientSecretHomologacao: '',
pathCertHomologacao: '',

// VALIDAR MTLS?
validateMtls: false,
};
12 changes: 12 additions & 0 deletions examples/defaults/carnet/cancelCarnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const params = {
id: 0,
};

const gerencianet = Gerencianet(options);

gerencianet.cancelCarnet(params).then(console.log).catch(console.log).done();
13 changes: 13 additions & 0 deletions examples/defaults/carnet/cancelParcel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const params = {
id: 0,
parcel: 1,
};

const gerencianet = Gerencianet(options);

gerencianet.cancelParcel(params).then(console.log).catch(console.log).done();
28 changes: 28 additions & 0 deletions examples/defaults/carnet/createCarnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const body = {
items: [
{
name: 'Carnet Item 1',
value: 1000,
amount: 2,
},
],
customer: {
name: 'Gorbadoc Oldbuck',
email: '[email protected]',
cpf: '94271564656',
birth: '1977-01-15',
phone_number: '5144916523',
},
repeats: 12,
split_items: false,
expire_at: '2022-01-05',
};

const gerencianet = Gerencianet(options);

gerencianet.createCarnet({}, body).then(console.log).catch(console.log).done();
16 changes: 16 additions & 0 deletions examples/defaults/carnet/createCarnetHistory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const params = {
id: 1001,
};

const body = {
description: 'This carnet is about a service',
};

const gerencianet = Gerencianet(options);

gerencianet.createCarnetHistory(params, body).then(console.log).catch(console.log).done();
12 changes: 12 additions & 0 deletions examples/defaults/carnet/detailCarnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const params = {
id: 0,
};

const gerencianet = Gerencianet(options);

gerencianet.detailCarnet(params).then(console.log).catch(console.log).done();
16 changes: 16 additions & 0 deletions examples/defaults/carnet/resendCarnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const params = {
id: 1002,
};

const body = {
email: '[email protected]',
};

const gerencianet = Gerencianet(options);

gerencianet.resendCarnet(params, body).then(console.log).catch(console.log).done();
17 changes: 17 additions & 0 deletions examples/defaults/carnet/resendParcel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const params = {
id: 1002,
parcel: 1,
};

const body = {
email: '[email protected]',
};

const gerencianet = Gerencianet(options);

gerencianet.resendParcel(params, body).then(console.log).catch(console.log).done();
13 changes: 13 additions & 0 deletions examples/defaults/carnet/settleCarnetParcel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const params = {
id: 26812,
parcel: 5,
};

const gerencianet = Gerencianet(options);

gerencianet.settleCarnetParcel(params).then(console.log).catch(console.log).done();
17 changes: 17 additions & 0 deletions examples/defaults/carnet/updateCarnetMetadata.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const params = {
id: 1004,
};

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

const gerencianet = Gerencianet(options);

gerencianet.updateCarnetMetadata(params, body).then(console.log).catch(console.log).done();
17 changes: 17 additions & 0 deletions examples/defaults/carnet/updateParcel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const params = {
id: 1008,
parcel: 1
};

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

const gerencianet = Gerencianet(options);

gerencianet.updateParcel(params, body).then(console.log).catch(console.log).done();
12 changes: 12 additions & 0 deletions examples/defaults/charge/cancelCharge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const params = {
id: 0,
};

const gerencianet = Gerencianet(options);

gerencianet.cancelCharge(params).then(console.log).catch(console.log).done();
21 changes: 21 additions & 0 deletions examples/defaults/charge/chargeLink.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const params = {
id: 0,
};

const body = {
billet_discount: 0,
card_discount: 0,
message: '',
expire_at: '2021-01-05',
request_delivery_address: false,
payment_method: 'all',
};

const gerencianet = Gerencianet(options);

gerencianet.chargeLink(params, body).then(console.log).catch(console.log).done();
27 changes: 27 additions & 0 deletions examples/defaults/charge/createBilletPayment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const params = {
id: 0,
};

const body = {
payment: {
banking_billet: {
expire_at: '2021-01-05',
customer: {
name: 'Gorbadoc Oldbuck',
email: '[email protected]',
cpf: '94271564656',
birth: '1977-01-15',
phone_number: '5144916523',
},
},
},
};

const gerencianet = Gerencianet(options);

gerencianet.payCharge(params, body).then(console.log).catch(console.log).done();
36 changes: 36 additions & 0 deletions examples/defaults/charge/createCardPayment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

const body = {
payment: {
credit_card: {
installments: 1,
payment_token: '6426f3abd8688639c6772963669bbb8e0eb3c319',
billing_address: {
street: 'Av. JK',
number: 909,
neighborhood: 'Bauxita',
zipcode: '35400000',
city: 'Ouro Preto',
state: 'MG',
},
customer: {
name: 'Gorbadoc Oldbuck',
email: '[email protected]',
cpf: '94271564656',
birth: '1977-01-15',
phone_number: '5144916523',
},
},
},
};

const params = {
id: 1000,
};

const gerencianet = Gerencianet(options);

gerencianet.payCharge(params, body).then(console.log).catch(console.log).done();
24 changes: 24 additions & 0 deletions examples/defaults/charge/createCharge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-unresolved */
import Gerencianet from 'gn-api-sdk-typescript';
import options from '../../config';

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

const gerencianet = Gerencianet(options);

gerencianet.createCharge({}, body).then(console.log).catch(console.log).done();
Loading

0 comments on commit 6684890

Please sign in to comment.