New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gn-api-sdk-node

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gn-api-sdk-node - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

4

docs/all-in-one.md

@@ -31,4 +31,4 @@ ## Create charge and payment

billing_address: {
street: 'Street 3',
number: 10,
street: 'Av. JK',
number: 909,
neighborhood: 'Bauxita',

@@ -35,0 +35,0 @@ zipcode: '35400000',

@@ -103,4 +103,4 @@ ## Paying charges

billing_address: {
street: 'Street 3',
number: 10,
street: 'Av. JK',
number: 909,
neighborhood: 'Bauxita',

@@ -107,0 +107,0 @@ zipcode: '35400000',

@@ -33,4 +33,4 @@ 'use strict';

billing_address: {
street: 'Street 3',
number: 10,
street: 'Av. JK',
number: 909,
neighborhood: 'Bauxita',

@@ -37,0 +37,0 @@ zipcode: '35400000',

@@ -13,3 +13,3 @@ 'use strict';

var params = {
id: 1001
id: 0
}

@@ -16,0 +16,0 @@

@@ -7,9 +7,9 @@ 'use strict';

var options = {
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
}
var params = {
id: 18
id: 0
}

@@ -20,5 +20,5 @@

gerencianet
.cancelSubscription(params)
.then(console.log)
.catch(console.log)
.done();
.cancelSubscription(params)
.then(console.log)
.catch(console.log)
.done();

@@ -18,3 +18,3 @@ 'use strict';

var params = {
id: 1000
id: 0
}

@@ -21,0 +21,0 @@

@@ -18,4 +18,4 @@ 'use strict';

billing_address: {
street: 'Street 3',
number: 10,
street: 'Av. JK',
number: 909,
neighborhood: 'Bauxita',

@@ -22,0 +22,0 @@ zipcode: '35400000',

@@ -13,3 +13,3 @@ 'use strict';

var params = {
id: 1000
id: 0
}

@@ -22,4 +22,4 @@

billing_address: {
street: 'Street 3',
number: 10,
street: 'Av. JK',
number: 909,
neighborhood: 'Bauxita',

@@ -26,0 +26,0 @@ zipcode: '35400000',

'use strict'
module.exports = {
client_id: 'yoda_id',
client_secret: 'yoda_secret',
urls: {
production: 'http://localhost:4400',
sandbox: 'http://localhost:4400'
}
client_id: 'your_id',
client_secret: 'your_secret',
urls: {
production: 'http://localhost:4400',
sandbox: 'http://localhost:4400'
}
}

@@ -7,9 +7,9 @@ 'use strict';

var options = {
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
}
var params = {
id: 1000
id: 0
}

@@ -20,5 +20,5 @@

gerencianet
.deletePlan(params)
.then(console.log)
.catch(console.log)
.done();
.deletePlan(params)
.then(console.log)
.catch(console.log)
.done();

@@ -7,9 +7,9 @@ 'use strict';

var options = {
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
}
var params = {
id: 1002
id: 0
}

@@ -20,5 +20,5 @@

gerencianet
.detailCarnet(params)
.then(console.log)
.catch(console.log)
.done();
.detailCarnet(params)
.then(console.log)
.catch(console.log)
.done();

@@ -7,9 +7,9 @@ 'use strict';

var options = {
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
}
var params = {
id: 1001
id: 0
}

@@ -20,5 +20,5 @@

gerencianet
.detailCharge(params)
.then(console.log)
.catch(console.log)
.done();
.detailCharge(params)
.then(console.log)
.catch(console.log)
.done();

@@ -7,9 +7,9 @@ 'use strict';

var options = {
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
}
var params = {
id: 1000
id: 0
}

@@ -20,5 +20,5 @@

gerencianet
.detailSubscription(params)
.then(console.log)
.catch(console.log)
.done();
.detailSubscription(params)
.then(console.log)
.catch(console.log)
.done();

@@ -7,9 +7,9 @@ 'use strict';

var options = {
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
}
var params = {
token: '252948279264ee47e117cb099ef81'
token: '252948279264ee47e117cb099ef81'
}

@@ -20,5 +20,5 @@

gerencianet
.getNotification(params)
.then(console.log)
.catch(console.log)
.done();
.getNotification(params)
.then(console.log)
.catch(console.log)
.done();

@@ -7,10 +7,10 @@ 'use strict';

var options = {
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
client_id: credentials.client_id,
client_secret: credentials.client_secret,
sandbox: true
}
var params = {
type: 'visa',
total: 5000
type: 'visa',
total: 5000
}

@@ -21,5 +21,5 @@

gerencianet
.getInstallments(params)
.then(console.log)
.catch(console.log)
.done();
.getInstallments(params)
.then(console.log)
.catch(console.log)
.done();

@@ -14,3 +14,3 @@ 'use strict';

name: 'My Plan',
limit: 50,
limit: 20,
offset: 0

@@ -17,0 +17,0 @@ }

@@ -81,4 +81,3 @@ ## Notifications

"charge_id": 1002
},
"value": 1780
}
}]

@@ -90,3 +89,3 @@ }

* id: Each notification has its own sequence, starting from `1` and the `id` parameters is used to mark this sequence. This is useful if you need to keep track which change you have already processed.
* id: Each notification has its own sequence, starting from `1` and the `id` parameter is used to mark this sequence. This is useful if you need to keep track which change you have already processed.

