tonder-web-sdk 1.11.11 → 1.11.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/classes/inlineCheckout.js +10 -3
- package/src/helpers/utils.js +17 -0
- package/v1/bundle.min.js +1 -1
package/package.json
CHANGED
|
@@ -17,7 +17,8 @@ import {
|
|
|
17
17
|
getBrowserInfo,
|
|
18
18
|
mapCards,
|
|
19
19
|
showMessage,
|
|
20
|
-
clearSpace
|
|
20
|
+
clearSpace,
|
|
21
|
+
injectMercadoPagoSecurity
|
|
21
22
|
} from '../helpers/utils';
|
|
22
23
|
import { initSkyflow } from '../helpers/skyflow'
|
|
23
24
|
import { ThreeDSHandler } from './3dsHandler.js';
|
|
@@ -315,6 +316,7 @@ export class InlineCheckout {
|
|
|
315
316
|
const {
|
|
316
317
|
vault_id,
|
|
317
318
|
vault_url,
|
|
319
|
+
mercado_pago
|
|
318
320
|
} = await this.#fetchMerchantData();
|
|
319
321
|
if (this.email && getCards) {
|
|
320
322
|
const customerResponse = await this.getCustomer({ email: this.email });
|
|
@@ -328,7 +330,10 @@ export class InlineCheckout {
|
|
|
328
330
|
}
|
|
329
331
|
}
|
|
330
332
|
}
|
|
331
|
-
|
|
333
|
+
if (!!mercado_pago && !!mercado_pago.active){
|
|
334
|
+
injectMercadoPagoSecurity()
|
|
335
|
+
}
|
|
336
|
+
|
|
332
337
|
await this.#mountAPMs();
|
|
333
338
|
|
|
334
339
|
this.collectContainer = await initSkyflow(
|
|
@@ -485,8 +490,10 @@ export class InlineCheckout {
|
|
|
485
490
|
...( selected_apm && Object.keys(selected_apm).length > 0
|
|
486
491
|
? {payment_method: selected_apm.payment_method}
|
|
487
492
|
: {card: cardTokens}
|
|
488
|
-
)
|
|
493
|
+
),
|
|
494
|
+
...(typeof MP_DEVICE_SESSION_ID !== "undefined" ? {mp_device_session_id: MP_DEVICE_SESSION_ID}:{})
|
|
489
495
|
};
|
|
496
|
+
|
|
490
497
|
const jsonResponseRouter = await startCheckoutRouter(
|
|
491
498
|
this.baseUrl,
|
|
492
499
|
this.apiKeyTonder,
|
package/src/helpers/utils.js
CHANGED
|
@@ -386,3 +386,20 @@ export function buildErrorResponseFromCatch(e) {
|
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
+
export function injectMercadoPagoSecurity() {
|
|
390
|
+
try {
|
|
391
|
+
const script = document.createElement('script');
|
|
392
|
+
script.src = "https://www.mercadopago.com/v2/security.js";
|
|
393
|
+
script.setAttribute('view', '');
|
|
394
|
+
script.onload = () => {
|
|
395
|
+
console.log("Mercado Pago script loaded successfully.");
|
|
396
|
+
};
|
|
397
|
+
script.onerror = (error) => {
|
|
398
|
+
console.error("Error loading Mercado Pago script:", error);
|
|
399
|
+
};
|
|
400
|
+
document.head.appendChild(script);
|
|
401
|
+
} catch (error) {
|
|
402
|
+
console.error("Error attempting to inject Mercado Pago script:", error);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|