mercadopago
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -14,2 +14,3 @@ export declare type Config = { | ||
cardValidation?: string; | ||
testToken?: boolean; | ||
}; | ||
@@ -16,0 +17,0 @@ export declare interface SearchOptions { |
@@ -21,2 +21,3 @@ export declare class AppConfig { | ||
CARD_VALIDATION: string; | ||
TEST_TOKEN: string; | ||
}; | ||
@@ -23,0 +24,0 @@ static getNodeVersion(): string; |
@@ -27,3 +27,3 @@ "use strict"; | ||
AppConfig.PRODUCT_ID = 'bc32b6ntrpp001u8nhkg'; | ||
AppConfig.SDK_VERSION = '2.2.0'; | ||
AppConfig.SDK_VERSION = '2.3.0'; | ||
AppConfig.Headers = { | ||
@@ -42,2 +42,3 @@ AUTHORIZATION: 'Authorization', | ||
CARD_VALIDATION: 'X-Card-Validation', | ||
TEST_TOKEN: 'X-Test-Token', | ||
}; |
@@ -55,5 +55,5 @@ "use strict"; | ||
static async fetch(endpoint, config) { | ||
const _a = config || {}, { timeout = config_1.AppConfig.DEFAULT_TIMEOUT, idempotencyKey = RestClient.generateIdempotencyKey(), queryParams, method = 'GET', retries = config_1.AppConfig.DEFAULT_RETRIES, corporationId, integratorId, plataformId, meliSessionId, expandResponseNodes, cardValidation } = _a, customConfig = __rest(_a, ["timeout", "idempotencyKey", "queryParams", "method", "retries", "corporationId", "integratorId", "plataformId", "meliSessionId", "expandResponseNodes", "cardValidation"]); | ||
const _a = config || {}, { timeout = config_1.AppConfig.DEFAULT_TIMEOUT, idempotencyKey = RestClient.generateIdempotencyKey(), queryParams, method = 'GET', retries = config_1.AppConfig.DEFAULT_RETRIES, corporationId, integratorId, plataformId, meliSessionId, expandResponseNodes, cardValidation, testToken } = _a, customConfig = __rest(_a, ["timeout", "idempotencyKey", "queryParams", "method", "retries", "corporationId", "integratorId", "plataformId", "meliSessionId", "expandResponseNodes", "cardValidation", "testToken"]); | ||
const url = RestClient.appendQueryParamsToUrl(`${config_1.AppConfig.BASE_URL}${endpoint}`, queryParams); | ||
customConfig.headers = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, customConfig.headers), { [config_1.AppConfig.Headers.CONTENT_TYPE]: 'application/json', [config_1.AppConfig.Headers.PRODUCT_ID]: config_1.AppConfig.PRODUCT_ID, [config_1.AppConfig.Headers.TRACKING_ID]: config_1.AppConfig.getTrackingId(), [config_1.AppConfig.Headers.USER_AGENT]: config_1.AppConfig.getUserAgent() }), (corporationId ? { [config_1.AppConfig.Headers.CORPORATION_ID]: corporationId } : {})), (integratorId ? { [config_1.AppConfig.Headers.INTEGRATOR_ID]: integratorId } : {})), (plataformId ? { [config_1.AppConfig.Headers.PLATFORM_ID]: plataformId } : {})), (meliSessionId ? { [config_1.AppConfig.Headers.MELI_SESSION_ID]: meliSessionId } : {})), (expandResponseNodes ? { [config_1.AppConfig.Headers.EXPAND_RESPONDE_NODES]: expandResponseNodes } : {})), (cardValidation ? { [config_1.AppConfig.Headers.CARD_VALIDATION]: cardValidation } : {})); | ||
customConfig.headers = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, customConfig.headers), { [config_1.AppConfig.Headers.CONTENT_TYPE]: 'application/json', [config_1.AppConfig.Headers.PRODUCT_ID]: config_1.AppConfig.PRODUCT_ID, [config_1.AppConfig.Headers.TRACKING_ID]: config_1.AppConfig.getTrackingId(), [config_1.AppConfig.Headers.USER_AGENT]: config_1.AppConfig.getUserAgent() }), (corporationId ? { [config_1.AppConfig.Headers.CORPORATION_ID]: corporationId } : {})), (integratorId ? { [config_1.AppConfig.Headers.INTEGRATOR_ID]: integratorId } : {})), (plataformId ? { [config_1.AppConfig.Headers.PLATFORM_ID]: plataformId } : {})), (meliSessionId ? { [config_1.AppConfig.Headers.MELI_SESSION_ID]: meliSessionId } : {})), (expandResponseNodes ? { [config_1.AppConfig.Headers.EXPAND_RESPONDE_NODES]: expandResponseNodes } : {})), (cardValidation ? { [config_1.AppConfig.Headers.CARD_VALIDATION]: cardValidation } : {})), (testToken ? { [config_1.AppConfig.Headers.TEST_TOKEN]: testToken.toString() } : {})); | ||
if (method && method !== 'GET') { | ||
@@ -60,0 +60,0 @@ customConfig.headers = Object.assign(Object.assign({}, customConfig.headers), { [config_1.AppConfig.Headers.IDEMPOTENCY_KEY]: idempotencyKey }); |
{ | ||
"name": "mercadopago", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Mercadopago SDK for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
182224
4496