apacuana-sdk-core 1.26.8 → 1.26.10

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.
Files changed (34) hide show
  1. package/README.md +28 -0
  2. package/coverage/clover.xml +50 -36
  3. package/coverage/coverage-final.json +4 -4
  4. package/coverage/lcov-report/index.html +25 -25
  5. package/coverage/lcov-report/src/api/certs.js.html +1 -1
  6. package/coverage/lcov-report/src/api/faceLiveness.js.html +1 -1
  7. package/coverage/lcov-report/src/api/index.html +18 -18
  8. package/coverage/lcov-report/src/api/revocations.js.html +1 -1
  9. package/coverage/lcov-report/src/api/signatures.js.html +1 -1
  10. package/coverage/lcov-report/src/api/users.js.html +127 -10
  11. package/coverage/lcov-report/src/config/index.html +1 -1
  12. package/coverage/lcov-report/src/config/index.js.html +1 -1
  13. package/coverage/lcov-report/src/errors/index.html +1 -1
  14. package/coverage/lcov-report/src/errors/index.js.html +8 -8
  15. package/coverage/lcov-report/src/index.html +14 -14
  16. package/coverage/lcov-report/src/index.js.html +24 -9
  17. package/coverage/lcov-report/src/success/index.html +1 -1
  18. package/coverage/lcov-report/src/success/index.js.html +5 -5
  19. package/coverage/lcov-report/src/utils/constant.js.html +1 -1
  20. package/coverage/lcov-report/src/utils/helpers.js.html +1 -1
  21. package/coverage/lcov-report/src/utils/httpClient.js.html +1 -1
  22. package/coverage/lcov-report/src/utils/index.html +1 -1
  23. package/coverage/lcov.info +98 -65
  24. package/dist/api/users.d.ts +5 -1
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +78 -16
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +78 -16
  29. package/dist/index.mjs.map +1 -1
  30. package/package.json +1 -1
  31. package/src/api/users.js +39 -0
  32. package/src/index.js +6 -1
  33. package/tests/api/users.test.js +68 -1
  34. package/tests/integration/searchCustomer.test.js +75 -0
package/README.md CHANGED
@@ -68,6 +68,7 @@ El SDK puede inicializarse sin el parámetro `customerId`, lo que permite el acc
68
68
  - `createDocument(params)`
69
69
  - `lockDocument(documentId)`
70
70
  - `deleteSignature(params)`
71
+ - `searchCustomer(params)`
71
72
 
72
73
  **Funciones privadas (requieren `customerId`):**
73
74
 
@@ -168,6 +169,33 @@ const result = await apacuana.getCustomer();
168
169
  // result.data contendrá los datos del usuario y el token
