Skip to content

Commit

Permalink
Merge pull request #177 from mercadopago/release/1.3.1
Browse files Browse the repository at this point in the history
add headers product_id and tracking_id
  • Loading branch information
delias-silva authored Jan 21, 2020
2 parents 72e44c1 + 6514bc5 commit f9f70cf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
19 changes: 19 additions & 0 deletions lib/configurations.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ var platformId;
var corporationId;
var integratorId;
var refreshToken;
var productId = 'bc32b6ntrpp001u8nhkg';
var nodeVersion = process.version
var trackingId = 'platform:' + nodeVersion.substring(0, nodeVersion.indexOf('.')) + '|' + process.version + ',type:SDK'+ sdkVersion + ',so;';
var schema = 'https';
var host = 'api.mercadopago.com';
var userAgent = 'MercadoPago Node.js SDK v' + sdkVersion + ' (node ' + process.version + '-' + process.arch +
Expand Down Expand Up @@ -144,6 +147,22 @@ configurationsModule.getBaseUrl = function () {
return schema + '://' + host;
};

/**
* Get productId
* @returns {string}
*/
configurationsModule.getProductId = function () {
return productId;
};

/**
* Get trackingId
* @returns {string}
*/
configurationsModule.getTrackingId = function () {
return trackingId;
};

/**
* Get userAgent
* @returns {string}
Expand Down
2 changes: 2 additions & 0 deletions lib/request-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ requestManager.buildRequest = function (options) {
req.method = options.method;
req.headers = {
'user-agent': configurations.getUserAgent(),
'x-product-id': configurations.getProductId(),
'x-tracking-id': configurations.getTrackingId(),
accept: requestManager.JSON_MIME_TYPE,
'content-type': requestManager.JSON_MIME_TYPE
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mercadopago",
"version": "1.3.0",
"version": "1.3.1",
"description": "Mercadopago SDK for Node.js",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit f9f70cf

Please sign in to comment.