@@ -115,6 +114,4 @@ * type: The type of this change. The available values are:

* value: this parameter will only be shown when the change have a value related.
* value: this parameter will only be shown when the change is about paid charges.
i.e.: paid charges, refunded charges, etc.
For more information about notifications, please, refer to [Gerencianet](https://docs.gerencianet.com.br/#!/charges/notifications).
For more informations about notifications, please, refer to [Gerencianet](https://docs.gerencianet.com.br/#!/charges/notifications).

@@ -29,2 +29,4 @@ ## Detailing subscriptions

"payment_method": null,
"next_execution": null,
"next_expire_at": null,
"interval": 1,

@@ -45,3 +47,3 @@ "repeats": 2,

Note that if you [detail a charge](/docs/charge-detailing.md) that belongs to a subscription, the response will have a `subscription_id`. If you need the subscription information, you can concat the calls like this:
Note that if you [detail a charge](/docs/charge-detailing.md) that belongs to a subscription, the response will have a `subscription` block with data about it, including the `subscription_id`. If you need the subscription information, you can concat the calls like this:

@@ -48,0 +50,0 @@ ```js

## Paying subscriptions
There is only one way of giving sequence to a subscription: you need to use the customer's *credit card* to submit the payment. As explained in the last section of this page, a `payment_token` represents a credit card:
There is two ways of giving sequence to a subscription *banking billet* or *credit card*.
Instantiate the module:
```js
var Gerencianet = require('gn-api-sdk-node');
var gerencianet = new Gerencianet(options);
```
### 1. Banking billets
To submit the payment with banking billet, you just need define the customer and the expire at to first charge:
```js
var tenDaysFromNow = moment()
.add(10, 'days')
.format('YYYY-MM-DD 00:00:00');
var params = {

@@ -15,7 +28,39 @@ id: 1000

payment: {
banking_billet: {
expire_at: tenDaysFromNow,
customer: {
name: 'Gorbadoc Oldbuck',
email: 'oldbuck@gerencianet.com.br',
cpf: '04267484171',
birth: '1977-01-15',
phone_number: '5144916523'
}
}
}
}
gerencianet
.paySubscription(params, body)
.then(console.log)
.catch(console.log)
.done();
```
### 2. Credit card
In case of credit card, it's necessary to use the customer's *credit card* to submit the payment. As explained in the last section of this page, a `payment_token` represents a credit card:
```js
var params = {
id: 1000
}
var body = {
payment: {
credit_card: {
payment_token: '33ffd6d982cd63f767fb2ee5c458cd39e8fc0ea0',
billing_address: {
street: 'Street 3',
number: 10,
street: 'Av. JK',
number: 909,
neighborhood: 'Bauxita',

@@ -44,3 +89,3 @@ zipcode: '35400000',

If everything went well, the response will come with total value, installments number and the value oh each installment:
If everything went well, the response will come with total value:

@@ -52,6 +97,14 @@ ```js

"subscription_id": 11,
"status": "active",
"plan": {
"id": 1000,
"interval": 2,
"repeats": null
},
"charge": {
"id": 1053,
"status": "waiting"
},
"total": 1150,
"payment": "credit_card",
"installments": 1,
"installment_value": 1150
"payment": "credit_card"
}

@@ -61,2 +114,3 @@ }

For getting installment values, including interests, check [Getting Installments](/docs/payment-data.md).

@@ -63,0 +117,0 @@

@@ -26,3 +26,3 @@ ## Updating subscriptions

If everything goes well. the return will be:
If everything goes well, the return will be:

@@ -29,0 +29,0 @@ ```js

## Creating subscriptions
If you ever have to recurrently charge your clients, you can create a different kind of charge, one that belongs to a subscription. This way, subsequent charges will be automatically created and charged in your customers credit card, based on the interval and repetitions supplied in a plan configuration.
If you ever have to recurrently charge your clients, you can create a different kind of charge, one that belongs to a subscription. This way, subsequent charges will be automatically created based on plan configuration and the charge value is charged in your customers' credit card, or the banking billet is generated and sent to costumer, accoding to plan’s configuration.
The plan configuration receive two params, that are repeats and interval:
The `repeats` parameter defines how many times the transaction will be repeated. If you don't provide it, the subscription will create charges indefinitely.

@@ -66,4 +68,3 @@

var params = {
id: 18,
customer: true
id: 18
}

@@ -83,3 +84,1 @@

```
The `customer` attribute above indicates who is triggering the cancellation, the customer or the one providing the service. In this case, the customer decided not to continue with the subscription.
{
"name": "gn-api-sdk-node",
"description": "Module for integration with Gerencianet API",
"version": "0.0.11",
"version": "0.0.12",
"author": "Francisco Carvalho <f.thiene@gmail.com>",

@@ -44,2 +44,2 @@ "license": "MIT",

}
}
}

@@ -8,3 +8,4 @@ # gn-api-sdk-node

:warning: **This module is under development and is based on the new API that Gerencianet is about to release. It won't work in production by now.**
:warning: **Gerencianet API is under BETA version, meaning that it's not available for all users right now. If you're interested, you can always send an email to
suportetecnico@gerencianet.com.br and we'll enable it for your account**

@@ -11,0 +12,0 @@ [![Build Status](https://travis-ci.org/gerencianet/gn-api-sdk-node.svg)](https://travis-ci.org/gerencianet/gn-api-sdk-node)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc