Huge News!Announcing our $40M Series B led by Abstract Ventures.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.13 to 0.0.14

docs/charge-create-history.md

5

CHANGELOG.md

@@ -0,1 +1,6 @@

# 0.0.14
- Added: new endpoint (charge history)
- Added: custom header
- Updated: docs
# 0.0.13

@@ -2,0 +7,0 @@ - Added: new endpoint (resend billet)

2

docs/charge-detailing.md

@@ -46,3 +46,3 @@ ## Detailing charges

{
"status": "new",
"message": "Cobrança criada",
"created_at": "2015-05-14 15:39:14"

@@ -49,0 +49,0 @@ }

@@ -5,2 +5,3 @@ 'use strict';

var q = require('q');
var sdkPackage = require('../package.json');

@@ -14,3 +15,3 @@ function GnAuth(options, constants) {

GnAuth.prototype.getAccessToken = function () {
GnAuth.prototype.getAccessToken = function() {
var defer = q.defer();

@@ -21,2 +22,5 @@

json: true,
headers: {
'api-sdk': 'node-' + sdkPackage.version
},
body: {

@@ -31,3 +35,3 @@ grant_type: 'client_credentials'

var callback = function (err, httpResponse, body) {
var callback = function(err, httpResponse, body) {

@@ -34,0 +38,0 @@ if (err) {

@@ -96,4 +96,8 @@ 'use strict';

method: 'post'
},
createChargeHistory: {
route: '/charge/:id/history',
method: 'post'
}
}
};

@@ -6,2 +6,3 @@ 'use strict';

var GnAuth = require('./gn-auth');
var sdkPackage = require('../package.json');

@@ -16,3 +17,3 @@ function GnEndpoints(options, constants) {

GnEndpoints.prototype.run = function (name, params, body) {
GnEndpoints.prototype.run = function(name, params, body) {
var self = this;

@@ -34,9 +35,9 @@ self.defer = q.defer();

GnEndpoints.prototype.getAccessToken = function () {
GnEndpoints.prototype.getAccessToken = function() {
var self = this;
return this.gnAuth.getAccessToken()
.then(function (response) {
.then(function(response) {
self.accessToken = response.access_token;
return self.accessToken;
}).catch(function (err) {
}).catch(function(err) {
return err;

@@ -46,3 +47,3 @@ });

GnEndpoints.prototype.getResponse = function (response, body) {
GnEndpoints.prototype.getResponse = function(response, body) {
return this.options

@@ -52,3 +53,3 @@ .raw_response ? response : body;

GnEndpoints.prototype.req = function (callback) {
GnEndpoints.prototype.req = function(callback) {
request[this.endpoint.method](this.getParams.call(this,

@@ -58,11 +59,11 @@ this.endpoint.route), callback);

GnEndpoints.prototype.directReq = function () {
GnEndpoints.prototype.directReq = function() {
this.req(this.directReqCallback.bind(this));
};
GnEndpoints.prototype.withTokenReq = function () {
GnEndpoints.prototype.withTokenReq = function() {
this.req(this.withTokenReqCallback.bind(this));
};
GnEndpoints.prototype.getParams = function (route) {
GnEndpoints.prototype.getParams = function(route) {
var self = this;

@@ -78,4 +79,4 @@ var regex = /\:(\w+)/g;

var getVariables = function () {
return placeholders.map(function (item) {
var getVariables = function() {
return placeholders.map(function(item) {
return item.replace(':', '');

@@ -85,5 +86,5 @@ });

var updateRoute = function () {
var updateRoute = function() {
var variables = getVariables();
variables.forEach(function (value, index) {
variables.forEach(function(value, index) {
if (params[value]) {

@@ -96,6 +97,6 @@ route = route.replace(placeholders[index], params[value]);

var getQueryString = function () {
var getQueryString = function() {
var keys = Object.keys(params);
var initial = keys.length >= 1 ? '?' : '';
return keys.reduce(function (previous, current, index, array) {
return keys.reduce(function(previous, current, index, array) {
var next = (index === array.length - 1) ? '' : '&';

@@ -114,2 +115,5 @@ return [previous, current, '=',

json: true,
headers: {
'api-sdk': 'node-' + sdkPackage.version
},
body: this.body

@@ -127,3 +131,3 @@ };

GnEndpoints.prototype.withTokenReqCallback = function (err, httpResponse, httpResponseBody) {
GnEndpoints.prototype.withTokenReqCallback = function(err, httpResponse, httpResponseBody) {
var self = this;

@@ -143,3 +147,3 @@ var response = self.getResponse(httpResponse, httpResponseBody);

GnEndpoints.prototype.directReqCallback = function (err, httpResponse, bodyResponse) {
GnEndpoints.prototype.directReqCallback = function(err, httpResponse, bodyResponse) {
var response = this.getResponse(httpResponse, bodyResponse);

@@ -146,0 +150,0 @@

{
"name": "gn-api-sdk-node",
"description": "Module for integration with Gerencianet API",
"version": "0.0.13",
"version": "0.0.14",
"author": "Francisco Carvalho <f.thiene@gmail.com>",

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

}
}
}

@@ -110,2 +110,3 @@ # gn-api-sdk-node

- [Resending billet](https://github.com/gerencianet/gn-api-sdk-node/tree/master/docs/resend-billet.md)
- [Adding information to charge history](https://github.com/gerencianet/gn-api-sdk-node/tree/master/docs/charge-create-history.md)

@@ -112,0 +113,0 @@ ### Carnets

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