apacuana-sdk-core 0.9.0 → 0.11.0
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 +320 -236
- package/coverage/clover.xml +341 -212
- package/coverage/coverage-final.json +9 -7
- package/coverage/lcov-report/index.html +34 -19
- package/coverage/lcov-report/src/api/certs.js.html +493 -37
- package/coverage/lcov-report/src/api/faceLiveness.js.html +496 -0
- package/coverage/lcov-report/src/api/index.html +43 -28
- package/coverage/lcov-report/src/api/revocations.js.html +103 -106
- package/coverage/lcov-report/src/api/signatures.js.html +25 -253
- package/coverage/lcov-report/src/api/users.js.html +7 -13
- package/coverage/lcov-report/src/config/index.html +1 -1
- package/coverage/lcov-report/src/config/index.js.html +1 -1
- package/coverage/lcov-report/src/errors/index.html +1 -1
- package/coverage/lcov-report/src/errors/index.js.html +8 -8
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.js.html +48 -3
- package/coverage/lcov-report/src/success/index.html +116 -0
- package/coverage/lcov-report/src/success/index.js.html +106 -0
- package/coverage/lcov-report/src/utils/constant.js.html +4 -4
- package/coverage/lcov-report/src/utils/helpers.js.html +1 -1
- package/coverage/lcov-report/src/utils/httpClient.js.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov.info +591 -352
- package/dist/api/certs.d.ts +13 -30
- package/dist/api/faceLiveness.d.ts +6 -0
- package/dist/api/revocations.d.ts +3 -42
- package/dist/api/signatures.d.ts +11 -153
- package/dist/index.d.ts +10 -0
- package/dist/index.js +630 -214
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +630 -214
- package/dist/index.mjs.map +1 -1
- package/dist/success/index.d.ts +7 -0
- package/dist/types/certs.d.ts +97 -0
- package/dist/types/faceLiveness.d.ts +10 -0
- package/dist/types/revocations.d.ts +40 -0
- package/dist/types/signatures.d.ts +152 -0
- package/dist/types/users.d.ts +260 -0
- package/package.json +1 -1
- package/src/api/certs.js +175 -23
- package/src/api/faceLiveness.js +137 -0
- package/src/api/revocations.js +66 -67
- package/src/api/signatures.js +21 -97
- package/src/api/users.js +4 -6
- package/src/index.js +16 -1
- package/src/success/index.js +8 -0
- package/src/types/certs.js +56 -0
- package/src/types/faceLiveness.js +7 -0
- package/src/types/revocations.js +25 -0
- package/src/types/signatures.js +77 -0
- package/src/types/users.js +73 -0
- package/tests/api/certs.test.js +209 -4
- package/tests/api/faceLiveness.test.js +172 -0
- package/tests/api/revocations.test.js +37 -37
- package/tests/api/signatures.test.js +11 -5
- package/tests/api/users.test.js +3 -2
package/dist/index.mjs
CHANGED
|
@@ -529,6 +529,15 @@ var httpRequest = /*#__PURE__*/function () {
|
|
|
529
529
|
};
|
|
530
530
|
}();
|
|
531
531
|
|
|
532
|
+
var ApacuanaSuccess = /*#__PURE__*/_createClass(function ApacuanaSuccess(data) {
|
|
533
|
+
var statusCode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
534
|
+
_classCallCheck(this, ApacuanaSuccess);
|
|
535
|
+
this.success = true;
|
|
536
|
+
this.statusCode = statusCode;
|
|
537
|
+
this.name = "ApacuanaSuccess";
|
|
538
|
+
this.data = data;
|
|
539
|
+
});
|
|
540
|
+
|
|
532
541
|
/**
|
|
533
542
|
* @typedef {object} GetCustomerResponse
|
|
534
543
|
* @property {string} token - El token de sesión del usuario.
|
|
@@ -573,11 +582,10 @@ var getCustomer = /*#__PURE__*/function () {
|
|
|
573
582
|
}
|
|
574
583
|
throw new ApacuanaAPIError("The API response does not contain the user.", 200, "INVALID_API_RESPONSE");
|
|
575
584
|
case 4:
|
|
576
|
-
return _context.a(2, {
|
|
585
|
+
return _context.a(2, new ApacuanaSuccess({
|
|
577
586
|
token: response.sessionid,
|
|
578
|
-
userData: response.entry
|
|
579
|
-
|
|
580
|
-
});
|
|
587
|
+
userData: response.entry
|
|
588
|
+
}));
|
|
581
589
|
case 5:
|
|
582
590
|
_context.p = 5;
|
|
583
591
|
_t = _context.v;
|
|
@@ -598,122 +606,166 @@ var getCustomer = /*#__PURE__*/function () {
|
|
|
598
606
|
};
|
|
599
607
|
}();
|
|
600
608
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
* @property {string} revocationStatus - El estado de la solicitud de revocación (e.g., "pending").
|
|
604
|
-
* @property {string|number} requestId - El ID de la solicitud de revocación.
|
|
605
|
-
*/
|
|
606
|
-
|
|
607
|
-
/**
|
|
608
|
-
* Simula la solicitud de revocación de un certificado.
|
|
609
|
-
* @param {string} reasonCode - Código o descripción del motivo de la revocación.
|
|
610
|
-
* @returns {Promise<RequestRevocationResponse>} Objeto con el estado de la solicitud de revocación.
|
|
611
|
-
*/
|
|
612
|
-
/**
|
|
613
|
-
* @typedef {object} RevocationResponse
|
|
614
|
-
* @property {boolean} success - Indicates if the revocation request was successful.
|
|
615
|
-
* @property {string} [message] - A message providing details about the outcome.
|
|
616
|
-
*/
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* @typedef {object} RevocationReason
|
|
620
|
-
* @property {string} code - The code for the revocation reason.
|
|
621
|
-
* @property {string} description - The description of the revocation reason.
|
|
622
|
-
*/
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
* @typedef {object} RevocationReasonsResponse
|
|
626
|
-
* @property {boolean} success - Indicates if the request was successful.
|
|
627
|
-
* @property {RevocationReason[]} reasons - A list of revocation reasons.
|
|
628
|
-
*/
|
|
629
|
-
|
|
630
|
-
/**
|
|
631
|
-
* Requests the revocation of a certificate.
|
|
632
|
-
* @param {number} reasonCode - Código o descripción del motivo de la revocación.
|
|
633
|
-
* @returns {Promise<RevocationResponse>} An object indicating the success of the request.
|
|
634
|
-
* @throws {ApacuanaAPIError} If the revocation request fails.
|
|
635
|
-
*/
|
|
636
|
-
var requestRevocation = /*#__PURE__*/function () {
|
|
637
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(reasonCode) {
|
|
609
|
+
var requestRevocationOnBoarding = /*#__PURE__*/function () {
|
|
610
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
638
611
|
var response, _t;
|
|
639
612
|
return _regenerator().w(function (_context) {
|
|
640
613
|
while (1) switch (_context.p = _context.n) {
|
|
641
614
|
case 0:
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
}
|
|
646
|
-
throw new Error("Código de motivo es requerido para requestRevocation.");
|
|
615
|
+
_context.p = 0;
|
|
616
|
+
_context.n = 1;
|
|
617
|
+
return httpRequest("services/api/certificate/revocation", params, "POST");
|
|
647
618
|
case 1:
|
|
648
|
-
_context.p = 1;
|
|
649
|
-
_context.n = 2;
|
|
650
|
-
return httpRequest("services/api/onboardingclient/requestcert", {
|
|
651
|
-
reason: reasonCode
|
|
652
|
-
}, "POST");
|
|
653
|
-
case 2:
|
|
654
619
|
response = _context.v;
|
|
655
|
-
return _context.a(2, response);
|
|
656
|
-
case
|
|
657
|
-
_context.p =
|
|
620
|
+
return _context.a(2, new ApacuanaSuccess(response));
|
|
621
|
+
case 2:
|
|
622
|
+
_context.p = 2;
|
|
658
623
|
_t = _context.v;
|
|
659
|
-
|
|
624
|
+
if (!(_t instanceof ApacuanaAPIError)) {
|
|
625
|
+
_context.n = 3;
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
throw _t;
|
|
629
|
+
case 3:
|
|
630
|
+
throw new Error("Failed to request revocation: ".concat(_t.message));
|
|
660
631
|
case 4:
|
|
661
632
|
return _context.a(2);
|
|
662
633
|
}
|
|
663
|
-
}, _callee, null, [[
|
|
634
|
+
}, _callee, null, [[0, 2]]);
|
|
664
635
|
}));
|
|
665
|
-
return function
|
|
636
|
+
return function requestRevocationOnBoarding(_x) {
|
|
666
637
|
return _ref.apply(this, arguments);
|
|
667
638
|
};
|
|
668
639
|
}();
|
|
669
|
-
|
|
670
|
-
/**
|
|
671
|
-
* Retrieves the available reasons for certificate revocation.
|
|
672
|
-
* @returns {Promise<RevocationReasonsResponse>} An object containing the list of revocation reasons.
|
|
673
|
-
* @throws {ApacuanaAPIError} If fetching the reasons fails.
|
|
674
|
-
*/
|
|
675
|
-
var getRevocationReasons = /*#__PURE__*/function () {
|
|
640
|
+
var requestRevocationOnPremise = /*#__PURE__*/function () {
|
|
676
641
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
677
|
-
var _getConfig, integrationType, response, _t2;
|
|
678
642
|
return _regenerator().w(function (_context2) {
|
|
679
|
-
while (1) switch (_context2.
|
|
643
|
+
while (1) switch (_context2.n) {
|
|
644
|
+
case 0:
|
|
645
|
+
throw new ApacuanaAPIError("Requesting revocation is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
646
|
+
case 1:
|
|
647
|
+
return _context2.a(2);
|
|
648
|
+
}
|
|
649
|
+
}, _callee2);
|
|
650
|
+
}));
|
|
651
|
+
return function requestRevocationOnPremise() {
|
|
652
|
+
return _ref2.apply(this, arguments);
|
|
653
|
+
};
|
|
654
|
+
}();
|
|
655
|
+
var requestRevocation = /*#__PURE__*/function () {
|
|
656
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(params) {
|
|
657
|
+
var _getConfig, integrationType;
|
|
658
|
+
return _regenerator().w(function (_context3) {
|
|
659
|
+
while (1) switch (_context3.n) {
|
|
680
660
|
case 0:
|
|
661
|
+
if (!(!params || typeof params.reasonCode !== "number")) {
|
|
662
|
+
_context3.n = 1;
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
throw new Error('The "params" object with a numeric "reasonCode" property is required.');
|
|
666
|
+
case 1:
|
|
681
667
|
_getConfig = getConfig(), integrationType = _getConfig.integrationType;
|
|
668
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
669
|
+
_context3.n = 2;
|
|
670
|
+
break;
|
|
671
|
+
}
|
|
672
|
+
return _context3.a(2, requestRevocationOnBoarding(params));
|
|
673
|
+
case 2:
|
|
682
674
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
683
|
-
|
|
675
|
+
_context3.n = 3;
|
|
684
676
|
break;
|
|
685
677
|
}
|
|
686
|
-
|
|
678
|
+
return _context3.a(2, requestRevocationOnPremise(params));
|
|
679
|
+
case 3:
|
|
680
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
681
|
+
case 4:
|
|
682
|
+
return _context3.a(2);
|
|
683
|
+
}
|
|
684
|
+
}, _callee3);
|
|
685
|
+
}));
|
|
686
|
+
return function requestRevocation(_x2) {
|
|
687
|
+
return _ref3.apply(this, arguments);
|
|
688
|
+
};
|
|
689
|
+
}();
|
|
690
|
+
var getRevocationReasonsOnBoarding = /*#__PURE__*/function () {
|
|
691
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
692
|
+
var response, _t2;
|
|
693
|
+
return _regenerator().w(function (_context4) {
|
|
694
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
695
|
+
case 0:
|
|
696
|
+
_context4.p = 0;
|
|
697
|
+
_context4.n = 1;
|
|
698
|
+
return httpRequest("services/api/certificate/revocation-reasons", {}, "GET");
|
|
687
699
|
case 1:
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
case 2:
|
|
692
|
-
response = _context2.v;
|
|
693
|
-
if (response.records) {
|
|
694
|
-
_context2.n = 3;
|
|
700
|
+
response = _context4.v;
|
|
701
|
+
if (!(!response || !response.records)) {
|
|
702
|
+
_context4.n = 2;
|
|
695
703
|
break;
|
|
696
704
|
}
|
|
697
705
|
throw new ApacuanaAPIError("Failed to fetch revocation reasons.");
|
|
706
|
+
case 2:
|
|
707
|
+
return _context4.a(2, new ApacuanaSuccess(response.records));
|
|
698
708
|
case 3:
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
_context2.p = 4;
|
|
702
|
-
_t2 = _context2.v;
|
|
709
|
+
_context4.p = 3;
|
|
710
|
+
_t2 = _context4.v;
|
|
703
711
|
if (!(_t2 instanceof ApacuanaAPIError)) {
|
|
704
|
-
|
|
712
|
+
_context4.n = 4;
|
|
705
713
|
break;
|
|
706
714
|
}
|
|
707
715
|
throw _t2;
|
|
716
|
+
case 4:
|
|
717
|
+
throw new Error("Failed to get revocation reasons: ".concat(_t2.message));
|
|
708
718
|
case 5:
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
719
|
+
return _context4.a(2);
|
|
720
|
+
}
|
|
721
|
+
}, _callee4, null, [[0, 3]]);
|
|
722
|
+
}));
|
|
723
|
+
return function getRevocationReasonsOnBoarding() {
|
|
724
|
+
return _ref4.apply(this, arguments);
|
|
725
|
+
};
|
|
726
|
+
}();
|
|
727
|
+
var getRevocationReasonsOnPremise = /*#__PURE__*/function () {
|
|
728
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
729
|
+
return _regenerator().w(function (_context5) {
|
|
730
|
+
while (1) switch (_context5.n) {
|
|
731
|
+
case 0:
|
|
732
|
+
throw new ApacuanaAPIError("Getting revocation reasons is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
733
|
+
case 1:
|
|
734
|
+
return _context5.a(2);
|
|
712
735
|
}
|
|
713
|
-
},
|
|
736
|
+
}, _callee5);
|
|
737
|
+
}));
|
|
738
|
+
return function getRevocationReasonsOnPremise() {
|
|
739
|
+
return _ref5.apply(this, arguments);
|
|
740
|
+
};
|
|
741
|
+
}();
|
|
742
|
+
var getRevocationReasons = /*#__PURE__*/function () {
|
|
743
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
744
|
+
var _getConfig2, integrationType;
|
|
745
|
+
return _regenerator().w(function (_context6) {
|
|
746
|
+
while (1) switch (_context6.n) {
|
|
747
|
+
case 0:
|
|
748
|
+
_getConfig2 = getConfig(), integrationType = _getConfig2.integrationType;
|
|
749
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
750
|
+
_context6.n = 1;
|
|
751
|
+
break;
|
|
752
|
+
}
|
|
753
|
+
return _context6.a(2, getRevocationReasonsOnBoarding());
|
|
754
|
+
case 1:
|
|
755
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
756
|
+
_context6.n = 2;
|
|
757
|
+
break;
|
|
758
|
+
}
|
|
759
|
+
return _context6.a(2, getRevocationReasonsOnPremise());
|
|
760
|
+
case 2:
|
|
761
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
762
|
+
case 3:
|
|
763
|
+
return _context6.a(2);
|
|
764
|
+
}
|
|
765
|
+
}, _callee6);
|
|
714
766
|
}));
|
|
715
767
|
return function getRevocationReasons() {
|
|
716
|
-
return
|
|
768
|
+
return _ref6.apply(this, arguments);
|
|
717
769
|
};
|
|
718
770
|
}();
|
|
719
771
|
|
|
@@ -32951,24 +33003,6 @@ var helpers = {
|
|
|
32951
33003
|
validateOnBoardingSignDocumentData: validateOnBoardingSignDocumentData
|
|
32952
33004
|
};
|
|
32953
33005
|
|
|
32954
|
-
/**
|
|
32955
|
-
* @typedef {object} GenerateCertResponse
|
|
32956
|
-
* @property {string} cert - El certificado generado en formato string.
|
|
32957
|
-
* @property {string} certifiedid - El ID del certificado generado.
|
|
32958
|
-
* @property {boolean} success - Indica si la operación fue exitosa.
|
|
32959
|
-
*/
|
|
32960
|
-
|
|
32961
|
-
/**
|
|
32962
|
-
* @typedef {object} GetCertStatusResponse
|
|
32963
|
-
* @property {string} status - El estado actual del certificado del usuario.
|
|
32964
|
-
* @property {boolean} success - Indica si la operación fue exitosa.
|
|
32965
|
-
*/
|
|
32966
|
-
|
|
32967
|
-
/**
|
|
32968
|
-
* @typedef {object} EncryptedCSRObject
|
|
32969
|
-
* @property {string} csr - The encrypted Certificate Signing Request.
|
|
32970
|
-
*/
|
|
32971
|
-
|
|
32972
33006
|
/**
|
|
32973
33007
|
* @param {EncryptedCSRObject} encryptedCSR
|
|
32974
33008
|
*/
|
|
@@ -32990,11 +33024,10 @@ var generateCertOnBoarding = /*#__PURE__*/function () {
|
|
|
32990
33024
|
}
|
|
32991
33025
|
throw new ApacuanaAPIError("The API response does not contain the certificate.", response.status, "INVALID_API_RESPONSE");
|
|
32992
33026
|
case 2:
|
|
32993
|
-
return _context.a(2, {
|
|
33027
|
+
return _context.a(2, new ApacuanaSuccess({
|
|
32994
33028
|
cert: cert,
|
|
32995
|
-
certifiedid: certifiedid
|
|
32996
|
-
|
|
32997
|
-
});
|
|
33029
|
+
certifiedid: certifiedid
|
|
33030
|
+
}));
|
|
32998
33031
|
case 3:
|
|
32999
33032
|
_context.p = 3;
|
|
33000
33033
|
_t = _context.v;
|
|
@@ -33077,75 +33110,283 @@ var getCertStatus = function getCertStatus() {
|
|
|
33077
33110
|
var isCertificateInDevice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
33078
33111
|
var config = getConfig();
|
|
33079
33112
|
var status = helpers.getCertificateStatus(config.userData, isCertificateInDevice);
|
|
33080
|
-
return {
|
|
33081
|
-
status: status
|
|
33082
|
-
|
|
33083
|
-
};
|
|
33113
|
+
return new ApacuanaSuccess({
|
|
33114
|
+
status: status
|
|
33115
|
+
});
|
|
33084
33116
|
};
|
|
33085
|
-
|
|
33086
|
-
|
|
33087
|
-
|
|
33088
|
-
|
|
33089
|
-
|
|
33090
|
-
|
|
33091
|
-
|
|
33092
|
-
|
|
33093
|
-
|
|
33094
|
-
|
|
33095
|
-
|
|
33096
|
-
|
|
33097
|
-
|
|
33098
|
-
|
|
33099
|
-
|
|
33100
|
-
|
|
33101
|
-
|
|
33102
|
-
|
|
33103
|
-
|
|
33104
|
-
|
|
33105
|
-
|
|
33106
|
-
|
|
33107
|
-
|
|
33108
|
-
|
|
33109
|
-
|
|
33110
|
-
|
|
33111
|
-
|
|
33112
|
-
|
|
33113
|
-
|
|
33114
|
-
|
|
33115
|
-
|
|
33116
|
-
*/
|
|
33117
|
+
var getCertTypesOnBoarding = /*#__PURE__*/function () {
|
|
33118
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
33119
|
+
var response, _t2;
|
|
33120
|
+
return _regenerator().w(function (_context4) {
|
|
33121
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
33122
|
+
case 0:
|
|
33123
|
+
_context4.p = 0;
|
|
33124
|
+
_context4.n = 1;
|
|
33125
|
+
return httpRequest("services/api/customer/typeusers", {}, "GET");
|
|
33126
|
+
case 1:
|
|
33127
|
+
response = _context4.v;
|
|
33128
|
+
return _context4.a(2, new ApacuanaSuccess(response));
|
|
33129
|
+
case 2:
|
|
33130
|
+
_context4.p = 2;
|
|
33131
|
+
_t2 = _context4.v;
|
|
33132
|
+
if (!(_t2 instanceof ApacuanaAPIError)) {
|
|
33133
|
+
_context4.n = 3;
|
|
33134
|
+
break;
|
|
33135
|
+
}
|
|
33136
|
+
throw _t2;
|
|
33137
|
+
case 3:
|
|
33138
|
+
throw new Error("Failed to get certificate types: ".concat(_t2.message));
|
|
33139
|
+
case 4:
|
|
33140
|
+
return _context4.a(2);
|
|
33141
|
+
}
|
|
33142
|
+
}, _callee4, null, [[0, 2]]);
|
|
33143
|
+
}));
|
|
33144
|
+
return function getCertTypesOnBoarding() {
|
|
33145
|
+
return _ref4.apply(this, arguments);
|
|
33146
|
+
};
|
|
33147
|
+
}();
|
|
33148
|
+
var getCertTypesOnPremise = /*#__PURE__*/function () {
|
|
33149
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
33150
|
+
return _regenerator().w(function (_context5) {
|
|
33151
|
+
while (1) switch (_context5.n) {
|
|
33152
|
+
case 0:
|
|
33153
|
+
throw new ApacuanaAPIError("Getting certificate types is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
33154
|
+
case 1:
|
|
33155
|
+
return _context5.a(2);
|
|
33156
|
+
}
|
|
33157
|
+
}, _callee5);
|
|
33158
|
+
}));
|
|
33159
|
+
return function getCertTypesOnPremise() {
|
|
33160
|
+
return _ref5.apply(this, arguments);
|
|
33161
|
+
};
|
|
33162
|
+
}();
|
|
33117
33163
|
|
|
33118
33164
|
/**
|
|
33119
|
-
*
|
|
33120
|
-
* @
|
|
33121
|
-
* @
|
|
33122
|
-
* @
|
|
33165
|
+
* Gets the available certificate types.
|
|
33166
|
+
* @returns {Promise<GetCertTypesResponse>} Object with the list of certificate types and a success indicator.
|
|
33167
|
+
* @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
|
|
33168
|
+
* @throws {Error} If the request fails for another reason.
|
|
33123
33169
|
*/
|
|
33170
|
+
var getCertTypes = /*#__PURE__*/function () {
|
|
33171
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
33172
|
+
var _getConfig2, integrationType;
|
|
33173
|
+
return _regenerator().w(function (_context6) {
|
|
33174
|
+
while (1) switch (_context6.n) {
|
|
33175
|
+
case 0:
|
|
33176
|
+
_getConfig2 = getConfig(), integrationType = _getConfig2.integrationType;
|
|
33177
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
33178
|
+
_context6.n = 1;
|
|
33179
|
+
break;
|
|
33180
|
+
}
|
|
33181
|
+
return _context6.a(2, getCertTypesOnBoarding());
|
|
33182
|
+
case 1:
|
|
33183
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
33184
|
+
_context6.n = 2;
|
|
33185
|
+
break;
|
|
33186
|
+
}
|
|
33187
|
+
return _context6.a(2, getCertTypesOnPremise());
|
|
33188
|
+
case 2:
|
|
33189
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
33190
|
+
case 3:
|
|
33191
|
+
return _context6.a(2);
|
|
33192
|
+
}
|
|
33193
|
+
}, _callee6);
|
|
33194
|
+
}));
|
|
33195
|
+
return function getCertTypes() {
|
|
33196
|
+
return _ref6.apply(this, arguments);
|
|
33197
|
+
};
|
|
33198
|
+
}();
|
|
33199
|
+
var getRequerimentsByTypeUserOnBoarding = /*#__PURE__*/function () {
|
|
33200
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(type) {
|
|
33201
|
+
var response, _t3;
|
|
33202
|
+
return _regenerator().w(function (_context7) {
|
|
33203
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
33204
|
+
case 0:
|
|
33205
|
+
_context7.p = 0;
|
|
33206
|
+
_context7.n = 1;
|
|
33207
|
+
return httpRequest("services/api/customer/documentspref?typeuser=".concat(type), {}, "GET");
|
|
33208
|
+
case 1:
|
|
33209
|
+
response = _context7.v;
|
|
33210
|
+
return _context7.a(2, new ApacuanaSuccess(response));
|
|
33211
|
+
case 2:
|
|
33212
|
+
_context7.p = 2;
|
|
33213
|
+
_t3 = _context7.v;
|
|
33214
|
+
if (!(_t3 instanceof ApacuanaAPIError)) {
|
|
33215
|
+
_context7.n = 3;
|
|
33216
|
+
break;
|
|
33217
|
+
}
|
|
33218
|
+
throw _t3;
|
|
33219
|
+
case 3:
|
|
33220
|
+
throw new Error("Failed to get requirements: ".concat(_t3.message));
|
|
33221
|
+
case 4:
|
|
33222
|
+
return _context7.a(2);
|
|
33223
|
+
}
|
|
33224
|
+
}, _callee7, null, [[0, 2]]);
|
|
33225
|
+
}));
|
|
33226
|
+
return function getRequerimentsByTypeUserOnBoarding(_x3) {
|
|
33227
|
+
return _ref7.apply(this, arguments);
|
|
33228
|
+
};
|
|
33229
|
+
}();
|
|
33230
|
+
var getRequerimentsByTypeUserOnPremise = /*#__PURE__*/function () {
|
|
33231
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
33232
|
+
return _regenerator().w(function (_context8) {
|
|
33233
|
+
while (1) switch (_context8.n) {
|
|
33234
|
+
case 0:
|
|
33235
|
+
throw new ApacuanaAPIError("Getting requirements by user type is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
33236
|
+
case 1:
|
|
33237
|
+
return _context8.a(2);
|
|
33238
|
+
}
|
|
33239
|
+
}, _callee8);
|
|
33240
|
+
}));
|
|
33241
|
+
return function getRequerimentsByTypeUserOnPremise() {
|
|
33242
|
+
return _ref8.apply(this, arguments);
|
|
33243
|
+
};
|
|
33244
|
+
}();
|
|
33124
33245
|
|
|
33125
33246
|
/**
|
|
33126
|
-
*
|
|
33127
|
-
* @
|
|
33128
|
-
* @
|
|
33129
|
-
* @
|
|
33130
|
-
* @
|
|
33247
|
+
* Gets the requirements for a given user type.
|
|
33248
|
+
* @param {object} params - The parameters.
|
|
33249
|
+
* @param {number} params.type - The user type to get requirements for.
|
|
33250
|
+
* @returns {Promise<GetRequirementsResponse>} Object with the list of requirements and a success indicator.
|
|
33251
|
+
* @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
|
|
33252
|
+
* @throws {Error} If the request fails for another reason or the type is invalid.
|
|
33131
33253
|
*/
|
|
33254
|
+
var getRequerimentsByTypeUser = /*#__PURE__*/function () {
|
|
33255
|
+
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(params) {
|
|
33256
|
+
var type, _getConfig3, integrationType;
|
|
33257
|
+
return _regenerator().w(function (_context9) {
|
|
33258
|
+
while (1) switch (_context9.n) {
|
|
33259
|
+
case 0:
|
|
33260
|
+
if (!(!params || typeof params.type !== "number")) {
|
|
33261
|
+
_context9.n = 1;
|
|
33262
|
+
break;
|
|
33263
|
+
}
|
|
33264
|
+
throw new Error('The "params" object with a numeric "type" property is required.');
|
|
33265
|
+
case 1:
|
|
33266
|
+
type = params.type;
|
|
33267
|
+
_getConfig3 = getConfig(), integrationType = _getConfig3.integrationType;
|
|
33268
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
33269
|
+
_context9.n = 2;
|
|
33270
|
+
break;
|
|
33271
|
+
}
|
|
33272
|
+
return _context9.a(2, getRequerimentsByTypeUserOnBoarding(type));
|
|
33273
|
+
case 2:
|
|
33274
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
33275
|
+
_context9.n = 3;
|
|
33276
|
+
break;
|
|
33277
|
+
}
|
|
33278
|
+
return _context9.a(2, getRequerimentsByTypeUserOnPremise());
|
|
33279
|
+
case 3:
|
|
33280
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
33281
|
+
case 4:
|
|
33282
|
+
return _context9.a(2);
|
|
33283
|
+
}
|
|
33284
|
+
}, _callee9);
|
|
33285
|
+
}));
|
|
33286
|
+
return function getRequerimentsByTypeUser(_x4) {
|
|
33287
|
+
return _ref9.apply(this, arguments);
|
|
33288
|
+
};
|
|
33289
|
+
}();
|
|
33290
|
+
var requestCertificateOnBoarding = /*#__PURE__*/function () {
|
|
33291
|
+
var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(params) {
|
|
33292
|
+
var response, _t4;
|
|
33293
|
+
return _regenerator().w(function (_context0) {
|
|
33294
|
+
while (1) switch (_context0.p = _context0.n) {
|
|
33295
|
+
case 0:
|
|
33296
|
+
_context0.p = 0;
|
|
33297
|
+
_context0.n = 1;
|
|
33298
|
+
return httpRequest("services/api/customer/request-certificate", params, "POST");
|
|
33299
|
+
case 1:
|
|
33300
|
+
response = _context0.v;
|
|
33301
|
+
return _context0.a(2, new ApacuanaSuccess(response));
|
|
33302
|
+
case 2:
|
|
33303
|
+
_context0.p = 2;
|
|
33304
|
+
_t4 = _context0.v;
|
|
33305
|
+
if (!(_t4 instanceof ApacuanaAPIError)) {
|
|
33306
|
+
_context0.n = 3;
|
|
33307
|
+
break;
|
|
33308
|
+
}
|
|
33309
|
+
throw _t4;
|
|
33310
|
+
case 3:
|
|
33311
|
+
throw new Error("Failed to request certificate: ".concat(_t4.message));
|
|
33312
|
+
case 4:
|
|
33313
|
+
return _context0.a(2);
|
|
33314
|
+
}
|
|
33315
|
+
}, _callee0, null, [[0, 2]]);
|
|
33316
|
+
}));
|
|
33317
|
+
return function requestCertificateOnBoarding(_x5) {
|
|
33318
|
+
return _ref0.apply(this, arguments);
|
|
33319
|
+
};
|
|
33320
|
+
}();
|
|
33321
|
+
var requestCertificateOnPremise = /*#__PURE__*/function () {
|
|
33322
|
+
var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
33323
|
+
return _regenerator().w(function (_context1) {
|
|
33324
|
+
while (1) switch (_context1.n) {
|
|
33325
|
+
case 0:
|
|
33326
|
+
throw new ApacuanaAPIError("Requesting a certificate is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
33327
|
+
case 1:
|
|
33328
|
+
return _context1.a(2);
|
|
33329
|
+
}
|
|
33330
|
+
}, _callee1);
|
|
33331
|
+
}));
|
|
33332
|
+
return function requestCertificateOnPremise() {
|
|
33333
|
+
return _ref1.apply(this, arguments);
|
|
33334
|
+
};
|
|
33335
|
+
}();
|
|
33132
33336
|
|
|
33133
33337
|
/**
|
|
33134
|
-
*
|
|
33135
|
-
* @
|
|
33136
|
-
* @
|
|
33137
|
-
* @
|
|
33138
|
-
* @
|
|
33338
|
+
* Requests a certificate for the user.
|
|
33339
|
+
* @param {CertificateRequestParams} params - The parameters for the certificate request.
|
|
33340
|
+
* @returns {Promise<RequestCertificateResponse>} Object with a confirmation message and a success indicator.
|
|
33341
|
+
* @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
|
|
33342
|
+
* @throws {Error} If the request fails for another reason or the params are invalid.
|
|
33139
33343
|
*/
|
|
33344
|
+
var requestCertificate = /*#__PURE__*/function () {
|
|
33345
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(params) {
|
|
33346
|
+
var _getConfig4, integrationType;
|
|
33347
|
+
return _regenerator().w(function (_context10) {
|
|
33348
|
+
while (1) switch (_context10.n) {
|
|
33349
|
+
case 0:
|
|
33350
|
+
if (!(!params || typeof params.type !== "number" || !Array.isArray(params.documents))) {
|
|
33351
|
+
_context10.n = 1;
|
|
33352
|
+
break;
|
|
33353
|
+
}
|
|
33354
|
+
throw new Error('The "params" object with a numeric "type" property and a "documents" array is required.');
|
|
33355
|
+
case 1:
|
|
33356
|
+
_getConfig4 = getConfig(), integrationType = _getConfig4.integrationType;
|
|
33357
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
33358
|
+
_context10.n = 2;
|
|
33359
|
+
break;
|
|
33360
|
+
}
|
|
33361
|
+
return _context10.a(2, requestCertificateOnBoarding(params));
|
|
33362
|
+
case 2:
|
|
33363
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
33364
|
+
_context10.n = 3;
|
|
33365
|
+
break;
|
|
33366
|
+
}
|
|
33367
|
+
return _context10.a(2, requestCertificateOnPremise());
|
|
33368
|
+
case 3:
|
|
33369
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
33370
|
+
case 4:
|
|
33371
|
+
return _context10.a(2);
|
|
33372
|
+
}
|
|
33373
|
+
}, _callee10);
|
|
33374
|
+
}));
|
|
33375
|
+
return function requestCertificate(_x6) {
|
|
33376
|
+
return _ref10.apply(this, arguments);
|
|
33377
|
+
};
|
|
33378
|
+
}();
|
|
33140
33379
|
|
|
33141
|
-
/**
|
|
33142
|
-
|
|
33143
|
-
|
|
33144
|
-
|
|
33145
|
-
|
|
33146
|
-
|
|
33147
|
-
|
|
33148
|
-
*/
|
|
33380
|
+
/** @typedef {import("../types/signatures").Signer} Signer */
|
|
33381
|
+
/** @typedef {import("../types/signatures").SignerData} SignerData */
|
|
33382
|
+
/** @typedef {import("../types/signatures").AddSignerResponse} AddSignerResponse */
|
|
33383
|
+
/** @typedef {import("../types/signatures").GetDigestData} GetDigestData */
|
|
33384
|
+
/** @typedef {import("../types/signatures").GetDigestResponse} GetDigestResponse */
|
|
33385
|
+
/** @typedef {import("../types/signatures").GetDocsParams} GetDocsParams */
|
|
33386
|
+
/** @typedef {import("../types/signatures").GetDocsResponse} GetDocsResponse */
|
|
33387
|
+
/** @typedef {import("../types/signatures").SignDocumentData} SignDocumentData */
|
|
33388
|
+
/** @typedef {import("../types/signatures").SignaturePosition} SignaturePosition */
|
|
33389
|
+
/** @typedef {import("../types/signatures").OnboardingSignerData} OnboardingSignerData */
|
|
33149
33390
|
|
|
33150
33391
|
// =================================================================
|
|
33151
33392
|
// Internal Functions
|
|
@@ -33176,7 +33417,7 @@ var signDocumentOnBoarding = /*#__PURE__*/function () {
|
|
|
33176
33417
|
return httpRequest("services/api/documents/sign/".concat(signature.id), signBody, "PUT");
|
|
33177
33418
|
case 2:
|
|
33178
33419
|
response = _context.v;
|
|
33179
|
-
return _context.a(2, response);
|
|
33420
|
+
return _context.a(2, new ApacuanaSuccess(response));
|
|
33180
33421
|
case 3:
|
|
33181
33422
|
_context.p = 3;
|
|
33182
33423
|
_t = _context.v;
|
|
@@ -33231,10 +33472,9 @@ var getDigestToSignOnBoarding = /*#__PURE__*/function () {
|
|
|
33231
33472
|
}
|
|
33232
33473
|
throw new ApacuanaAPIError("Signature generation failed: digest not found in the response.", 500, "API_RESPONSE_ERROR");
|
|
33233
33474
|
case 2:
|
|
33234
|
-
return _context3.a(2, {
|
|
33235
|
-
digest: digest
|
|
33236
|
-
|
|
33237
|
-
});
|
|
33475
|
+
return _context3.a(2, new ApacuanaSuccess({
|
|
33476
|
+
digest: digest
|
|
33477
|
+
}));
|
|
33238
33478
|
case 3:
|
|
33239
33479
|
_context3.p = 3;
|
|
33240
33480
|
_t2 = _context3.v;
|
|
@@ -33280,10 +33520,9 @@ var addSignerOnBoarding = /*#__PURE__*/function () {
|
|
|
33280
33520
|
_context5.n = 2;
|
|
33281
33521
|
return httpRequest("services/api/documents/signing", signerData, "POST");
|
|
33282
33522
|
case 2:
|
|
33283
|
-
return _context5.a(2, {
|
|
33284
|
-
signer: signerData.typedoc + signerData.doc
|
|
33285
|
-
|
|
33286
|
-
});
|
|
33523
|
+
return _context5.a(2, new ApacuanaSuccess({
|
|
33524
|
+
signer: signerData.typedoc + signerData.doc
|
|
33525
|
+
}));
|
|
33287
33526
|
case 3:
|
|
33288
33527
|
_context5.p = 3;
|
|
33289
33528
|
_t3 = _context5.v;
|
|
@@ -33360,11 +33599,10 @@ var getDocsOnBoarding = /*#__PURE__*/function () {
|
|
|
33360
33599
|
return httpRequest(apiUrl, {}, "GET");
|
|
33361
33600
|
case 2:
|
|
33362
33601
|
response = _context8.v;
|
|
33363
|
-
return _context8.a(2, {
|
|
33602
|
+
return _context8.a(2, new ApacuanaSuccess({
|
|
33364
33603
|
totalRecords: response.numofrecords,
|
|
33365
|
-
records: response.records
|
|
33366
|
-
|
|
33367
|
-
});
|
|
33604
|
+
records: response.records
|
|
33605
|
+
}));
|
|
33368
33606
|
case 3:
|
|
33369
33607
|
_context8.p = 3;
|
|
33370
33608
|
_t4 = _context8.v;
|
|
@@ -33398,9 +33636,7 @@ var uploadSignatureVariantOnBoarding = /*#__PURE__*/function () {
|
|
|
33398
33636
|
}, "POST");
|
|
33399
33637
|
case 2:
|
|
33400
33638
|
response = _context9.v;
|
|
33401
|
-
return _context9.a(2,
|
|
33402
|
-
success: true
|
|
33403
|
-
}));
|
|
33639
|
+
return _context9.a(2, new ApacuanaSuccess(response));
|
|
33404
33640
|
case 3:
|
|
33405
33641
|
_context9.p = 3;
|
|
33406
33642
|
_t5 = _context9.v;
|
|
@@ -33447,9 +33683,7 @@ var getSignatureVariantOnBoarding = /*#__PURE__*/function () {
|
|
|
33447
33683
|
return httpRequest("services/api/customer/getsignaturephotosdk/".concat(customerId), {}, "GET");
|
|
33448
33684
|
case 2:
|
|
33449
33685
|
response = _context1.v;
|
|
33450
|
-
return _context1.a(2,
|
|
33451
|
-
success: true
|
|
33452
|
-
}));
|
|
33686
|
+
return _context1.a(2, new ApacuanaSuccess(response));
|
|
33453
33687
|
case 3:
|
|
33454
33688
|
_context1.p = 3;
|
|
33455
33689
|
_t6 = _context1.v;
|
|
@@ -33495,9 +33729,7 @@ var deleteSignatureVariantOnBoarding = /*#__PURE__*/function () {
|
|
|
33495
33729
|
return httpRequest("services/api/customer/cleansignaturephoto", {}, "DELETE");
|
|
33496
33730
|
case 1:
|
|
33497
33731
|
response = _context11.v;
|
|
33498
|
-
return _context11.a(2,
|
|
33499
|
-
success: true
|
|
33500
|
-
}));
|
|
33732
|
+
return _context11.a(2, new ApacuanaSuccess(response));
|
|
33501
33733
|
case 2:
|
|
33502
33734
|
_context11.p = 2;
|
|
33503
33735
|
_t7 = _context11.v;
|
|
@@ -33617,31 +33849,6 @@ var getDigest = /*#__PURE__*/function () {
|
|
|
33617
33849
|
* @returns {Promise<AddSignerResponse>} Una promesa que resuelve a un objeto con el resultado de la operación.
|
|
33618
33850
|
* @throws {ApacuanaAPIError} Si los datos del firmante son inválidos, la llamada a la API falla, o el tipo de integración no es soportado.
|
|
33619
33851
|
*/
|
|
33620
|
-
/**
|
|
33621
|
-
* @typedef {object} SignaturePosition
|
|
33622
|
-
* @property {number} page - The page number for the signature.
|
|
33623
|
-
* @property {number} x - The x-coordinate for the signature's position (from 0 to 1).
|
|
33624
|
-
* @property {number} y - The y-coordinate for the signature's position (from 0 to 1).
|
|
33625
|
-
*/
|
|
33626
|
-
|
|
33627
|
-
/**
|
|
33628
|
-
* @typedef {object} OnboardingSignerData
|
|
33629
|
-
* @property {string} name - The name of the document.
|
|
33630
|
-
* @property {string} reference - An external reference for the document.
|
|
33631
|
-
* @property {string} typedoc - The type of document of the signer (e.g., "V", "E", "J").
|
|
33632
|
-
* @property {string} doc - The document number of the signer.
|
|
33633
|
-
* @property {SignaturePosition[]} signature - An array of signature positions.
|
|
33634
|
-
*/
|
|
33635
|
-
|
|
33636
|
-
/**
|
|
33637
|
-
* Adds a new signer to the signature process.
|
|
33638
|
-
* This function acts as a dispatcher, delegating to the appropriate implementation
|
|
33639
|
-
* based on the configured integration type.
|
|
33640
|
-
*
|
|
33641
|
-
* @param {OnboardingSignerData | object} signerData - The signer's data. The structure depends on the integration type.
|
|
33642
|
-
* @returns {Promise<object>} The result from the API.
|
|
33643
|
-
* @throws {ApacuanaAPIError} If signerData is invalid or if the integration type is not supported.
|
|
33644
|
-
*/
|
|
33645
33852
|
var addSigner = /*#__PURE__*/function () {
|
|
33646
33853
|
var _ref16 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(signerData) {
|
|
33647
33854
|
var _getConfig5, integrationType;
|
|
@@ -33840,6 +34047,210 @@ var deleteSignatureVariant = /*#__PURE__*/function () {
|
|
|
33840
34047
|
};
|
|
33841
34048
|
}();
|
|
33842
34049
|
|
|
34050
|
+
var createFaceLivenessSessionOnBoarding = /*#__PURE__*/function () {
|
|
34051
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
34052
|
+
var response, _t;
|
|
34053
|
+
return _regenerator().w(function (_context) {
|
|
34054
|
+
while (1) switch (_context.p = _context.n) {
|
|
34055
|
+
case 0:
|
|
34056
|
+
_context.p = 0;
|
|
34057
|
+
_context.n = 1;
|
|
34058
|
+
return httpRequest("services/api/faceliveness/create", {}, "POST");
|
|
34059
|
+
case 1:
|
|
34060
|
+
response = _context.v;
|
|
34061
|
+
if (response.sessionId) {
|
|
34062
|
+
_context.n = 2;
|
|
34063
|
+
break;
|
|
34064
|
+
}
|
|
34065
|
+
throw new ApacuanaAPIError("The API response does not contain the session ID.", response.status, "INVALID_API_RESPONSE");
|
|
34066
|
+
case 2:
|
|
34067
|
+
return _context.a(2, new ApacuanaSuccess({
|
|
34068
|
+
sessionId: response.sessionId
|
|
34069
|
+
}));
|
|
34070
|
+
case 3:
|
|
34071
|
+
_context.p = 3;
|
|
34072
|
+
_t = _context.v;
|
|
34073
|
+
if (!(_t instanceof ApacuanaAPIError)) {
|
|
34074
|
+
_context.n = 4;
|
|
34075
|
+
break;
|
|
34076
|
+
}
|
|
34077
|
+
throw _t;
|
|
34078
|
+
case 4:
|
|
34079
|
+
throw new Error("Failed to create Face Liveness session: ".concat(_t.message));
|
|
34080
|
+
case 5:
|
|
34081
|
+
return _context.a(2);
|
|
34082
|
+
}
|
|
34083
|
+
}, _callee, null, [[0, 3]]);
|
|
34084
|
+
}));
|
|
34085
|
+
return function createFaceLivenessSessionOnBoarding() {
|
|
34086
|
+
return _ref.apply(this, arguments);
|
|
34087
|
+
};
|
|
34088
|
+
}();
|
|
34089
|
+
var createFaceLivenessSessionOnPremise = /*#__PURE__*/function () {
|
|
34090
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
34091
|
+
return _regenerator().w(function (_context2) {
|
|
34092
|
+
while (1) switch (_context2.n) {
|
|
34093
|
+
case 0:
|
|
34094
|
+
throw new ApacuanaAPIError("Creating a Face Liveness session is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
34095
|
+
case 1:
|
|
34096
|
+
return _context2.a(2);
|
|
34097
|
+
}
|
|
34098
|
+
}, _callee2);
|
|
34099
|
+
}));
|
|
34100
|
+
return function createFaceLivenessSessionOnPremise() {
|
|
34101
|
+
return _ref2.apply(this, arguments);
|
|
34102
|
+
};
|
|
34103
|
+
}();
|
|
34104
|
+
var validateFaceLivenessOnBoarding = /*#__PURE__*/function () {
|
|
34105
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(sessionId) {
|
|
34106
|
+
var response, status, _t2, _t3;
|
|
34107
|
+
return _regenerator().w(function (_context3) {
|
|
34108
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
34109
|
+
case 0:
|
|
34110
|
+
_context3.p = 0;
|
|
34111
|
+
_context3.n = 1;
|
|
34112
|
+
return httpRequest("services/api/faceliveness/validate", {
|
|
34113
|
+
sessionid: sessionId
|
|
34114
|
+
}, "POST");
|
|
34115
|
+
case 1:
|
|
34116
|
+
response = _context3.v;
|
|
34117
|
+
return _context3.a(2, new ApacuanaSuccess(_objectSpread2({
|
|
34118
|
+
status: "verified"
|
|
34119
|
+
}, response)));
|
|
34120
|
+
case 2:
|
|
34121
|
+
_context3.p = 2;
|
|
34122
|
+
_t2 = _context3.v;
|
|
34123
|
+
if (!(_t2 instanceof ApacuanaAPIError)) {
|
|
34124
|
+
_context3.n = 9;
|
|
34125
|
+
break;
|
|
34126
|
+
}
|
|
34127
|
+
_t3 = _t2.statusCode;
|
|
34128
|
+
_context3.n = _t3 === 402 ? 3 : _t3 === 403 ? 4 : _t3 === 406 ? 5 : _t3 === 408 ? 6 : 7;
|
|
34129
|
+
break;
|
|
34130
|
+
case 3:
|
|
34131
|
+
status = "waitingForScan";
|
|
34132
|
+
return _context3.a(3, 8);
|
|
34133
|
+
case 4:
|
|
34134
|
+
status = "rejected";
|
|
34135
|
+
return _context3.a(3, 8);
|
|
34136
|
+
case 5:
|
|
34137
|
+
status = "processing";
|
|
34138
|
+
return _context3.a(3, 8);
|
|
34139
|
+
case 6:
|
|
34140
|
+
status = "expired";
|
|
34141
|
+
return _context3.a(3, 8);
|
|
34142
|
+
case 7:
|
|
34143
|
+
throw _t2;
|
|
34144
|
+
case 8:
|
|
34145
|
+
return _context3.a(2, new ApacuanaSuccess({
|
|
34146
|
+
status: status
|
|
34147
|
+
}));
|
|
34148
|
+
case 9:
|
|
34149
|
+
throw _t2;
|
|
34150
|
+
case 10:
|
|
34151
|
+
return _context3.a(2);
|
|
34152
|
+
}
|
|
34153
|
+
}, _callee3, null, [[0, 2]]);
|
|
34154
|
+
}));
|
|
34155
|
+
return function validateFaceLivenessOnBoarding(_x) {
|
|
34156
|
+
return _ref3.apply(this, arguments);
|
|
34157
|
+
};
|
|
34158
|
+
}();
|
|
34159
|
+
var validateFaceLivenessOnPremise = /*#__PURE__*/function () {
|
|
34160
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
34161
|
+
return _regenerator().w(function (_context4) {
|
|
34162
|
+
while (1) switch (_context4.n) {
|
|
34163
|
+
case 0:
|
|
34164
|
+
throw new ApacuanaAPIError("Validating a Face Liveness session is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
34165
|
+
case 1:
|
|
34166
|
+
return _context4.a(2);
|
|
34167
|
+
}
|
|
34168
|
+
}, _callee4);
|
|
34169
|
+
}));
|
|
34170
|
+
return function validateFaceLivenessOnPremise() {
|
|
34171
|
+
return _ref4.apply(this, arguments);
|
|
34172
|
+
};
|
|
34173
|
+
}();
|
|
34174
|
+
|
|
34175
|
+
/**
|
|
34176
|
+
* Creates a new Face Liveness session.
|
|
34177
|
+
* @returns {Promise<CreateFaceLivenessSessionResponse>} Object with the session ID and a success indicator.
|
|
34178
|
+
* @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
|
|
34179
|
+
* @throws {Error} If the request fails for another reason.
|
|
34180
|
+
*/
|
|
34181
|
+
var createFaceLivenessSession = /*#__PURE__*/function () {
|
|
34182
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
34183
|
+
var _getConfig, integrationType;
|
|
34184
|
+
return _regenerator().w(function (_context5) {
|
|
34185
|
+
while (1) switch (_context5.n) {
|
|
34186
|
+
case 0:
|
|
34187
|
+
_getConfig = getConfig(), integrationType = _getConfig.integrationType;
|
|
34188
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34189
|
+
_context5.n = 1;
|
|
34190
|
+
break;
|
|
34191
|
+
}
|
|
34192
|
+
return _context5.a(2, createFaceLivenessSessionOnBoarding());
|
|
34193
|
+
case 1:
|
|
34194
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34195
|
+
_context5.n = 2;
|
|
34196
|
+
break;
|
|
34197
|
+
}
|
|
34198
|
+
return _context5.a(2, createFaceLivenessSessionOnPremise());
|
|
34199
|
+
case 2:
|
|
34200
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34201
|
+
case 3:
|
|
34202
|
+
return _context5.a(2);
|
|
34203
|
+
}
|
|
34204
|
+
}, _callee5);
|
|
34205
|
+
}));
|
|
34206
|
+
return function createFaceLivenessSession() {
|
|
34207
|
+
return _ref5.apply(this, arguments);
|
|
34208
|
+
};
|
|
34209
|
+
}();
|
|
34210
|
+
|
|
34211
|
+
/**
|
|
34212
|
+
* Validates a Face Liveness session and returns its status.
|
|
34213
|
+
* @param {{sessionId: string}} params - Object containing the session ID.
|
|
34214
|
+
* @returns {Promise<ApacuanaSuccess>} Object with the validation status.
|
|
34215
|
+
* @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
|
|
34216
|
+
*/
|
|
34217
|
+
var validateFaceLiveness = /*#__PURE__*/function () {
|
|
34218
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(_ref6) {
|
|
34219
|
+
var sessionId, _getConfig2, integrationType;
|
|
34220
|
+
return _regenerator().w(function (_context6) {
|
|
34221
|
+
while (1) switch (_context6.n) {
|
|
34222
|
+
case 0:
|
|
34223
|
+
sessionId = _ref6.sessionId;
|
|
34224
|
+
if (sessionId) {
|
|
34225
|
+
_context6.n = 1;
|
|
34226
|
+
break;
|
|
34227
|
+
}
|
|
34228
|
+
throw new ApacuanaAPIError("sessionId is a required parameter.", 400, "INVALID_PARAMETER");
|
|
34229
|
+
case 1:
|
|
34230
|
+
_getConfig2 = getConfig(), integrationType = _getConfig2.integrationType;
|
|
34231
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34232
|
+
_context6.n = 2;
|
|
34233
|
+
break;
|
|
34234
|
+
}
|
|
34235
|
+
return _context6.a(2, validateFaceLivenessOnBoarding(sessionId));
|
|
34236
|
+
case 2:
|
|
34237
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34238
|
+
_context6.n = 3;
|
|
34239
|
+
break;
|
|
34240
|
+
}
|
|
34241
|
+
return _context6.a(2, validateFaceLivenessOnPremise());
|
|
34242
|
+
case 3:
|
|
34243
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34244
|
+
case 4:
|
|
34245
|
+
return _context6.a(2);
|
|
34246
|
+
}
|
|
34247
|
+
}, _callee6);
|
|
34248
|
+
}));
|
|
34249
|
+
return function validateFaceLiveness(_x2) {
|
|
34250
|
+
return _ref7.apply(this, arguments);
|
|
34251
|
+
};
|
|
34252
|
+
}();
|
|
34253
|
+
|
|
33843
34254
|
var apacuana = {
|
|
33844
34255
|
/**
|
|
33845
34256
|
* Inicializa el Apacuana SDK con la configuración necesaria y obtiene
|
|
@@ -33912,7 +34323,12 @@ var apacuana = {
|
|
|
33912
34323
|
getRevocationReasons: getRevocationReasons,
|
|
33913
34324
|
uploadSignatureVariant: uploadSignatureVariant,
|
|
33914
34325
|
getSignatureVariant: getSignatureVariant,
|
|
33915
|
-
deleteSignatureVariant: deleteSignatureVariant
|
|
34326
|
+
deleteSignatureVariant: deleteSignatureVariant,
|
|
34327
|
+
getCertTypes: getCertTypes,
|
|
34328
|
+
getRequerimentsByTypeUser: getRequerimentsByTypeUser,
|
|
34329
|
+
createFaceLivenessSession: createFaceLivenessSession,
|
|
34330
|
+
validateFaceLiveness: validateFaceLiveness,
|
|
34331
|
+
requestCertificate: requestCertificate
|
|
33916
34332
|
};
|
|
33917
34333
|
|
|
33918
34334
|
export { apacuana as default };
|