mercadopago
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -6,2 +6,5 @@ var sdkVersion = require('../package').version; | ||
var accessToken; | ||
var platformId; | ||
var corporationId; | ||
var integratorId; | ||
var refreshToken; | ||
@@ -49,2 +52,6 @@ var schema = 'https'; | ||
accessToken = configurations.access_token || accessToken; | ||
// Set headers parameters | ||
platformId = configurations.platform_id; | ||
corporationId = configurations.corporation_id; | ||
integratorId = configurations.integrator_id; | ||
// Use if to prevent false value | ||
@@ -77,2 +84,26 @@ this.sandbox = (configurations.sandbox !== undefined) ? configurations.sandbox : this.sandbox; | ||
/** | ||
* Get platformId | ||
* @returns {string} | ||
*/ | ||
configurationsModule.getPlatformId = function () { | ||
return platformId; | ||
}; | ||
/** | ||
* Get corporationId | ||
* @returns {string} | ||
*/ | ||
configurationsModule.getCorporationId = function () { | ||
return corporationId; | ||
}; | ||
/** | ||
* Get integratorId | ||
* @returns {string} | ||
*/ | ||
configurationsModule.getIntegratorId = function () { | ||
return integratorId; | ||
}; | ||
/** | ||
* Set accessToken | ||
@@ -79,0 +110,0 @@ * @param {string} token |
@@ -39,2 +39,31 @@ /* istanbul ignore next */ | ||
}, | ||
tracks: { | ||
type: 'array', | ||
items: { | ||
type: 'object', | ||
properties: { | ||
type: { | ||
type: 'string', | ||
maxLength: 256 | ||
}, | ||
values: { | ||
type: 'object', | ||
properties: { | ||
conversion_id: { | ||
type: 'string', | ||
}, | ||
conversion_label: { | ||
type: 'string', | ||
}, | ||
pixel_id: { | ||
type: 'string', | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
metadata: { | ||
type: 'object', | ||
}, | ||
payer: { | ||
@@ -41,0 +70,0 @@ type: 'object', |
@@ -36,2 +36,3 @@ var request = require('request'); | ||
var needIdempotency = !!this.idempotency; // Idempotency from resource | ||
var needPartnersHeaders = !!this.partnersHeaders; | ||
var config = {}; | ||
@@ -118,2 +119,5 @@ var payload = {}; | ||
access_token: config.access_token ? config.access_token : accessToken, | ||
platformId: needPartnersHeaders || configurations.getPlatformId(), | ||
corporationId: needPartnersHeaders || configurations.getCorporationId(), | ||
integratorId: needPartnersHeaders || configurations.getIntegratorId(), | ||
}); | ||
@@ -265,2 +269,14 @@ }).then(function (response) { | ||
if(options.integratorId) { | ||
req.headers['x-integrator-id'] = options.integratorId; | ||
} | ||
if(options.corporationId) { | ||
req.headers['x-corporation-id'] = options.corporationId; | ||
} | ||
if(options.platformId) { | ||
req.headers['x-platform-id'] = options.platformId; | ||
} | ||
if (options.config && options.config.headers && typeof options.config.headers === 'object') { | ||
@@ -267,0 +283,0 @@ headersNames = Object.keys(options.config.headers); |
@@ -10,3 +10,4 @@ var Promise = require('bluebird'); | ||
schema: paymentModel, | ||
idempotency: true | ||
idempotency: true, | ||
partnersHeaders: true | ||
}; | ||
@@ -13,0 +14,0 @@ |
@@ -5,3 +5,4 @@ var requestManager = require('../request-manager'); | ||
var preferences = module.exports = { | ||
schema: preferencesModel | ||
schema: preferencesModel, | ||
partnersHeaders: true | ||
}; | ||
@@ -8,0 +9,0 @@ |
{ | ||
"name": "mercadopago", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Mercadopago SDK for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
217182
6172
0