tonder-web-sdk 1.9.3-beta.1 → 1.11.0-beta.1
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 +16 -1
- package/package.json +1 -1
- package/src/classes/3dsHandler.js +29 -10
- package/src/classes/inlineCheckout.js +168 -97
- package/src/data/api.js +20 -0
- package/src/helpers/constants.js +64 -0
- package/src/helpers/template.js +183 -16
- package/src/helpers/utils.js +246 -0
- package/src/index-dev.js +9 -3
- package/v1/bundle.min.js +3 -3
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const PAYMENT_METHOD = Object.freeze({
|
|
2
|
+
SORIANA: "SORIANA",
|
|
3
|
+
OXXO: "OXXO",
|
|
4
|
+
SPEI: "SPEI",
|
|
5
|
+
CODI: "CODI",
|
|
6
|
+
MERCADOPAGO: "MERCADOPAGO",
|
|
7
|
+
PAYPAL: "PAYPAL",
|
|
8
|
+
COMERCIALMEXICANA: "COMERCIALMEXICANA",
|
|
9
|
+
BANCOMER: "BANCOMER",
|
|
10
|
+
WALMART: "WALMART",
|
|
11
|
+
BODEGA: "BODEGA",
|
|
12
|
+
SAMSCLUB: "SAMSCLUB",
|
|
13
|
+
SUPERAMA: "SUPERAMA",
|
|
14
|
+
CALIMAX: "CALIMAX",
|
|
15
|
+
EXTRA: "EXTRA",
|
|
16
|
+
CIRCULOK: "CIRCULOK",
|
|
17
|
+
SEVEN11: "7ELEVEN",
|
|
18
|
+
TELECOMM: "TELECOMM",
|
|
19
|
+
BANORTE: "BANORTE",
|
|
20
|
+
BENAVIDES: "BENAVIDES",
|
|
21
|
+
DELAHORRO: "DELAHORRO",
|
|
22
|
+
ELASTURIANO: "ELASTURIANO",
|
|
23
|
+
WALDOS: "WALDOS",
|
|
24
|
+
ALSUPER: "ALSUPER",
|
|
25
|
+
KIOSKO: "KIOSKO",
|
|
26
|
+
STAMARIA: "STAMARIA",
|
|
27
|
+
LAMASBARATA: "LAMASBARATA",
|
|
28
|
+
FARMROMA: "FARMROMA",
|
|
29
|
+
FARMUNION: "FARMUNION",
|
|
30
|
+
FARMATODO: "FARMATODO",
|
|
31
|
+
SFDEASIS: "SFDEASIS",
|
|
32
|
+
FARM911: "FARM911",
|
|
33
|
+
FARMECONOMICAS: "FARMECONOMICAS",
|
|
34
|
+
FARMMEDICITY: "FARMMEDICITY",
|
|
35
|
+
RIANXEIRA: "RIANXEIRA",
|
|
36
|
+
WESTERNUNION: "WESTERNUNION",
|
|
37
|
+
ZONAPAGO: "ZONAPAGO",
|
|
38
|
+
CAJALOSANDES: "CAJALOSANDES",
|
|
39
|
+
CAJAPAITA: "CAJAPAITA",
|
|
40
|
+
CAJASANTA: "CAJASANTA",
|
|
41
|
+
CAJASULLANA: "CAJASULLANA",
|
|
42
|
+
CAJATRUJILLO: "CAJATRUJILLO",
|
|
43
|
+
EDPYME: "EDPYME",
|
|
44
|
+
KASNET: "KASNET",
|
|
45
|
+
NORANDINO: "NORANDINO",
|
|
46
|
+
QAPAQ: "QAPAQ",
|
|
47
|
+
RAIZ: "RAIZ",
|
|
48
|
+
PAYSER: "PAYSER",
|
|
49
|
+
WUNION: "WUNION",
|
|
50
|
+
BANCOCONTINENTAL: "BANCOCONTINENTAL",
|
|
51
|
+
GMONEY: "GMONEY",
|
|
52
|
+
GOPAY: "GOPAY",
|
|
53
|
+
WU: "WU",
|
|
54
|
+
PUNTOSHEY: "PUNTOSHEY",
|
|
55
|
+
AMPM: "AMPM",
|
|
56
|
+
JUMBOMARKET: "JUMBOMARKET",
|
|
57
|
+
SMELPUEBLO: "SMELPUEBLO",
|
|
58
|
+
BAM: "BAM",
|
|
59
|
+
REFACIL: "REFACIL",
|
|
60
|
+
ACYVALORES: "ACYVALORES",
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export { PAYMENT_METHOD };
|
|
64
|
+
|
package/src/helpers/template.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getCardType } from "./utils";
|
|
1
|
+
import { getAPMType, getCardType } from "./utils";
|
|
2
2
|
|
|
3
|
-
export const cardTemplate = `
|
|
3
|
+
export const cardTemplate = (data) => `
|
|
4
4
|
<div class="container-tonder">
|
|
5
5
|
<div id="cardsListContainer" class="cards-list-container"></div>
|
|
6
6
|
<div class="pay-new-card">
|
|
@@ -19,29 +19,40 @@ export const cardTemplate = `
|
|
|
19
19
|
<div id="collectExpirationYear" class="expiration-year"></div>
|
|
20
20
|
<div id="collectCvv" class="empty-div"></div>
|
|
21
21
|
</div>
|
|
22
|
-
<div class="checkbox">
|
|
22
|
+
<div class="checkbox" id="save-card-container">
|
|
23
23
|
<input id="save-checkout-card" type="checkbox">
|
|
24
24
|
<label for="save-checkout-card">
|
|
25
|
-
Guardar tarjeta para futuros
|
|
25
|
+
Guardar tarjeta para pagos futuros
|
|
26
26
|
</label>
|
|
27
27
|
</div>
|
|
28
28
|
<div id="msgError"></div>
|
|
29
29
|
<div id="msgNotification"></div>
|
|
30
30
|
</div>
|
|
31
|
-
<
|
|
31
|
+
<div id="apmsListContainer" class="apms-list-container"></div>
|
|
32
|
+
<div class="container-pay-button">
|
|
33
|
+
<button id="tonderPayButton" class="pay-button">Pagar</button>
|
|
34
|
+
</div>
|
|
32
35
|
</div>
|
|
33
36
|
|
|
34
37
|
<style>
|
|
38
|
+
|
|
35
39
|
.container-tonder {
|
|
36
40
|
background-color: #F9F9F9;
|
|
37
41
|
margin: 0 auto !important;
|
|
38
|
-
padding:
|
|
42
|
+
padding: 0px;
|
|
39
43
|
overflow: hidden;
|
|
40
44
|
transition: max-height 0.5s ease-out;
|
|
41
45
|
max-width: 600px;
|
|
42
46
|
border: solid 1px #e3e3e3;
|
|
43
|
-
max-height: 100vh;
|
|
44
47
|
position: relative;
|
|
48
|
+
font-family: ${getFontFamily(data)};
|
|
49
|
+
}
|
|
50
|
+
.container-pay-button{
|
|
51
|
+
padding: ${!!data['renderPaymentButton'] ? '30px 25px':''};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.container-form {
|
|
55
|
+
padding: 25px 25px 0px 25px;
|
|
45
56
|
}
|
|
46
57
|
|
|
47
58
|
.collect-row {
|
|
@@ -100,7 +111,7 @@ export const cardTemplate = `
|
|
|
100
111
|
border: none;
|
|
101
112
|
background-color: #000;
|
|
102
113
|
color: #fff;
|
|
103
|
-
margin-bottom:
|
|
114
|
+
margin-bottom: 0px;
|
|
104
115
|
display: none;
|
|
105
116
|
}
|
|
106
117
|
|
|
@@ -160,16 +171,22 @@ export const cardTemplate = `
|
|
|
160
171
|
margin-top: 10px;
|
|
161
172
|
margin-bottom: 20px;
|
|
162
173
|
text-align: left;
|
|
163
|
-
padding: 0
|
|
174
|
+
padding: 0 8px;
|
|
164
175
|
}
|
|
165
176
|
|
|
166
177
|
.cards-list-container {
|
|
167
178
|
display: flex;
|
|
168
179
|
flex-direction: column;
|
|
169
|
-
padding: 0px
|
|
180
|
+
padding: 0px;
|
|
170
181
|
gap: 33% 20px;
|
|
171
182
|
}
|
|
172
183
|
|
|
184
|
+
.apms-list-container {
|
|
185
|
+
display: flex;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
padding: ;
|
|
188
|
+
gap: 33% 20px;
|
|
189
|
+
}
|
|
173
190
|
.pay-new-card {
|
|
174
191
|
display: flex;
|
|
175
192
|
justify-content: start;
|
|
@@ -178,8 +195,7 @@ export const cardTemplate = `
|
|
|
178
195
|
gap: 33% 15px;
|
|
179
196
|
margin-top: 10px;
|
|
180
197
|
margin-bottom: 10px;
|
|
181
|
-
padding
|
|
182
|
-
padding-right: 10px;
|
|
198
|
+
padding: 0px 30px;
|
|
183
199
|
width: 100%;
|
|
184
200
|
position: relative;
|
|
185
201
|
}
|
|
@@ -212,7 +228,7 @@ export const cardTemplate = `
|
|
|
212
228
|
appearance: none;
|
|
213
229
|
cursor: pointer;
|
|
214
230
|
border-radius: 100%;
|
|
215
|
-
border: 1px #
|
|
231
|
+
border: 1px #bababa solid;
|
|
216
232
|
color: #3bc635;
|
|
217
233
|
transition-property: all;
|
|
218
234
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
@@ -338,8 +354,8 @@ export const cardItemsTemplate = (cards) => {
|
|
|
338
354
|
align-items: center;
|
|
339
355
|
color: #1D1D1D;
|
|
340
356
|
gap: 33% 20px;
|
|
341
|
-
margin-top:
|
|
342
|
-
margin-bottom:
|
|
357
|
+
margin-top: 15px;
|
|
358
|
+
margin-bottom: 15px;
|
|
343
359
|
width: 100%;
|
|
344
360
|
}
|
|
345
361
|
|
|
@@ -349,6 +365,8 @@ export const cardItemsTemplate = (cards) => {
|
|
|
349
365
|
justify-content: start;
|
|
350
366
|
align-items: center;
|
|
351
367
|
gap: 33% 15px;
|
|
368
|
+
border-bottom: 1px solid #e2e8f0;
|
|
369
|
+
padding: 0px 30px;
|
|
352
370
|
}
|
|
353
371
|
|
|
354
372
|
.card-item .card-number {
|
|
@@ -383,7 +401,7 @@ export const cardItemsTemplate = (cards) => {
|
|
|
383
401
|
appearance: none;
|
|
384
402
|
cursor: pointer;
|
|
385
403
|
border-radius: 100%;
|
|
386
|
-
border: 1px #
|
|
404
|
+
border: 1px #bababa solid;
|
|
387
405
|
color: #3bc635;
|
|
388
406
|
transition-property: all;
|
|
389
407
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
@@ -465,3 +483,152 @@ export const cardItemsTemplate = (cards) => {
|
|
|
465
483
|
`
|
|
466
484
|
return cardItem;
|
|
467
485
|
}
|
|
486
|
+
|
|
487
|
+
export const apmItemsTemplate = (apms) => {
|
|
488
|
+
|
|
489
|
+
const apmItemsHTML = apms.reduce((total, apm) => {
|
|
490
|
+
const apm_data = getAPMType(apm.payment_method);
|
|
491
|
+
return `${total}
|
|
492
|
+
<div class="apm-item" id="card_container-${apm.pk}">
|
|
493
|
+
<input id="${apm.pk}" class="card_selected" name="card_selected" type="radio"/>
|
|
494
|
+
<label class="apm-item-label" for="${apm.pk}">
|
|
495
|
+
<img class="apm-image" src="${apm_data.icon}" />
|
|
496
|
+
<div class="apm-name">${apm_data.label}</div>
|
|
497
|
+
</label>
|
|
498
|
+
</div>`
|
|
499
|
+
}, ``);
|
|
500
|
+
|
|
501
|
+
const apmItemStyle = `
|
|
502
|
+
<style>
|
|
503
|
+
.apm-item-label {
|
|
504
|
+
display: flex;
|
|
505
|
+
justify-content: flex-start;
|
|
506
|
+
align-items: center;
|
|
507
|
+
color: #1D1D1D;
|
|
508
|
+
gap: 33% 10px;
|
|
509
|
+
margin-top: 15px;
|
|
510
|
+
margin-bottom: 15px;
|
|
511
|
+
width: 100%;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.apm-item {
|
|
515
|
+
position: relative;
|
|
516
|
+
display: flex;
|
|
517
|
+
justify-content: start;
|
|
518
|
+
align-items: center;
|
|
519
|
+
gap: 33% 15px;
|
|
520
|
+
border-bottom: 1px solid #e2e8f0;
|
|
521
|
+
padding: 0px 30px;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.apm-item:first-child {
|
|
525
|
+
border-top: 1px solid #e2e8f0;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.apm-item .apm-name {
|
|
529
|
+
font-size: 16px;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.apm-image {
|
|
533
|
+
width: auto;
|
|
534
|
+
height: 30px;
|
|
535
|
+
text-align: left;
|
|
536
|
+
border: 1px solid #e2e8f0;
|
|
537
|
+
border-radius: 8px;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.card_selected {
|
|
541
|
+
position: relative;
|
|
542
|
+
width: 16px;
|
|
543
|
+
min-width: 16px;
|
|
544
|
+
height: 16px;
|
|
545
|
+
appearance: none;
|
|
546
|
+
cursor: pointer;
|
|
547
|
+
border-radius: 100%;
|
|
548
|
+
border: 1px #bababa solid;
|
|
549
|
+
color: #3bc635;
|
|
550
|
+
transition-property: all;
|
|
551
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
552
|
+
transition-duration: 150ms;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.card_selected:before {
|
|
556
|
+
width: 8px;
|
|
557
|
+
height: 8px;
|
|
558
|
+
content: "";
|
|
559
|
+
position: absolute;
|
|
560
|
+
top: 50%;
|
|
561
|
+
left: 50%;
|
|
562
|
+
display: block;
|
|
563
|
+
transform: translate(-50%, -50%);
|
|
564
|
+
border-radius: 100%;
|
|
565
|
+
background-color: #3bc635;
|
|
566
|
+
opacity: 0;
|
|
567
|
+
transition-property: opacity;
|
|
568
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
569
|
+
transition-duration: 150ms;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.card_selected:checked {
|
|
573
|
+
border: 1px #3bc635 solid;
|
|
574
|
+
position: relative;
|
|
575
|
+
width: 16px;
|
|
576
|
+
height: 16px;
|
|
577
|
+
min-width: 16px;
|
|
578
|
+
appearance: none;
|
|
579
|
+
cursor: pointer;
|
|
580
|
+
border-radius: 100%;
|
|
581
|
+
color: #3bc635;
|
|
582
|
+
transition-property: all;
|
|
583
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
584
|
+
transition-duration: 150ms;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.card_selected:checked:before {
|
|
588
|
+
content: "";
|
|
589
|
+
border: 1px #3bc635 solid;
|
|
590
|
+
width: 8px;
|
|
591
|
+
height: 8px;
|
|
592
|
+
position: absolute;
|
|
593
|
+
top: 50%;
|
|
594
|
+
left: 50%;
|
|
595
|
+
display: block;
|
|
596
|
+
transform: translate(-50%, -50%);
|
|
597
|
+
border-radius: 100%;
|
|
598
|
+
background-color: #3bc635;
|
|
599
|
+
opacity: 50;
|
|
600
|
+
transition-property: opacity;
|
|
601
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
602
|
+
transition-duration: 150ms;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.card_selected:hover:before {
|
|
606
|
+
width: 8px;
|
|
607
|
+
height: 8px;
|
|
608
|
+
content: "";
|
|
609
|
+
position: absolute;
|
|
610
|
+
top: 50%;
|
|
611
|
+
left: 50%;
|
|
612
|
+
display: block;
|
|
613
|
+
transform: translate(-50%, -50%);
|
|
614
|
+
border-radius: 100%;
|
|
615
|
+
background-color: #3bc635;
|
|
616
|
+
transition-property: opacity;
|
|
617
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
618
|
+
transition-duration: 150ms;
|
|
619
|
+
opacity: 10;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
</style>
|
|
623
|
+
`
|
|
624
|
+
const apmItem = `
|
|
625
|
+
${apmItemsHTML}
|
|
626
|
+
${apmItemStyle}
|
|
627
|
+
`
|
|
628
|
+
return apmItem;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
const getFontFamily = (data) => {
|
|
632
|
+
const base = data?.customStyles?.labelStyles?.base;
|
|
633
|
+
return base?.fontFamily || '"Inter", sans-serif';
|
|
634
|
+
};
|