apacuana-sdk-core 1.0.0 → 1.2.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/.eslintrc.cjs +22 -0
- package/CHANGELOG.md +1 -0
- package/README.md +794 -0
- package/babel.config.cjs +11 -0
- package/coverage/clover.xml +628 -0
- package/coverage/coverage-final.json +13 -0
- package/coverage/lcov-report/api/index.html +131 -0
- package/coverage/lcov-report/api/signatures.js.html +1093 -0
- package/coverage/lcov-report/api/users.js.html +292 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/certs.js.html +175 -0
- package/coverage/lcov-report/config/index.html +116 -0
- package/coverage/lcov-report/config/index.js.html +208 -0
- package/coverage/lcov-report/errors/index.html +116 -0
- package/coverage/lcov-report/errors/index.js.html +148 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +191 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/api/certs.js.html +856 -0
- package/coverage/lcov-report/src/api/faceLiveness.js.html +523 -0
- package/coverage/lcov-report/src/api/index.html +176 -0
- package/coverage/lcov-report/src/api/revocations.js.html +412 -0
- package/coverage/lcov-report/src/api/signatures.js.html +1420 -0
- package/coverage/lcov-report/src/api/users.js.html +466 -0
- package/coverage/lcov-report/src/config/index.html +116 -0
- package/coverage/lcov-report/src/config/index.js.html +256 -0
- package/coverage/lcov-report/src/errors/index.html +116 -0
- package/coverage/lcov-report/src/errors/index.js.html +148 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/src/index.js.html +592 -0
- 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 +256 -0
- package/coverage/lcov-report/src/utils/helpers.js.html +1195 -0
- package/coverage/lcov-report/src/utils/httpClient.js.html +622 -0
- package/coverage/lcov-report/src/utils/index.html +146 -0
- package/coverage/lcov-report/utils/constant.js.html +145 -0
- package/coverage/lcov-report/utils/httpClient.js.html +646 -0
- package/coverage/lcov-report/utils/index.html +131 -0
- package/coverage/lcov.info +1259 -0
- package/dist/api/certs.d.ts +15 -0
- package/dist/api/faceLiveness.d.ts +6 -0
- package/dist/api/revocations.d.ts +6 -0
- package/dist/api/signatures.d.ts +19 -0
- package/dist/api/users.d.ts +47 -0
- package/dist/config/index.d.ts +22 -0
- package/dist/errors/index.d.ts +10 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +34493 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +34491 -0
- package/dist/index.mjs.map +1 -0
- package/dist/success/index.d.ts +7 -0
- package/dist/types/certs.d.ts +83 -0
- package/dist/types/faceLiveness.d.ts +11 -0
- package/dist/types/revocations.d.ts +51 -0
- package/dist/types/signatures.d.ts +162 -0
- package/dist/types/users.d.ts +260 -0
- package/dist/utils/constant.d.ts +49 -0
- package/dist/utils/helpers.d.ts +25 -0
- package/dist/utils/httpClient.d.ts +3 -0
- package/jest.config.cjs +12 -0
- package/package.json +51 -9
- package/rollup.config.js +32 -0
- package/src/api/certs.js +257 -0
- package/src/api/faceLiveness.js +146 -0
- package/src/api/revocations.js +109 -0
- package/src/api/signatures.js +445 -0
- package/src/api/users.js +127 -0
- package/src/config/index.js +57 -0
- package/src/errors/index.js +21 -0
- package/src/index.js +169 -0
- package/src/success/index.js +8 -0
- package/src/types/certs.js +67 -0
- package/src/types/faceLiveness.js +16 -0
- package/src/types/revocations.js +45 -0
- package/src/types/signatures.js +96 -0
- package/src/types/users.js +73 -0
- package/src/utils/constant.js +57 -0
- package/src/utils/helpers.js +370 -0
- package/src/utils/httpClient.js +179 -0
- package/tests/api/certs.test.js +311 -0
- package/tests/api/faceLiveness.test.js +170 -0
- package/tests/api/revocations.test.js +119 -0
- package/tests/api/signatures.test.js +530 -0
- package/tests/api/users.test.js +117 -0
- package/tests/index.test.js +131 -0
- package/tsconfig.json +16 -0
package/src/index.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { setConfig, getConfig, close } from "./config/index";
|
|
2
|
+
import { initHttpClient, setAuthToken } from "./utils/httpClient";
|
|
3
|
+
import { requestRevocation, getRevocationReasons } from "./api/revocations";
|
|
4
|
+
import {
|
|
5
|
+
generateCert,
|
|
6
|
+
getCertStatus,
|
|
7
|
+
getCertTypes,
|
|
8
|
+
getRequerimentsByTypeUser,
|
|
9
|
+
} from "./api/certs";
|
|
10
|
+
import {
|
|
11
|
+
addSigner,
|
|
12
|
+
deleteSignatureVariant,
|
|
13
|
+
getDigest,
|
|
14
|
+
getDocs,
|
|
15
|
+
getSignatureVariant,
|
|
16
|
+
signDocument,
|
|
17
|
+
uploadSignatureVariant,
|
|
18
|
+
} from "./api/signatures";
|
|
19
|
+
import {
|
|
20
|
+
createFaceLivenessSession,
|
|
21
|
+
validateFaceLiveness,
|
|
22
|
+
} from "./api/faceLiveness";
|
|
23
|
+
import ApacuanaSuccess from "./success/index";
|
|
24
|
+
import { ApacuanaAPIError } from "./errors/index";
|
|
25
|
+
import { createApacuanaUser, getCustomer } from "./api/users";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Valida si el SDK está inicializado y si se dispone de un customerId.
|
|
29
|
+
* @param {boolean} requiresCustomerId - Indica si la operación necesita un customerId.
|
|
30
|
+
* @throws {ApacuanaAPIError} Si el SDK no está inicializado o el customerId es requerido y no está presente.
|
|
31
|
+
*/
|
|
32
|
+
const checkSdk = (requiresCustomerId = true) => {
|
|
33
|
+
const config = getConfig();
|
|
34
|
+
|
|
35
|
+
if (!config || !config.apiUrl) {
|
|
36
|
+
throw new ApacuanaAPIError(
|
|
37
|
+
"El SDK no está inicializado. Llama a apacuana.init() primero.",
|
|
38
|
+
400,
|
|
39
|
+
"NOT_INITIALIZED_ERROR"
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (requiresCustomerId && !config.customerId) {
|
|
44
|
+
throw new ApacuanaAPIError(
|
|
45
|
+
"Se requiere un CustomerId para esta operación. Por favor, inicia sesión.",
|
|
46
|
+
403,
|
|
47
|
+
"CUSTOMER_ID_REQUIRED"
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const apacuana = {
|
|
53
|
+
/**
|
|
54
|
+
* Inicializa el Apacuana SDK con la configuración necesaria.
|
|
55
|
+
*/
|
|
56
|
+
init: async (config) => {
|
|
57
|
+
try {
|
|
58
|
+
setConfig(config);
|
|
59
|
+
initHttpClient();
|
|
60
|
+
const currentConfig = getConfig();
|
|
61
|
+
|
|
62
|
+
if (currentConfig.customerId) {
|
|
63
|
+
const customer = await getCustomer();
|
|
64
|
+
const { token, userData } = customer.data;
|
|
65
|
+
setConfig({ ...currentConfig, token, userData });
|
|
66
|
+
setAuthToken(token);
|
|
67
|
+
return new ApacuanaSuccess({
|
|
68
|
+
initialized: true,
|
|
69
|
+
message: "SDK inicializado con sesión de usuario.",
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return new ApacuanaSuccess({
|
|
74
|
+
initialized: true,
|
|
75
|
+
message: "SDK inicializado para operaciones públicas (sin customerId).",
|
|
76
|
+
});
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error("Error durante la inicialización del SDK:", error);
|
|
79
|
+
if (error instanceof ApacuanaAPIError) {
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
throw new ApacuanaAPIError(
|
|
83
|
+
error.message || "Error desconocido durante la inicialización.",
|
|
84
|
+
500,
|
|
85
|
+
error
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
// --- Métodos de Revocación ---
|
|
91
|
+
requestRevocation: (data) => {
|
|
92
|
+
checkSdk(true);
|
|
93
|
+
return requestRevocation(data);
|
|
94
|
+
},
|
|
95
|
+
getRevocationReasons: () => {
|
|
96
|
+
checkSdk(true);
|
|
97
|
+
return getRevocationReasons();
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
// --- Métodos de Certificados ---
|
|
101
|
+
generateCert: (data) => {
|
|
102
|
+
checkSdk(true);
|
|
103
|
+
return generateCert(data);
|
|
104
|
+
},
|
|
105
|
+
getCertStatus: (isCertificateInDevice) => {
|
|
106
|
+
checkSdk(true);
|
|
107
|
+
return getCertStatus(isCertificateInDevice);
|
|
108
|
+
},
|
|
109
|
+
getCertTypes: () => {
|
|
110
|
+
checkSdk(false);
|
|
111
|
+
return getCertTypes();
|
|
112
|
+
},
|
|
113
|
+
getRequerimentsByTypeUser: (data) => {
|
|
114
|
+
checkSdk(false);
|
|
115
|
+
return getRequerimentsByTypeUser(data);
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
// --- Métodos de Firmas y Documentos ---
|
|
119
|
+
addSigner: (data) => {
|
|
120
|
+
checkSdk(true);
|
|
121
|
+
return addSigner(data);
|
|
122
|
+
},
|
|
123
|
+
deleteSignatureVariant: () => {
|
|
124
|
+
checkSdk(true);
|
|
125
|
+
return deleteSignatureVariant();
|
|
126
|
+
},
|
|
127
|
+
getDigest: (data) => {
|
|
128
|
+
checkSdk(true);
|
|
129
|
+
return getDigest(data);
|
|
130
|
+
},
|
|
131
|
+
getDocs: (data) => {
|
|
132
|
+
checkSdk(true);
|
|
133
|
+
return getDocs(data);
|
|
134
|
+
},
|
|
135
|
+
getSignatureVariant: () => {
|
|
136
|
+
checkSdk(true);
|
|
137
|
+
return getSignatureVariant();
|
|
138
|
+
},
|
|
139
|
+
signDocument: (data) => {
|
|
140
|
+
checkSdk(true);
|
|
141
|
+
return signDocument(data);
|
|
142
|
+
},
|
|
143
|
+
uploadSignatureVariant: (data) => {
|
|
144
|
+
checkSdk(true);
|
|
145
|
+
return uploadSignatureVariant(data);
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
getCustomer: () => {
|
|
149
|
+
checkSdk(true);
|
|
150
|
+
return getCustomer();
|
|
151
|
+
},
|
|
152
|
+
createFaceLivenessSession: () => {
|
|
153
|
+
checkSdk(true);
|
|
154
|
+
return createFaceLivenessSession();
|
|
155
|
+
},
|
|
156
|
+
createApacuanaUser: (data) => {
|
|
157
|
+
checkSdk(false);
|
|
158
|
+
return createApacuanaUser(data);
|
|
159
|
+
},
|
|
160
|
+
validateFaceLiveness: (data) => {
|
|
161
|
+
checkSdk(true);
|
|
162
|
+
return validateFaceLiveness(data);
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
close: () => close(),
|
|
166
|
+
getConfig,
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export default apacuana;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../success').ApacuanaSuccess} ApacuanaSuccess
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Tipos de datos para las respuestas
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {object} GenerateCertResponseData
|
|
8
|
+
* @property {string} cert - El certificado generado en formato string.
|
|
9
|
+
* @property {string} certifiedid - El ID del certificado generado.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {object} GetCertStatusResponseData
|
|
13
|
+
* @property {string} status - El estado actual del certificado del usuario.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {object} CertType
|
|
17
|
+
* @property {string} id - The ID of the certificate type.
|
|
18
|
+
* @property {string} name - The name of the certificate type.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {object} GetCertTypesResponseData
|
|
22
|
+
* @property {Array<CertType>} types - A list of available certificate types.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {object} Requirement
|
|
26
|
+
* @property {string} id - The ID of the requirement.
|
|
27
|
+
* @property {string} description - The description of the requirement.
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {object} GetRequirementsResponseData
|
|
31
|
+
* @property {Array<Requirement>} requirements - A list of requirements for the user type.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {object} RequestCertificateResponseData
|
|
35
|
+
* @property {string} message - A message confirming the request.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
// Tipos de respuesta combinados con ApacuanaSuccess
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {GenerateCertResponseData & ApacuanaSuccess} GenerateCertResponse
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* @typedef {GetCertStatusResponseData & ApacuanaSuccess} GetCertStatusResponse
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* @typedef {GetCertTypesResponseData & ApacuanaSuccess} GetCertTypesResponse
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* @typedef {GetRequirementsResponseData & ApacuanaSuccess} GetRequirementsResponse
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* @typedef {RequestCertificateResponseData & ApacuanaSuccess} RequestCertificateResponse
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
// Otros tipos de datos
|
|
56
|
+
/**
|
|
57
|
+
* @typedef {object} EncryptedCSRObject
|
|
58
|
+
* @property {string} csr - The encrypted Certificate Signing Request.
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* @typedef {object} CertificateRequestParams
|
|
62
|
+
* @property {number} type - The user type to get requirements for.
|
|
63
|
+
* @property {string} [observation] - An optional observation for the certificate request.
|
|
64
|
+
* @property {Array<{id: string, file: string}>} documents - The documents required for the certificate.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../success').ApacuanaSuccess} ApacuanaSuccess
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {object} CreateFaceLivenessSessionData
|
|
7
|
+
* @property {string} sessionId - The session ID for the face liveness check.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {object} CreateFaceLivenessSessionResponse
|
|
12
|
+
* @property {true} success
|
|
13
|
+
* @property {CreateFaceLivenessSessionData} data
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../success').ApacuanaSuccess} ApacuanaSuccess
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {object} RevocationReason
|
|
7
|
+
* @property {string} code - The code for the revocation reason.
|
|
8
|
+
* @property {string} description - The description of the revocation reason.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {object} RequestRevocationData
|
|
13
|
+
* @property {string} message - A message providing details about the outcome.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {object} RequestRevocationResponse
|
|
18
|
+
* @property {true} success
|
|
19
|
+
* @property {RequestRevocationData} data
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {object} GetRevocationReasonsData
|
|
24
|
+
* @property {RevocationReason[]} reasons - A list of revocation reasons.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @typedef {object} GetRevocationReasonsResponse
|
|
29
|
+
* @property {true} success
|
|
30
|
+
* @property {GetRevocationReasonsData} data
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {object} RevocationResponse
|
|
35
|
+
* @property {boolean} success - Indicates if the revocation request was successful.
|
|
36
|
+
* @property {string} [message] - A message providing details about the outcome.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {object} RevocationReasonsResponse
|
|
41
|
+
* @property {boolean} success - Indicates if the request was successful.
|
|
42
|
+
* @property {RevocationReason[]} reasons - A list of revocation reasons.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../success').ApacuanaSuccess} ApacuanaSuccess
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Define la estructura de un objeto Firmante.
|
|
7
|
+
* @typedef {object} Signer
|
|
8
|
+
* @property {string} name - Nombre completo del firmante.
|
|
9
|
+
* @property {string} email - Correo electrónico del firmante.
|
|
10
|
+
* @property {string} document - Documento de identidad del firmante.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {object} AddSignerData
|
|
15
|
+
* @property {string} signer - Identificador de confirmación del firmante añadido.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Define la estructura de la respuesta al añadir un firmante.
|
|
20
|
+
* @typedef {object} AddSignerResponse
|
|
21
|
+
* @property {true} success
|
|
22
|
+
* @property {AddSignerData} data
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Define la estructura de datos para obtener el digest de un documento.
|
|
27
|
+
* @typedef {object} GetDigestData
|
|
28
|
+
* @property {string} cert - Certificado del firmante en formato base64.
|
|
29
|
+
* @property {string} signatureId - Identificador único de la firma.
|
|
30
|
+
* @property {File} [document] - Documento a firmar en formato de archivo. Este campo es opcional.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {object} SignaturePlacement
|
|
35
|
+
* @property {number} page - Página donde se estampará la firma.
|
|
36
|
+
* @property {number} x - Coordenada X de la firma.
|
|
37
|
+
* @property {number} y - Coordenada Y de la firma.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Define la estructura de datos para añadir un firmante.
|
|
42
|
+
* @typedef {object} SignerData
|
|
43
|
+
* @property {string} name - Nombre del firmante.
|
|
44
|
+
* @property {string} typedoc - Tipo de documento de identidad del firmante.
|
|
45
|
+
* @property {string} doc - Número de documento de identidad del firmante.
|
|
46
|
+
* @property {Array<SignaturePlacement>} signature - Array con las coordenadas donde se estampará la firma.
|
|
47
|
+
* @property {string} [reference] - Referencia a un documento pre-cargado. Se debe proporcionar 'reference' o 'file', pero no ambos.
|
|
48
|
+
* @property {File} [file] - Archivo del documento a firmar. Se debe proporcionar 'reference' o 'file', pero no ambos.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Define la estructura de datos para la respuesta de la creación de una firma.
|
|
53
|
+
* @typedef {object} GetDigestResponseData
|
|
54
|
+
* @property {string} digest - El digest del documento que se va a firmar.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Define la estructura de la respuesta al obtener el digest.
|
|
59
|
+
* @typedef {object} GetDigestResponse
|
|
60
|
+
* @property {true} success
|
|
61
|
+
* @property {GetDigestResponseData} data
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Define la estructura de los parámetros para obtener documentos.
|
|
66
|
+
* @typedef {object} GetDocsParams
|
|
67
|
+
* @property {number} page - Número de página para la paginación.
|
|
68
|
+
* @property {number} size - Cantidad de registros por página.
|
|
69
|
+
* @property {string} [status] - (Opcional) Estado para filtrar los documentos.
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @typedef {object} GetDocsResponseData
|
|
74
|
+
* @property {number} totalRecords - El número total de registros encontrados.
|
|
75
|
+
* @property {Array<object>} records - Un arreglo con los registros de los documentos.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Define la estructura de la respuesta al obtener documentos.
|
|
80
|
+
* @typedef {object} GetDocsResponse
|
|
81
|
+
* @property {true} success
|
|
82
|
+
* @property {GetDocsResponseData} data
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @typedef {object} SignDocumentData
|
|
87
|
+
* @property {object} signature - Objeto con información de la firma.
|
|
88
|
+
* @property {string} signature.id - ID de la firma.
|
|
89
|
+
* @property {Array<object>} signature.positions - Posiciones de la firma.
|
|
90
|
+
* @property {string} cert - Certificado en base64.
|
|
91
|
+
* @property {string} signedDigest - Digest firmado.
|
|
92
|
+
* @property {File} [document] - Documento a firmar en formato de archivo. Este campo es opcional.
|
|
93
|
+
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} UserData
|
|
3
|
+
* @property {string} email - Correo electrónico. No puede contener espacios y tiene un máximo de 128 caracteres.
|
|
4
|
+
* @property {number} typeuser - Tipo de usuario. Debe ser un ID valido.
|
|
5
|
+
* @property {string} name - Nombre de la persona.
|
|
6
|
+
* @property {string} lastname - Apellido de la persona.
|
|
7
|
+
* @property {'V' | 'P' | 'E'} kinddoc - Tipo de documento de identidad. Puede ser 'V' (Venezolano), 'P' (Pasaporte) o 'E' (Extranjero).
|
|
8
|
+
* @property {number} doc - Número de documento de identidad. Debe ser un número entero.
|
|
9
|
+
* @property {string} birthdate - Fecha de nacimiento. Debe ser una fecha válida en formato ISO y no puede ser una fecha futura.
|
|
10
|
+
* @property {'J' | 'G' | 'V' | 'P' | 'E'} kindrif - Tipo de RIF (Registro de Información Fiscal). Puede ser 'J', 'G', 'V', 'P' o 'E'.
|
|
11
|
+
* @property {'M' | 'F' | 'Sin especificar'} gender - Género. Puede ser 'M' (Masculino), 'F' (Femenino) o 'Sin especificar'.
|
|
12
|
+
* @property {number} rif - Número de RIF. Debe ser un número entero.
|
|
13
|
+
* @property {number} phone - Número de teléfono. Debe ser un número entero.
|
|
14
|
+
* @property {string} kindphone - Código de área del teléfono. Ej. 0424.
|
|
15
|
+
* @property {string} state - Nombre del estado.
|
|
16
|
+
* @property {string} municipality - Nombre del municipio.
|
|
17
|
+
* @property {string} parish - Nombre de la parroquia.
|
|
18
|
+
* @property {string} postalcode - Código postal.
|
|
19
|
+
* @property {string} address - Dirección.
|
|
20
|
+
* @property {string} fiscaladdress - Dirección fiscal.
|
|
21
|
+
* @property {string} fiscalkindphone - Código de área del teléfono fiscal. Ej. 0424.
|
|
22
|
+
* @property {number} fiscalphone - Número de teléfono fiscal. Debe ser un número entero.
|
|
23
|
+
* @property {string} occupation - Ocupacion de la persona.
|
|
24
|
+
* @property {string} degree - Título universitario.
|
|
25
|
+
* @property {string} university - Universidad.
|
|
26
|
+
* @property {string} graduationyear - Año de graduación.
|
|
27
|
+
* @property {string} collegiatenumber - Número de colegiado.
|
|
28
|
+
* @property {string} collegiateyear - Año de colegiatura.
|
|
29
|
+
* @property {string} companyname - Nombre de la empresa.
|
|
30
|
+
* @property {'J' | 'G' | 'V' | 'P' | 'E'} companykindrif - Tipo de RIF de la empresa. Puede ser 'J', 'G', 'V', 'P' o 'E'.
|
|
31
|
+
* @property {string} companyrif - Número de RIF de la empresa.
|
|
32
|
+
* @property {string} companystate - Estado de la empresa.
|
|
33
|
+
* @property {string} companymunicipality - Municipio de la empresa.
|
|
34
|
+
* @property {string} companyparish - Parroquia de la empresa.
|
|
35
|
+
* @property {string} companyaddress - Dirección de la empresa.
|
|
36
|
+
* @property {string} companykindphone - Código de área del teléfono de la empresa. Ej. 0212.
|
|
37
|
+
* @property {string} companyphone - Número de teléfono de la empresa.
|
|
38
|
+
* @property {string} companypostalcode - Código postal de la empresa.
|
|
39
|
+
* @property {string} companywebpage - Página web de la empresa.
|
|
40
|
+
* @property {string} companycommercialregister - Registro comercial de la empresa.
|
|
41
|
+
* @property {string} companyregisterdate - Fecha de registro de la empresa en formato ISO.
|
|
42
|
+
* @property {string} companyregisternumber - Número de registro de la empresa.
|
|
43
|
+
* @property {string} companyconstitutiondate - Fecha de constitución de la empresa en formato ISO.
|
|
44
|
+
* @property {string} companypublishdate - Fecha de publicación del decreto de constitución. Debe ser una fecha válida en formato ISO y no puede ser una fecha futura.
|
|
45
|
+
* @property {string} companyconstitutiondecree - Decreto de constitución de la empresa. Máximo 32 caracteres.
|
|
46
|
+
* @property {string} companynumberdecree - Número de decreto de la empresa. Máximo 16 caracteres.
|
|
47
|
+
* @property {string} positionprivate - Cargo empleado empresa privada.
|
|
48
|
+
* @property {string} departmentprivate - Departamento empleado empresa privada.
|
|
49
|
+
* @property {string} authorizedprivate - Autorizado de por empleado empresa privada.
|
|
50
|
+
* @property {string} functionsprivate - Funciones empleado empresa privada.
|
|
51
|
+
* @property {string} publishprivate - Fecha de publicación de la gaceta de la empresa privada.
|
|
52
|
+
* @property {string} issuedateprivate - Fecha de registro de la empresa privada. Debe ser una fecha válida en formato ISO.
|
|
53
|
+
* @property {string} kindphoneprivate - Código de área del teléfono de la empresa privada. ej. 0424.
|
|
54
|
+
* @property {number} phoneprivate - Número de teléfono privado. Debe ser un número entero.
|
|
55
|
+
* @property {string} positionpublic - Cargo empleado empresa publica.
|
|
56
|
+
* @property {string} departmentpublic - Departamento empleado empresa publica.
|
|
57
|
+
* @property {string} authorizedpublic - Autorizado empleado empresa publica.
|
|
58
|
+
* @property {string} functionspublic - Funciones de empleado empresa publica.
|
|
59
|
+
* @property {string} publishpublic - Fecha de publicación de la gaceta de la empresa pública.
|
|
60
|
+
* @property {string} issuedatepublic - Fecha de registro de la empresa pública. Debe ser una fecha válida en formato ISO.
|
|
61
|
+
* @property {string} kindphonepublic - Código de área del teléfono de la empresa publica. ej 0424.
|
|
62
|
+
* @property {number} phonepublic - Número de teléfono público. Debe ser un número entero.
|
|
63
|
+
* @property {string} companyid - ID de la empresa. Debe ser un UUID para la creacion de empleados.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @typedef {object} GetCustomerResponse
|
|
68
|
+
* @property {string} token - El token de sesión del usuario.
|
|
69
|
+
* @property {UserData} userData - Los datos del usuario obtenidos.
|
|
70
|
+
* @property {boolean} success - Indica si la operación fue exitosa.
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export const STATUS_CERTIFICATE = {
|
|
2
|
+
request: "SOLICITUD",
|
|
3
|
+
generate: "GENERAR",
|
|
4
|
+
current: "VIGENTE",
|
|
5
|
+
revoque: "REVOCADO",
|
|
6
|
+
expire: "EXPIRADO",
|
|
7
|
+
request_revoque: "SOLICITUD_DE_REVOCACION",
|
|
8
|
+
certificate_another_device: "CERTIFICADO_EN_OTRO_DISPOSITIVO",
|
|
9
|
+
sign_pending: "PENDIENTE_POR_FIRMAR",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const PARSE_STATUS = {
|
|
13
|
+
[STATUS_CERTIFICATE.certificate_another_device]: {
|
|
14
|
+
text: "Verificado",
|
|
15
|
+
descriptionText: undefined,
|
|
16
|
+
},
|
|
17
|
+
[STATUS_CERTIFICATE.request_cert]: {
|
|
18
|
+
text: "En revisión",
|
|
19
|
+
descriptionText:
|
|
20
|
+
"La información y documentos enviados están siendo certificados por la Autoridad de Certificación para confirmar su validez.",
|
|
21
|
+
},
|
|
22
|
+
[STATUS_CERTIFICATE.request]: {
|
|
23
|
+
text: "Por verificar",
|
|
24
|
+
descriptionText:
|
|
25
|
+
"La información y documentos enviados están siendo revisados por la Autoridad de Registro.",
|
|
26
|
+
},
|
|
27
|
+
[STATUS_CERTIFICATE.generate]: {
|
|
28
|
+
text: "Por generar",
|
|
29
|
+
descriptionText:
|
|
30
|
+
"Tu solicitud fue aprobada. Solo falta que generes tu certificado para comenzar a usarlo.",
|
|
31
|
+
},
|
|
32
|
+
[STATUS_CERTIFICATE.current]: {
|
|
33
|
+
text: " ",
|
|
34
|
+
descriptionText: undefined,
|
|
35
|
+
},
|
|
36
|
+
[STATUS_CERTIFICATE.expire]: "Certificado expirado.",
|
|
37
|
+
[STATUS_CERTIFICATE.request_revoque]: {
|
|
38
|
+
text: "Por revocar",
|
|
39
|
+
descriptionText:
|
|
40
|
+
"Recibimos tu solicitud de revocación y estamos procesándola. El certificado dejará de ser válido una vez finalice el trámite.",
|
|
41
|
+
},
|
|
42
|
+
[STATUS_CERTIFICATE.revoque]: {
|
|
43
|
+
text: "Revocado",
|
|
44
|
+
descriptionText:
|
|
45
|
+
"Este certificado ha sido revocado. Debes solicitar uno nuevo.",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const VERIFICATION_STATUS = {
|
|
50
|
+
IN_REGISTER: 0,
|
|
51
|
+
APPROVED: 1,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const INTEGRATION_TYPE = {
|
|
55
|
+
ONBOARDING: "ONBOARDING",
|
|
56
|
+
ONPREMISE: "ONPREMISE",
|
|
57
|
+
};
|