Skip to content

Commit bbda0cf

Browse files
Merge pull request #359 from mercadopago/feature/add_header_x-test-token
Feature: add header X-Test-Token
2 parents d43e5ac + 12773d5 commit bbda0cf

File tree

7 files changed

+405
-583
lines changed

7 files changed

+405
-583
lines changed

CHANGELOG.MD

+6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
# Releases
22

3+
## VERSION 2.3.0
4+
5+
- Add `X-Test-Token` header to request options
6+
37
## VERSION 2.2.0
8+
49
- Include `network_transaction_data` in `forward_data` in Payment
510

611
## VERSION 2.1.1
12+
713
- Fix `X-Expand-Responde-Nodes` header to request options
814

915
## VERSION 2.1.0

package-lock.json

+391-581
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mercadopago",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"description": "Mercadopago SDK for Node.js",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export declare type Options = {
1212
meliSessionId?: string;
1313
expandResponseNodes?: string;
1414
cardValidation?: string;
15+
testToken?: boolean;
1516
};
1617

1718
export declare interface SearchOptions {

src/utils/config/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class AppConfig {
55
static readonly BASE_URL = 'https://api.mercadopago.com';
66
static readonly PRODUCT_ID = 'bc32b6ntrpp001u8nhkg';
77

8-
static SDK_VERSION = '2.2.0';
8+
static SDK_VERSION = '2.3.0';
99

1010
static readonly Headers = {
1111
AUTHORIZATION: 'Authorization',
@@ -20,6 +20,7 @@ export class AppConfig {
2020
MELI_SESSION_ID: 'X-Meli-Session-Id',
2121
EXPAND_RESPONDE_NODES: 'X-Expand-Responde-Nodes',
2222
CARD_VALIDATION: 'X-Card-Validation',
23+
TEST_TOKEN: 'X-Test-Token',
2324
};
2425

2526
static getNodeVersion(): string {

src/utils/restClient/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class RestClient {
6969
meliSessionId,
7070
expandResponseNodes,
7171
cardValidation,
72+
testToken,
7273
...customConfig
7374
} = config || {};
7475

@@ -85,6 +86,7 @@ class RestClient {
8586
...(meliSessionId ? { [AppConfig.Headers.MELI_SESSION_ID]: meliSessionId } : {}),
8687
...(expandResponseNodes ? { [AppConfig.Headers.EXPAND_RESPONDE_NODES]: expandResponseNodes } : {}),
8788
...(cardValidation ? { [AppConfig.Headers.CARD_VALIDATION]: cardValidation } : {}),
89+
...(testToken ? { [AppConfig.Headers.TEST_TOKEN]: testToken.toString() } : {}),
8890
};
8991

9092
if (method && method !== 'GET') {

src/utils/restClient/restClient.spec.ts

+2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ describe('RestClient', () => {
108108
expandResponseNodes: 'gateway.reference',
109109
cardValidation: 'card_validation',
110110
meliSessionId: 'device_id',
111+
testToken: true,
111112
});
112113

113114
expect(fetch).toHaveBeenCalledWith(expect.any(String), {
@@ -122,6 +123,7 @@ describe('RestClient', () => {
122123
'X-Meli-Session-Id': 'device_id',
123124
'X-Expand-Responde-Nodes': 'gateway.reference',
124125
'X-Card-Validation': 'card_validation',
126+
'X-Test-Token': 'true',
125127
},
126128
});
127129
});

0 commit comments

Comments
 (0)