169
170
  ```
170
171
 
172
+ ### `searchCustomer(params)`
173
+
174
+ Busca un cliente en el flujo de onboarding por correo electrónico y/o cédula. Es una función pública (no requiere `customerId`). Debe recibir al menos uno de los dos campos; si no, lanza un `ApacuanaAPIError` con código `INVALID_SEARCH_QUERY`. El resultado viene en `data.customer`, con el registro del cliente ya desanidado, o `null` si no hay coincidencia.
175
+
176
+ #### Parámetros:
177
+
178
+ - `email` (string, opcional): Correo electrónico a buscar.
179
+ - `doc` (string, opcional): Número de cédula a buscar.
180
+
181
+ #### Ejemplo:
182
+
183
+ ```js
184
+ // Por email
185
+ const byEmail = await apacuana.searchCustomer({ email: "samuel_dear@hotmail.com" });
186
+
187
+ // Por cédula
188
+ const byDoc = await apacuana.searchCustomer({ doc: "28152139" });
189
+
190
+ // Combinado
191
+ const result = await apacuana.searchCustomer({
192
+ email: "samuel_dear@hotmail.com",
193
+ doc: "28152139",
194
+ });
195
+
196
+ result.data.customer; // datos del cliente, o null si no hay match
197
+ ```
198
+
171
199
  ### `generateCert(params)`
172
200
 
173
201
  Genera un nuevo certificado digital.
@@ -1,11 +1,11 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1782238551129" clover="3.2.0">
3
- <project timestamp="1782238551129" name="All files">
4
- <metrics statements="667" coveredstatements="381" conditionals="496" coveredconditionals="177" methods="109" coveredmethods="58" elements="1272" coveredelements="616" complexity="0" loc="667" ncloc="667" packages="6" files="12" classes="12"/>
2
+ <coverage generated="1783527521589" clover="3.2.0">
3
+ <project timestamp="1783527521589" name="All files">
4
+ <metrics statements="681" coveredstatements="393" conditionals="511" coveredconditionals="190" methods="111" coveredmethods="59" elements="1303" coveredelements="642" complexity="0" loc="681" ncloc="681" packages="6" files="12" classes="12"/>
5
5
  <package name="src">
6
- <metrics statements="63" coveredstatements="15" conditionals="15" coveredconditionals="3" methods="23" coveredmethods="1"/>
6
+ <metrics statements="65" coveredstatements="15" conditionals="15" coveredconditionals="3" methods="24" coveredmethods="1"/>
7
7
  <file name="index.js" path="/builds/3dlinkweb/apacuana/libs/apacuana-sdk-core/main/src/index.js">
8
- <metrics statements="63" coveredstatements="15" conditionals="15" coveredconditionals="3" methods="23" coveredmethods="1"/>
8
+ <metrics statements="65" coveredstatements="15" conditionals="15" coveredconditionals="3" methods="24" coveredmethods="1"/>
9
9
  <line num="33" count="1" type="cond" truecount="0" falsecount="1"/>
10
10
  <line num="34" count="0" type="stmt"/>
11
11
  <line num="36" count="0" type="cond" truecount="0" falsecount="4"/>
@@ -62,17 +62,19 @@
62
62
  <line num="159" count="0" type="stmt"/>
63
63
  <line num="163" count="0" type="stmt"/>
64
64
  <line num="164" count="0" type="stmt"/>
65
- <line num="167" count="0" type="stmt"/>
66
65
  <line num="168" count="0" type="stmt"/>
66
+ <line num="169" count="0" type="stmt"/>
67
67
  <line num="172" count="0" type="stmt"/>
68
68
  <line num="173" count="0" type="stmt"/>
69
- <line num="176" count="0" type="stmt"/>
70
69
  <line num="177" count="0" type="stmt"/>
71
- <line num="180" count="0" type="stmt"/>
70
+ <line num="178" count="0" type="stmt"/>
71
+ <line num="181" count="0" type="stmt"/>
72
+ <line num="182" count="0" type="stmt"/>
73
+ <line num="185" count="0" type="stmt"/>
72
74
  </file>
73
75
  </package>
74
76
  <package name="src.api">
75
- <metrics statements="383" coveredstatements="331" conditionals="230" coveredconditionals="170" methods="58" coveredmethods="55"/>
77
+ <metrics statements="395" coveredstatements="343" conditionals="245" coveredconditionals="183" methods="59" coveredmethods="56"/>
76
78
  <file name="certs.js" path="/builds/3dlinkweb/apacuana/libs/apacuana-sdk-core/main/src/api/certs.js">
77
79
  <metrics statements="80" coveredstatements="72" conditionals="38" coveredconditionals="31" methods="13" coveredmethods="13"/>
78
80
  <line num="25" count="2" type="stmt"/>
@@ -441,7 +443,7 @@
441
443
  <line num="724" count="1" type="stmt"/>
442
444
  </file>
443
445
  <file name="users.js" path="/builds/3dlinkweb/apacuana/libs/apacuana-sdk-core/main/src/api/users.js">
444
- <metrics statements="28" coveredstatements="14" conditionals="29" coveredconditionals="11" methods="3" coveredmethods="1"/>
446
+ <metrics statements="40" coveredstatements="26" conditionals="44" coveredconditionals="24" methods="4" coveredmethods="2"/>
445
447
  <line num="27" count="2" type="stmt"/>
446
448
  <line num="28" count="5" type="stmt"/>
447
449
  <line num="30" count="5" type="cond" truecount="4" falsecount="0"/>
@@ -455,21 +457,33 @@
455
457
  <line num="63" count="3" type="cond" truecount="2" falsecount="0"/>
456
458
  <line num="64" count="2" type="stmt"/>
457
459
  <line num="66" count="1" type="stmt"/>
458
- <line num="92" count="2" type="stmt"/>
459
- <line num="93" count="0" type="stmt"/>
460
- <line num="94" count="0" type="stmt"/>
461
- <line num="95" count="0" type="stmt"/>
462
- <line num="96" count="0" type="stmt"/>
463
- <line num="98" count="0" type="cond" truecount="0" falsecount="5"/>
464
- <line num="103" count="0" type="cond" truecount="0" falsecount="4"/>
465
- <line num="104" count="0" type="stmt"/>
466
- <line num="105" count="0" type="cond" truecount="0" falsecount="4"/>
467
- <line num="106" count="0" type="stmt"/>
468
- <line num="110" count="0" type="stmt"/>
469
- <line num="116" count="0" type="stmt"/>
470
- <line num="120" count="0" type="cond" truecount="0" falsecount="2"/>
471
- <line num="121" count="0" type="stmt"/>
472
- <line num="123" count="0" type="stmt"/>
460
+ <line num="100" count="2" type="cond" truecount="0" falsecount="1"/>
461
+ <line num="101" count="6" type="cond" truecount="4" falsecount="0"/>
462
+ <line num="102" count="1" type="stmt"/>
463
+ <line num="109" count="5" type="stmt"/>
464
+ <line num="110" count="5" type="cond" truecount="2" falsecount="0"/>
465
+ <line num="111" count="5" type="cond" truecount="2" falsecount="0"/>
466
+ <line num="113" count="5" type="stmt"/>
467
+ <line num="114" count="5" type="stmt"/>
468
+ <line num="120" count="3" type="cond" truecount="2" falsecount="0"/>
469
+ <line num="122" count="2" type="cond" truecount="2" falsecount="0"/>
470
+ <line num="123" count="1" type="stmt"/>
471
+ <line num="125" count="1" type="stmt"/>
472
+ <line num="131" count="2" type="stmt"/>
473
+ <line num="132" count="0" type="stmt"/>
474
+ <line num="133" count="0" type="stmt"/>
475
+ <line num="134" count="0" type="stmt"/>
476
+ <line num="135" count="0" type="stmt"/>
477
+ <line num="137" count="0" type="cond" truecount="0" falsecount="5"/>
478
+ <line num="142" count="0" type="cond" truecount="0" falsecount="4"/>
479
+ <line num="143" count="0" type="stmt"/>
480
+ <line num="144" count="0" type="cond" truecount="0" falsecount="4"/>
481
+ <line num="145" count="0" type="stmt"/>
482
+ <line num="149" count="0" type="stmt"/>
483
+ <line num="155" count="0" type="stmt"/>
484
+ <line num="159" count="0" type="cond" truecount="0" falsecount="2"/>
485
+ <line num="160" count="0" type="stmt"/>
486
+ <line num="162" count="0" type="stmt"/>
473
487
  </file>
474
488
  </package>
475
489
  <package name="src.config">
@@ -494,23 +508,23 @@
494
508
  <metrics statements="7" coveredstatements="7" conditionals="4" coveredconditionals="3" methods="1" coveredmethods="1"/>
495
509
  <file name="index.js" path="/builds/3dlinkweb/apacuana/libs/apacuana-sdk-core/main/src/errors/index.js">
496
510
  <metrics statements="7" coveredstatements="7" conditionals="4" coveredconditionals="3" methods="1" coveredmethods="1"/>
497
- <line num="8" count="121" type="stmt"/>
498
- <line num="9" count="121" type="stmt"/>
499
- <line num="10" count="121" type="stmt"/>
500
- <line num="11" count="121" type="stmt"/>
501
- <line num="12" count="121" type="stmt"/>
502
- <line num="15" count="121" type="cond" truecount="1" falsecount="1"/>
503
- <line num="16" count="121" type="stmt"/>
511
+ <line num="8" count="124" type="stmt"/>
512
+ <line num="9" count="124" type="stmt"/>
513
+ <line num="10" count="124" type="stmt"/>
514
+ <line num="11" count="124" type="stmt"/>
515
+ <line num="12" count="124" type="stmt"/>
516
+ <line num="15" count="124" type="cond" truecount="1" falsecount="1"/>
517
+ <line num="16" count="124" type="stmt"/>
504
518
  </file>
505
519
  </package>
506
520
  <package name="src.success">
507
521
  <metrics statements="4" coveredstatements="4" conditionals="1" coveredconditionals="1" methods="1" coveredmethods="1"/>
508
522
  <file name="index.js" path="/builds/3dlinkweb/apacuana/libs/apacuana-sdk-core/main/src/success/index.js">
509
523
  <metrics statements="4" coveredstatements="4" conditionals="1" coveredconditionals="1" methods="1" coveredmethods="1"/>
510
- <line num="3" count="23" type="stmt"/>
511
- <line num="4" count="23" type="stmt"/>
512
- <line num="5" count="23" type="stmt"/>
513
- <line num="6" count="23" type="stmt"/>
524
+ <line num="3" count="26" type="stmt"/>
525
+ <line num="4" count="26" type="stmt"/>
526
+ <line num="5" count="26" type="stmt"/>
527
+ <line num="6" count="26" type="stmt"/>
514
528
  </file>
515
529
  </package>
516
530
  <package name="src.utils">