apacuana-sdk-core 1.9.0 → 1.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.
Files changed (37) hide show
  1. package/coverage/clover.xml +186 -185
  2. package/coverage/coverage-final.json +4 -4
  3. package/coverage/lcov-report/index.html +10 -10
  4. package/coverage/lcov-report/src/api/certs.js.html +190 -7
  5. package/coverage/lcov-report/src/api/faceLiveness.js.html +1 -1
  6. package/coverage/lcov-report/src/api/index.html +10 -10
  7. package/coverage/lcov-report/src/api/revocations.js.html +1 -1
  8. package/coverage/lcov-report/src/api/signatures.js.html +18 -3
  9. package/coverage/lcov-report/src/api/users.js.html +1 -1
  10. package/coverage/lcov-report/src/config/index.html +1 -1
  11. package/coverage/lcov-report/src/config/index.js.html +1 -1
  12. package/coverage/lcov-report/src/errors/index.html +1 -1
  13. package/coverage/lcov-report/src/errors/index.js.html +1 -1
  14. package/coverage/lcov-report/src/index.html +1 -1
  15. package/coverage/lcov-report/src/index.js.html +14 -2
  16. package/coverage/lcov-report/src/success/index.html +1 -1
  17. package/coverage/lcov-report/src/success/index.js.html +1 -1
  18. package/coverage/lcov-report/src/utils/constant.js.html +5 -2
  19. package/coverage/lcov-report/src/utils/helpers.js.html +1 -1
  20. package/coverage/lcov-report/src/utils/httpClient.js.html +1 -1
  21. package/coverage/lcov-report/src/utils/index.html +1 -1
  22. package/coverage/lcov.info +311 -310
  23. package/dist/api/certs.d.ts +2 -0
  24. package/dist/index.js +70 -2
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +70 -2
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/types/certs.d.ts +16 -0
  29. package/dist/utils/constant.d.ts +5 -4
  30. package/dist/utils/helpers.d.ts +1 -1
  31. package/package.json +1 -1
  32. package/src/api/certs.js +62 -1
  33. package/src/api/signatures.js +6 -1
  34. package/src/index.js +4 -0
  35. package/src/types/certs.js +9 -0
  36. package/src/utils/constant.js +1 -0
  37. package/tests/api/signatures.test.js +6 -1
@@ -13,3 +13,5 @@ export type GetCertTypesResponse = import("../types/certs").GetCertTypesResponse
13
13
  export type GetRequirementsResponse = import("../types/certs").GetRequirementsResponse;
14
14
  export type CertificateRequestParams = import("../types/certs").CertificateRequestParams;
15
15
  export type RequestCertificateResponse = import("../types/certs").RequestCertificateResponse;
