mercadopago
Advanced tools
Comparing version 2.0.15 to 2.1.0
@@ -11,2 +11,5 @@ export declare type Config = { | ||
corporationId?: string; | ||
meliSessionId?: string; | ||
expandResponseNodes?: string; | ||
cardValidation?: string; | ||
}; | ||
@@ -13,0 +16,0 @@ export declare interface SearchOptions { |
@@ -18,2 +18,5 @@ export declare class AppConfig { | ||
PLATFORM_ID: string; | ||
MELI_SESSION_ID: string; | ||
EXPAND_RESPONSE_NODES: string; | ||
CARD_VALIDATION: string; | ||
}; | ||
@@ -20,0 +23,0 @@ static getNodeVersion(): string; |
@@ -27,3 +27,3 @@ "use strict"; | ||
AppConfig.PRODUCT_ID = 'bc32b6ntrpp001u8nhkg'; | ||
AppConfig.SDK_VERSION = '2.0.15'; | ||
AppConfig.SDK_VERSION = '2.1.0'; | ||
AppConfig.Headers = { | ||
@@ -38,3 +38,6 @@ AUTHORIZATION: 'Authorization', | ||
INTEGRATOR_ID: 'X-Integrator-Id', | ||
PLATFORM_ID: 'X-Platform-Id' | ||
PLATFORM_ID: 'X-Platform-Id', | ||
MELI_SESSION_ID: 'X-Meli-Session-Id', | ||
EXPAND_RESPONSE_NODES: 'X-Expand-Response-Nodes', | ||
CARD_VALIDATION: 'X-Card-Validation', | ||
}; |
@@ -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 } = _a, customConfig = __rest(_a, ["timeout", "idempotencyKey", "queryParams", "method", "retries", "corporationId", "integratorId", "plataformId"]); | ||
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 url = RestClient.appendQueryParamsToUrl(`${config_1.AppConfig.BASE_URL}${endpoint}`, queryParams); | ||
customConfig.headers = 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 } : {})); | ||
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_RESPONSE_NODES]: expandResponseNodes } : {})), (cardValidation ? { [config_1.AppConfig.Headers.CARD_VALIDATION]: cardValidation } : {})); | ||
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.0.15", | ||
"version": "2.1.0", | ||
"description": "Mercadopago SDK for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
181872
4488