@tonder.io/ionic-full-sdk 0.0.4 → 0.0.5
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/README.md +338 -88
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/classes/3dsHandler.ts +1 -3
- package/src/classes/inlineCheckout.ts +44 -44
- package/src/helpers/template.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonder.io/ionic-full-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Tonder ionic full SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@tonder.io/ionic-lite-sdk": "^0.0.
|
|
13
|
+
"@tonder.io/ionic-lite-sdk": "^0.0.12",
|
|
14
14
|
"crypto-js": "^4.1.1",
|
|
15
15
|
"skyflow-js": "^1.34.1"
|
|
16
16
|
},
|
|
@@ -42,9 +42,7 @@ export class ThreeDSHandler {
|
|
|
42
42
|
redirectTo3DS() {
|
|
43
43
|
const url = this.payload?.next_action?.redirect_to_url?.url
|
|
44
44
|
if (url) {
|
|
45
|
-
this.saveVerifyTransactionUrl()
|
|
46
|
-
window.open('@tonder/ionic-full-sdk://', '_system')
|
|
47
|
-
// window.open(url, '_blank');
|
|
45
|
+
this.saveVerifyTransactionUrl();
|
|
48
46
|
return true
|
|
49
47
|
} else {
|
|
50
48
|
console.log('No redirection found');
|
|
@@ -19,11 +19,8 @@ export type InlineCheckoutConstructor = {
|
|
|
19
19
|
renderPaymentButton: boolean,
|
|
20
20
|
callBack?: (params: any) => void,
|
|
21
21
|
styles?: any,
|
|
22
|
-
form?: any,
|
|
23
|
-
totalElement?: any,
|
|
24
22
|
containerId?: string,
|
|
25
|
-
collectorIds?: CollectorIds
|
|
26
|
-
platforms?: string[]
|
|
23
|
+
collectorIds?: CollectorIds
|
|
27
24
|
}
|
|
28
25
|
|
|
29
26
|
export class InlineCheckout {
|
|
@@ -71,8 +68,7 @@ export class InlineCheckout {
|
|
|
71
68
|
callBack = () => {},
|
|
72
69
|
styles,
|
|
73
70
|
containerId,
|
|
74
|
-
collectorIds
|
|
75
|
-
platforms
|
|
71
|
+
collectorIds
|
|
76
72
|
}: InlineCheckoutConstructor) {
|
|
77
73
|
this.apiKeyTonder = apiKey;
|
|
78
74
|
this.returnUrl = returnUrl;
|
|
@@ -80,7 +76,6 @@ export class InlineCheckout {
|
|
|
80
76
|
this.renderPaymentButton = renderPaymentButton;
|
|
81
77
|
this.callBack = callBack;
|
|
82
78
|
this.customStyles = styles
|
|
83
|
-
this.platforms = platforms
|
|
84
79
|
|
|
85
80
|
this.abortController = new AbortController()
|
|
86
81
|
|
|
@@ -292,7 +287,7 @@ export class InlineCheckout {
|
|
|
292
287
|
|
|
293
288
|
if("cards" in cards) {
|
|
294
289
|
|
|
295
|
-
const cardsMapped: Card[] = cards.cards.
|
|
290
|
+
const cardsMapped: Card[] = cards.cards.map(card => ({ ...card.fields }))
|
|
296
291
|
|
|
297
292
|
this.loadCardsList(cardsMapped)
|
|
298
293
|
|
|
@@ -365,47 +360,51 @@ export class InlineCheckout {
|
|
|
365
360
|
}
|
|
366
361
|
|
|
367
362
|
async #checkout() {
|
|
363
|
+
|
|
368
364
|
try {
|
|
369
|
-
const selector: any = document.querySelector(`#${this.collectorIds.tonderPayButton}`);
|
|
370
|
-
if(selector){
|
|
371
|
-
selector.disabled = true;
|
|
372
|
-
}
|
|
373
|
-
} catch (error) {
|
|
374
|
-
}
|
|
375
365
|
|
|
376
|
-
|
|
366
|
+
try {
|
|
367
|
+
|
|
368
|
+
const selector: any = document.querySelector(`#${this.collectorIds.tonderPayButton}`);
|
|
369
|
+
|
|
370
|
+
if(selector){
|
|
371
|
+
selector.disabled = true;
|
|
372
|
+
selector.innerHTML = "Cargando..."
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
} catch (error) { }
|
|
376
|
+
|
|
377
|
+
if(this.merchantData) {
|
|
377
378
|
|
|
378
|
-
|
|
379
|
+
if("openpay_keys" in this.merchantData) {
|
|
379
380
|
|
|
380
|
-
|
|
381
|
+
const { openpay_keys, reference, business } = this.merchantData
|
|
381
382
|
|
|
382
|
-
|
|
383
|
+
const total = Number(this.cartTotal)
|
|
383
384
|
|
|
384
|
-
|
|
385
|
+
let cardTokensSkyflowTonder: any = null;
|
|
385
386
|
|
|
386
|
-
|
|
387
|
+
if(this.radioChecked === "new") {
|
|
387
388
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
389
|
+
if(this.collectContainer && "container" in this.collectContainer && "collect" in this.collectContainer.container) {
|
|
390
|
+
try {
|
|
391
|
+
const collectResponseSkyflowTonder: any = await this.collectContainer?.container.collect();
|
|
392
|
+
cardTokensSkyflowTonder = await collectResponseSkyflowTonder["records"][0]["fields"];
|
|
393
|
+
} catch (error) {
|
|
394
|
+
showError("Por favor, verifica todos los campos de tu tarjeta", this.collectorIds.msgError, this.collectorIds.tonderPayButton)
|
|
395
|
+
throw error;
|
|
396
|
+
}
|
|
397
|
+
} else {
|
|
393
398
|
showError("Por favor, verifica todos los campos de tu tarjeta", this.collectorIds.msgError, this.collectorIds.tonderPayButton)
|
|
394
|
-
throw error;
|
|
395
399
|
}
|
|
400
|
+
|
|
396
401
|
} else {
|
|
397
|
-
showError("Por favor, verifica todos los campos de tu tarjeta", this.collectorIds.msgError, this.collectorIds.tonderPayButton)
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
} else {
|
|
401
402
|
|
|
402
|
-
|
|
403
|
-
|
|
403
|
+
cardTokensSkyflowTonder = {
|
|
404
|
+
skyflow_id: this.radioChecked
|
|
405
|
+
}
|
|
406
|
+
|
|
404
407
|
}
|
|
405
|
-
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
try {
|
|
409
408
|
|
|
410
409
|
let deviceSessionIdTonder: any;
|
|
411
410
|
|
|
@@ -436,7 +435,7 @@ export class InlineCheckout {
|
|
|
436
435
|
|
|
437
436
|
if("cards" in cards) {
|
|
438
437
|
|
|
439
|
-
const cardsMapped: Card[] = cards.cards.
|
|
438
|
+
const cardsMapped: Card[] = cards.cards.map(card => ({ ...card.fields }))
|
|
440
439
|
|
|
441
440
|
this.loadCardsList(cardsMapped)
|
|
442
441
|
|
|
@@ -505,7 +504,6 @@ export class InlineCheckout {
|
|
|
505
504
|
const jsonResponseRouter = await this.liteCheckout.startCheckoutRouter(
|
|
506
505
|
routerItems
|
|
507
506
|
);
|
|
508
|
-
|
|
509
507
|
if (jsonResponseRouter) {
|
|
510
508
|
try {
|
|
511
509
|
const selector: any = document.querySelector(`#${this.collectorIds.tonderPayButton}`);
|
|
@@ -521,14 +519,16 @@ export class InlineCheckout {
|
|
|
521
519
|
}
|
|
522
520
|
}
|
|
523
521
|
}
|
|
524
|
-
} catch (error) {
|
|
525
|
-
console.log(error);
|
|
526
|
-
showError("Ha ocurrido un error", this.collectorIds.msgError, this.collectorIds.tonderPayButton)
|
|
527
|
-
throw error;
|
|
528
522
|
}
|
|
529
|
-
|
|
523
|
+
} else {
|
|
524
|
+
showError("No se han configurado los datos del proveedor de servicio", this.collectorIds.msgError, this.collectorIds.tonderPayButton)
|
|
530
525
|
}
|
|
531
|
-
|
|
526
|
+
} catch (error) {
|
|
527
|
+
console.log(error);
|
|
528
|
+
showError("Ha ocurrido un error", this.collectorIds.msgError, this.collectorIds.tonderPayButton)
|
|
529
|
+
throw error;
|
|
530
|
+
} finally {
|
|
531
|
+
this.fetchingPayment = false;
|
|
532
532
|
}
|
|
533
533
|
};
|
|
534
534
|
}
|
package/src/helpers/template.ts
CHANGED