16
+ export type ValidateCertificateResponseData = import("../types/certs").ValidateCertificateResponseData;
17
+ export type ValidateCertificateRequestParams = import("../types/certs").ValidateCertificateRequestParams;
package/dist/index.js CHANGED
@@ -276,6 +276,7 @@ function _wrapNativeSuper(t) {
276
276
 
277
277
  var STATUS_CERTIFICATE = {
278
278
  request: "SOLICITUD",
279
+ request_cert: "REVISION",
279
280
  generate: "GENERAR",
280
281
  current: "VIGENTE",
281
282
  revoque: "REVOCADO",
@@ -33310,6 +33311,10 @@ var getCertStatus = /*#__PURE__*/function () {
33310
33311
  userData = customer.data.userData;
33311
33312
  status = helpers.getCertificateStatus(userData, isCertificateInDevice, config.integrationType);
33312
33313
  parseStatus = PARSE_STATUS[status];
33314
+ console.log({
33315
+ status: status,
33316
+ parseStatus: parseStatus
33317
+ });
33313
33318
  return _context4.a(2, new ApacuanaSuccess({
33314
33319
  status: parseStatus
33315
33320
  }));
@@ -33494,6 +33499,62 @@ var getRequerimentsByTypeUser = /*#__PURE__*/function () {
33494
33499
  };
33495
33500
  }();
33496
33501
 
33502
+ // const validateCertificateOnBoarding = async (params) => {
33503
+ // throw new ApacuanaAPIError(
33504
+ // "Requesting a certificate is not supported for integration type: ONBOARDING",
33505
+ // 501,
33506
+ // "NOT_IMPLEMENTED"
33507
+ // );
33508
+ // // try {
33509
+ // // const response = await httpRequest(
33510
+ // // "services/api/customer/request-certificate",
33511
+ // // params,
33512
+ // // "POST"
33513
+ // // );
33514
+ // // return new ApacuanaSuccess(response);
33515
+ // // } catch (error) {
33516
+ // // if (error instanceof ApacuanaAPIError) {
33517
+ // // throw error;
33518
+ // // }
33519
+ // // throw new Error(`Failed to request certificate: ${error.message}`);
33520
+ // // }
33521
+ // };
33522
+
33523
+ // const validateCertificateOnPremise = async () => {
33524
+ // throw new ApacuanaAPIError(
33525
+ // "Requesting a certificate is not supported for integration type: ONPREMISE",
33526
+ // 501,
33527
+ // "NOT_IMPLEMENTED"
33528
+ // );
33529
+ // };
33530
+
33531
+ // /**
33532
+ // * Requests a certificate for the user.
33533
+ // * @param {ValidateCertificateRequestParams} params - The parameters for the certificate request.
33534
+ // * @returns {Promise<ValidateCertificateResponseData>} Object with a confirmation message and a success indicator.
33535
+ // * @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
33536
+ // * @throws {Error} If the request fails for another reason or the params are invalid.
33537
+ // */
33538
+ // export const validateCertificate = async (params) => {
33539
+ // if (!params || typeof params.challenge !== "string") {
33540
+ // throw new Error("Invalid params.");
33541
+ // }
33542
+
33543
+ // const { integrationType } = getConfig();
33544
+ // if (integrationType === INTEGRATION_TYPE.ONBOARDING) {
33545
+ // return requestCertificateOnBoarding(params);
33546
+ // }
33547
+ // if (integrationType === INTEGRATION_TYPE.ONPREMISE) {
33548
+ // return requestCertificateOnPremise();
33549
+ // }
33550
+
33551
+ // throw new ApacuanaAPIError(
33552
+ // `Unsupported integration type: ${integrationType}`,
33553
+ // 400,
33554
+ // "UNSUPPORTED_INTEGRATION_TYPE"
33555
+ // );
33556
+ // };
33557
+
33497
33558
  /** @typedef {import("../types/signatures").Signer} Signer */
33498
33559
  /** @typedef {import("../types/signatures").SignerData} SignerData */
33499
33560
  /** @typedef {import("../types/signatures").AddSignerResponse} AddSignerResponse */
@@ -33615,7 +33676,7 @@ var getDigestToSignOnPremise = /*#__PURE__*/function () {
33615
33676
  }();
33616
33677
  var addSignerOnBoarding = /*#__PURE__*/function () {
33617
33678
  var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(signerData) {
33618
- var payload, _t3;
33679
+ var payload, response, _t3;
33619
33680
  return _regenerator().w(function (_context5) {
33620
33681
  while (1) switch (_context5.p = _context5.n) {
33621
33682
  case 0:
@@ -33624,8 +33685,10 @@ var addSignerOnBoarding = /*#__PURE__*/function () {
33624
33685
  _context5.n = 2;
33625
33686
  return httpRequest("services/api/documents/signingsdk", payload, "POST");
33626
33687
  case 2:
33688
+ response = _context5.v;
33627
33689
  return _context5.a(2, new ApacuanaSuccess({
33628
- signer: signerData.typedoc + signerData.doc
33690
+ signer: signerData.typedoc + signerData.doc,
33691
+ docId: response.data.id
33629
33692
  }));
33630
33693
  case 3:
33631
33694
  _context5.p = 3;
@@ -34505,6 +34568,11 @@ var apacuana = {
34505
34568
  checkSdk(true);
34506
34569
  return validateFaceLiveness(data);
34507
34570
  },
34571
+ // validateCertificate: (data) => {
34572
+ // checkSdk(true);
34573
+ // validateCertificate(data);
34574
+ // },
34575
+
34508
34576
  close: function close$1() {
34509
34577
  return close();
34510
34578
  },