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