@integraciones_doc24/sdk 1.1.1 → 1.3.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/lib/baseSdk/diagnostica.d.ts +6 -6
- package/lib/baseSdk/index.js +5 -1
- package/lib/baseSdk/user.d.ts +4 -51
- package/lib/baseSdk/user.js +25 -67
- package/lib/index.d.ts +16 -44
- package/lib/lib/baseSdk/diagnostica.d.ts +11 -0
- package/lib/lib/baseSdk/diagnostica.js +79 -0
- package/lib/lib/baseSdk/index.d.ts +161 -0
- package/lib/lib/baseSdk/index.js +66 -0
- package/lib/lib/baseSdk/user.d.ts +41 -0
- package/lib/lib/baseSdk/user.js +130 -0
- package/lib/lib/index.d.ts +182 -0
- package/lib/lib/index.js +22 -0
- package/lib/lib/lib/baseSdk/diagnostica.d.ts +6 -0
- package/lib/lib/lib/baseSdk/diagnostica.js +79 -0
- package/lib/lib/lib/baseSdk/index.d.ts +51 -0
- package/lib/lib/lib/baseSdk/index.js +66 -0
- package/lib/lib/lib/baseSdk/user.d.ts +9 -0
- package/lib/lib/lib/baseSdk/user.js +130 -0
- package/lib/lib/lib/index.d.ts +168 -0
- package/lib/lib/lib/index.js +22 -0
- package/lib/lib/lib/lib/baseSdk/diagnostica.d.ts +6 -0
- package/lib/lib/lib/lib/baseSdk/diagnostica.js +79 -0
- package/lib/lib/lib/lib/baseSdk/index.d.ts +14 -0
- package/lib/lib/lib/lib/baseSdk/index.js +66 -0
- package/lib/lib/lib/lib/baseSdk/user.d.ts +9 -0
- package/lib/lib/lib/lib/baseSdk/user.js +130 -0
- package/lib/lib/lib/lib/index.d.ts +58 -0
- package/lib/lib/lib/lib/index.js +22 -0
- package/lib/lib/lib/lib/request/index.d.ts +2 -0
- package/lib/lib/lib/lib/request/index.js +26 -0
- package/lib/lib/lib/lib/request/token.d.ts +2 -0
- package/lib/lib/lib/lib/request/token.js +34 -0
- package/lib/lib/lib/lib/request/validation.d.ts +10 -0
- package/lib/lib/lib/lib/request/validation.js +28 -0
- package/lib/lib/lib/lib/schemas.d.ts +1334 -0
- package/lib/lib/lib/lib/schemas.js +325 -0
- package/lib/lib/lib/lib/test.d.ts +1 -0
- package/lib/lib/lib/lib/test.js +55 -0
- package/lib/lib/lib/lib/types.d.ts +1 -0
- package/lib/lib/lib/lib/types.js +2 -0
- package/lib/lib/lib/lib/userSdk/chat.d.ts +9 -0
- package/lib/lib/lib/lib/userSdk/chat.js +98 -0
- package/lib/lib/lib/lib/userSdk/index.d.ts +24 -0
- package/lib/lib/lib/lib/userSdk/index.js +27 -0
- package/lib/lib/lib/lib/userSdk/patients.d.ts +5 -0
- package/lib/lib/lib/lib/userSdk/patients.js +55 -0
- package/lib/lib/lib/lib/userSdk/schedule.d.ts +7 -0
- package/lib/lib/lib/lib/userSdk/schedule.js +76 -0
- package/lib/lib/lib/lib/userSdk/specialties.d.ts +4 -0
- package/lib/lib/lib/lib/userSdk/specialties.js +19 -0
- package/lib/lib/lib/lib/userSdk/videoVisit.d.ts +10 -0
- package/lib/lib/lib/lib/userSdk/videoVisit.js +147 -0
- package/lib/lib/lib/lib/utils.d.ts +4 -0
- package/lib/lib/lib/lib/utils.js +19 -0
- package/lib/lib/lib/lib/webhook/index.d.ts +8 -0
- package/lib/lib/lib/lib/webhook/index.js +55 -0
- package/lib/lib/lib/lib/webhook/responses.d.ts +36 -0
- package/lib/lib/lib/lib/webhook/responses.js +42 -0
- package/lib/lib/lib/lib/webhook/token.d.ts +2 -0
- package/lib/lib/lib/lib/webhook/token.js +23 -0
- package/lib/lib/lib/request/index.d.ts +2 -0
- package/lib/lib/lib/request/index.js +26 -0
- package/lib/lib/lib/request/token.d.ts +2 -0
- package/lib/lib/lib/request/token.js +34 -0
- package/lib/lib/lib/request/validation.d.ts +10 -0
- package/lib/lib/lib/request/validation.js +28 -0
- package/lib/lib/lib/schemas.d.ts +1334 -0
- package/lib/lib/lib/schemas.js +325 -0
- package/lib/lib/lib/src/baseSdk/diagnostica.d.ts +6 -0
- package/lib/lib/lib/src/baseSdk/diagnostica.js +79 -0
- package/lib/lib/lib/src/baseSdk/index.d.ts +51 -0
- package/lib/lib/lib/src/baseSdk/index.js +66 -0
- package/lib/lib/lib/src/baseSdk/user.d.ts +9 -0
- package/lib/lib/lib/src/baseSdk/user.js +130 -0
- package/lib/lib/lib/src/index.d.ts +169 -0
- package/lib/lib/lib/src/index.js +22 -0
- package/lib/lib/lib/src/request/index.d.ts +2 -0
- package/lib/lib/lib/src/request/index.js +26 -0
- package/lib/lib/lib/src/request/token.d.ts +2 -0
- package/lib/lib/lib/src/request/token.js +34 -0
- package/lib/lib/lib/src/request/validation.d.ts +10 -0
- package/lib/lib/lib/src/request/validation.js +28 -0
- package/lib/lib/lib/src/schemas.d.ts +1340 -0
- package/lib/lib/lib/src/schemas.js +325 -0
- package/lib/lib/lib/src/types.d.ts +1 -0
- package/lib/lib/lib/src/types.js +2 -0
- package/lib/lib/lib/src/userSdk/chat.d.ts +9 -0
- package/lib/lib/lib/src/userSdk/chat.js +98 -0
- package/lib/lib/lib/src/userSdk/index.d.ts +102 -0
- package/lib/lib/lib/src/userSdk/index.js +27 -0
- package/lib/lib/lib/src/userSdk/patients.d.ts +5 -0
- package/lib/lib/lib/src/userSdk/patients.js +55 -0
- package/lib/lib/lib/src/userSdk/schedule.d.ts +7 -0
- package/lib/lib/lib/src/userSdk/schedule.js +76 -0
- package/lib/lib/lib/src/userSdk/specialties.d.ts +4 -0
- package/lib/lib/lib/src/userSdk/specialties.js +19 -0
- package/lib/lib/lib/src/userSdk/videoVisit.d.ts +10 -0
- package/lib/lib/lib/src/userSdk/videoVisit.js +147 -0
- package/lib/lib/lib/src/utils.d.ts +4 -0
- package/lib/lib/lib/src/utils.js +19 -0
- package/lib/lib/lib/src/webhook/index.d.ts +8 -0
- package/lib/lib/lib/src/webhook/index.js +55 -0
- package/lib/lib/lib/src/webhook/responses.d.ts +36 -0
- package/lib/lib/lib/src/webhook/responses.js +42 -0
- package/lib/lib/lib/src/webhook/token.d.ts +2 -0
- package/lib/lib/lib/src/webhook/token.js +23 -0
- package/lib/lib/lib/test.d.ts +1 -0
- package/lib/lib/lib/test.js +55 -0
- package/lib/lib/lib/types.d.ts +1 -0
- package/lib/lib/lib/types.js +2 -0
- package/lib/lib/lib/userSdk/chat.d.ts +9 -0
- package/lib/lib/lib/userSdk/chat.js +98 -0
- package/lib/lib/lib/userSdk/index.d.ts +102 -0
- package/lib/lib/lib/userSdk/index.js +27 -0
- package/lib/lib/lib/userSdk/patients.d.ts +5 -0
- package/lib/lib/lib/userSdk/patients.js +55 -0
- package/lib/lib/lib/userSdk/schedule.d.ts +7 -0
- package/lib/lib/lib/userSdk/schedule.js +76 -0
- package/lib/lib/lib/userSdk/specialties.d.ts +4 -0
- package/lib/lib/lib/userSdk/specialties.js +19 -0
- package/lib/lib/lib/userSdk/videoVisit.d.ts +10 -0
- package/lib/lib/lib/userSdk/videoVisit.js +147 -0
- package/lib/lib/lib/utils.d.ts +4 -0
- package/lib/lib/lib/utils.js +19 -0
- package/lib/lib/lib/webhook/index.d.ts +8 -0
- package/lib/lib/lib/webhook/index.js +55 -0
- package/lib/lib/lib/webhook/responses.d.ts +36 -0
- package/lib/lib/lib/webhook/responses.js +42 -0
- package/lib/lib/lib/webhook/token.d.ts +2 -0
- package/lib/lib/lib/webhook/token.js +23 -0
- package/lib/lib/request/index.d.ts +2 -0
- package/lib/lib/request/index.js +26 -0
- package/lib/lib/request/token.d.ts +2 -0
- package/lib/lib/request/token.js +34 -0
- package/lib/lib/request/validation.d.ts +10 -0
- package/lib/lib/request/validation.js +28 -0
- package/lib/lib/schemas.d.ts +1334 -0
- package/lib/lib/schemas.js +325 -0
- package/lib/lib/src/baseSdk/diagnostica.d.ts +11 -0
- package/lib/lib/src/baseSdk/diagnostica.js +79 -0
- package/lib/lib/src/baseSdk/index.d.ts +162 -0
- package/lib/lib/src/baseSdk/index.js +66 -0
- package/lib/lib/src/baseSdk/user.d.ts +41 -0
- package/lib/lib/src/baseSdk/user.js +130 -0
- package/lib/lib/src/index.d.ts +183 -0
- package/lib/lib/src/index.js +22 -0
- package/lib/lib/src/request/index.d.ts +2 -0
- package/lib/lib/src/request/index.js +26 -0
- package/lib/lib/src/request/token.d.ts +2 -0
- package/lib/lib/src/request/token.js +34 -0
- package/lib/lib/src/request/validation.d.ts +10 -0
- package/lib/lib/src/request/validation.js +28 -0
- package/lib/lib/src/schemas.d.ts +1340 -0
- package/lib/lib/src/schemas.js +325 -0
- package/lib/lib/src/types.d.ts +1 -0
- package/lib/lib/src/types.js +2 -0
- package/lib/lib/src/userSdk/chat.d.ts +9 -0
- package/lib/lib/src/userSdk/chat.js +98 -0
- package/lib/lib/src/userSdk/index.d.ts +241 -0
- package/lib/lib/src/userSdk/index.js +27 -0
- package/lib/lib/src/userSdk/patients.d.ts +13 -0
- package/lib/lib/src/userSdk/patients.js +55 -0
- package/lib/lib/src/userSdk/schedule.d.ts +15 -0
- package/lib/lib/src/userSdk/schedule.js +76 -0
- package/lib/lib/src/userSdk/specialties.d.ts +4 -0
- package/lib/lib/src/userSdk/specialties.js +19 -0
- package/lib/lib/src/userSdk/videoVisit.d.ts +72 -0
- package/lib/lib/src/userSdk/videoVisit.js +147 -0
- package/lib/lib/src/utils.d.ts +4 -0
- package/lib/lib/src/utils.js +19 -0
- package/lib/lib/src/webhook/index.d.ts +8 -0
- package/lib/lib/src/webhook/index.js +55 -0
- package/lib/lib/src/webhook/responses.d.ts +36 -0
- package/lib/lib/src/webhook/responses.js +42 -0
- package/lib/lib/src/webhook/token.d.ts +2 -0
- package/lib/lib/src/webhook/token.js +23 -0
- package/lib/lib/test.d.ts +1 -0
- package/lib/lib/test.js +55 -0
- package/lib/lib/types.d.ts +1 -0
- package/lib/lib/types.js +2 -0
- package/lib/lib/userSdk/chat.d.ts +9 -0
- package/lib/lib/userSdk/chat.js +98 -0
- package/lib/lib/userSdk/index.d.ts +240 -0
- package/lib/lib/userSdk/index.js +27 -0
- package/lib/lib/userSdk/patients.d.ts +13 -0
- package/lib/lib/userSdk/patients.js +55 -0
- package/lib/lib/userSdk/schedule.d.ts +15 -0
- package/lib/lib/userSdk/schedule.js +76 -0
- package/lib/lib/userSdk/specialties.d.ts +4 -0
- package/lib/lib/userSdk/specialties.js +19 -0
- package/lib/lib/userSdk/videoVisit.d.ts +72 -0
- package/lib/lib/userSdk/videoVisit.js +147 -0
- package/lib/lib/utils.d.ts +4 -0
- package/lib/lib/utils.js +19 -0
- package/lib/lib/webhook/index.d.ts +8 -0
- package/lib/lib/webhook/index.js +55 -0
- package/lib/lib/webhook/responses.d.ts +36 -0
- package/lib/lib/webhook/responses.js +42 -0
- package/lib/lib/webhook/token.d.ts +2 -0
- package/lib/lib/webhook/token.js +23 -0
- package/lib/schemas.d.ts +30 -220
- package/lib/schemas.js +2 -33
- package/lib/src/baseSdk/diagnostica.d.ts +54 -0
- package/lib/src/baseSdk/diagnostica.js +79 -0
- package/lib/src/baseSdk/index.d.ts +2 -0
- package/lib/src/baseSdk/index.js +66 -0
- package/lib/src/baseSdk/user.d.ts +89 -0
- package/lib/src/baseSdk/user.js +130 -0
- package/lib/src/index.d.ts +188 -0
- package/lib/src/index.js +22 -0
- package/lib/src/request/index.d.ts +3 -0
- package/lib/src/request/index.js +26 -0
- package/lib/src/request/token.d.ts +2 -0
- package/lib/src/request/token.js +34 -0
- package/lib/src/request/validation.d.ts +10 -0
- package/lib/src/request/validation.js +28 -0
- package/lib/src/schemas.d.ts +1311 -0
- package/lib/src/schemas.js +325 -0
- package/lib/src/types.d.ts +124 -0
- package/lib/src/types.js +2 -0
- package/lib/src/userSdk/chat.d.ts +57 -0
- package/lib/src/userSdk/chat.js +98 -0
- package/lib/src/userSdk/index.d.ts +2 -0
- package/lib/src/userSdk/index.js +27 -0
- package/lib/src/userSdk/patients.d.ts +33 -0
- package/lib/src/userSdk/patients.js +55 -0
- package/lib/src/userSdk/schedule.d.ts +44 -0
- package/lib/src/userSdk/schedule.js +76 -0
- package/lib/src/userSdk/specialties.d.ts +7 -0
- package/lib/src/userSdk/specialties.js +19 -0
- package/lib/src/userSdk/videoVisit.d.ts +111 -0
- package/lib/src/userSdk/videoVisit.js +147 -0
- package/lib/src/utils.d.ts +4 -0
- package/lib/src/utils.js +19 -0
- package/lib/src/webhook/index.d.ts +2 -0
- package/lib/src/webhook/index.js +55 -0
- package/lib/src/webhook/responses.d.ts +35 -0
- package/lib/src/webhook/responses.js +42 -0
- package/lib/src/webhook/token.d.ts +2 -0
- package/lib/src/webhook/token.js +23 -0
- package/lib/test.js +1 -36
- package/lib/types.d.ts +2 -10
- package/lib/userSdk/chat.d.ts +1 -1
- package/lib/userSdk/patients.d.ts +2 -22
- package/lib/userSdk/patients.js +6 -34
- package/lib/userSdk/videoVisit.d.ts +2 -2
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBaseSdk = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const request_1 = require("../request");
|
|
6
|
+
const validation_1 = require("../request/validation");
|
|
7
|
+
const schemas_1 = require("../schemas");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const diagnostica_1 = require("./diagnostica");
|
|
10
|
+
const user_1 = require("./user");
|
|
11
|
+
const getBaseSdk = async (url, credentials) => {
|
|
12
|
+
const makeRequest = await request_1.getRequestFactory(url, credentials);
|
|
13
|
+
const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
|
|
14
|
+
const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
|
|
15
|
+
const baseSdk = {
|
|
16
|
+
...diagnosticaMethods,
|
|
17
|
+
...userMethods,
|
|
18
|
+
getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
|
|
19
|
+
const path = `/professional/${professionalId}`;
|
|
20
|
+
const response = await makeRequest('GET', path);
|
|
21
|
+
const raw = response.data;
|
|
22
|
+
return {
|
|
23
|
+
id: raw.professional_id,
|
|
24
|
+
firstName: raw.name,
|
|
25
|
+
lastName: raw.lastname,
|
|
26
|
+
birthdate: utils_1.parseDate(raw.birthdate),
|
|
27
|
+
gender: raw.gender.toLowerCase(),
|
|
28
|
+
email: raw.email,
|
|
29
|
+
phone: raw.phone,
|
|
30
|
+
logoUrl: raw.image,
|
|
31
|
+
matriculation: raw.matriculation,
|
|
32
|
+
specialties: raw.specialties.map((s) => ({
|
|
33
|
+
id: s.specialty_id,
|
|
34
|
+
description: s.specialty,
|
|
35
|
+
})),
|
|
36
|
+
degree: raw.degree,
|
|
37
|
+
languages: raw.languages.map((l) => l.languages),
|
|
38
|
+
resume: {
|
|
39
|
+
link: raw.resume_link,
|
|
40
|
+
brief: raw.resume_brief,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}),
|
|
44
|
+
getAvailableScheduleClinics: validation_1.validateFunction(zod_1.tuple([]), schemas_1.doc24Schemas.availableScheduleClinics, async () => {
|
|
45
|
+
const path = `/schedule/clinics`;
|
|
46
|
+
const response = await makeRequest('GET', path);
|
|
47
|
+
const mapSpeciality = (s) => ({
|
|
48
|
+
id: s.id_especialidad,
|
|
49
|
+
description: s.especialidad,
|
|
50
|
+
});
|
|
51
|
+
const mapped = {
|
|
52
|
+
specialties: response.data.specialties.map(mapSpeciality),
|
|
53
|
+
specialtiesER: response.data.specialties_er.map(mapSpeciality),
|
|
54
|
+
professionals: response.data.professionals.map((p) => ({
|
|
55
|
+
id: p.id_profesional,
|
|
56
|
+
fullName: p.denominacion,
|
|
57
|
+
clinicId: p.id_consultorio,
|
|
58
|
+
specialties: p.especialidades.map(mapSpeciality),
|
|
59
|
+
})),
|
|
60
|
+
};
|
|
61
|
+
return mapped;
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
return baseSdk;
|
|
65
|
+
};
|
|
66
|
+
exports.getBaseSdk = getBaseSdk;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export var __esModule: boolean;
|
|
2
|
+
export function getUserMethods(makeRequest: any, url: any, credentials: any): {
|
|
3
|
+
declareUser: (params_0?: {
|
|
4
|
+
user: any;
|
|
5
|
+
channel: any;
|
|
6
|
+
code: any;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
userId: any;
|
|
9
|
+
patientId: any;
|
|
10
|
+
userInfo: any;
|
|
11
|
+
askCode: any;
|
|
12
|
+
}>;
|
|
13
|
+
getUserId: (user?: any) => Promise<any>;
|
|
14
|
+
sendVerificationCode: (params?: any) => Promise<void>;
|
|
15
|
+
getUserInstance: (user?: any) => Promise<any>;
|
|
16
|
+
enroll: (params?: any) => Promise<void>;
|
|
17
|
+
getConverageInfo: (identificationValue?: any) => Promise<{
|
|
18
|
+
firstName: string | null;
|
|
19
|
+
lastName: string | null;
|
|
20
|
+
birthdate: Date;
|
|
21
|
+
gender: "m" | "f";
|
|
22
|
+
email: string | null;
|
|
23
|
+
identificationNumber: string;
|
|
24
|
+
plan: string | null;
|
|
25
|
+
financerId: number | null;
|
|
26
|
+
defaultAffiliationId: number | null;
|
|
27
|
+
credentialNumber: string | null;
|
|
28
|
+
financerPlanId: number | null;
|
|
29
|
+
brand: number | null;
|
|
30
|
+
holderIdentificationNumber: string | null;
|
|
31
|
+
copaymentValue: number | null;
|
|
32
|
+
mobilePhone: string | null;
|
|
33
|
+
company: string | null;
|
|
34
|
+
dischargeDate: Date | null;
|
|
35
|
+
leavingDate: Date | null;
|
|
36
|
+
identificacion_tributaria: string | null;
|
|
37
|
+
deregistrationDate: Date | null;
|
|
38
|
+
authorizationCode: string | null;
|
|
39
|
+
authorizationCodeExpiration: Date | null;
|
|
40
|
+
} | null>;
|
|
41
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUserMethods = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const validation_1 = require("../request/validation");
|
|
7
|
+
const schemas_1 = require("../schemas");
|
|
8
|
+
const userSdk_1 = require("../userSdk");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
|
+
const getUserMethods = (makeRequest, url, credentials) => {
|
|
11
|
+
const declareUser = async ({ user, channel, code, }) => {
|
|
12
|
+
const path = '/user';
|
|
13
|
+
const mappedUser = {
|
|
14
|
+
lastname: user.lastName,
|
|
15
|
+
firstname: user.firstName,
|
|
16
|
+
identification_type: utils_1.getIdetificationTypeId(user.identificationType),
|
|
17
|
+
identification_value: user.identificationValue,
|
|
18
|
+
birthdate: date_fns_1.format(user.birthdate, 'yyyy-MM-dd'),
|
|
19
|
+
gender: user.gender.toUpperCase(),
|
|
20
|
+
phone: user.phone,
|
|
21
|
+
email: user.email,
|
|
22
|
+
country_id: user.countryId,
|
|
23
|
+
};
|
|
24
|
+
const parsedChannel = channel ? parseInt(channel) : channel;
|
|
25
|
+
const response = await makeRequest('POST', path, {
|
|
26
|
+
user_data: mappedUser,
|
|
27
|
+
channel: parsedChannel,
|
|
28
|
+
code,
|
|
29
|
+
});
|
|
30
|
+
const mappedResponse = {
|
|
31
|
+
userId: response.data.user_id,
|
|
32
|
+
patientId: response.data.patient_id,
|
|
33
|
+
userInfo: response.data.user_info,
|
|
34
|
+
askCode: response.data.ask_code,
|
|
35
|
+
};
|
|
36
|
+
return mappedResponse;
|
|
37
|
+
};
|
|
38
|
+
const getUserId = async (user) => {
|
|
39
|
+
const path = '/user';
|
|
40
|
+
const mappedUser = {
|
|
41
|
+
lastname: user.lastName,
|
|
42
|
+
firstname: user.firstName,
|
|
43
|
+
identification_type: utils_1.getIdetificationTypeId(user.identificationType),
|
|
44
|
+
identification_value: user.identificationValue,
|
|
45
|
+
birthdate: date_fns_1.format(user.birthdate, 'yyyy-MM-dd'),
|
|
46
|
+
gender: user.gender.toUpperCase(),
|
|
47
|
+
phone: user.phone,
|
|
48
|
+
email: user.email,
|
|
49
|
+
country_id: user.countryId,
|
|
50
|
+
};
|
|
51
|
+
const response = await makeRequest('POST', path, {
|
|
52
|
+
user_data: mappedUser,
|
|
53
|
+
});
|
|
54
|
+
return response.data.user_id;
|
|
55
|
+
};
|
|
56
|
+
const sendVerificationCode = async (params) => {
|
|
57
|
+
const path = '/send-verification-code';
|
|
58
|
+
const mappedParams = {
|
|
59
|
+
identification_type: utils_1.getIdetificationTypeId(params.identificationType),
|
|
60
|
+
identification_value: params.identificationValue,
|
|
61
|
+
channel: parseInt(params.channel),
|
|
62
|
+
};
|
|
63
|
+
await makeRequest('POST', path, mappedParams);
|
|
64
|
+
};
|
|
65
|
+
const getUserInstance = async (user) => {
|
|
66
|
+
const userId = typeof user === 'number' ? user : await getUserId(user);
|
|
67
|
+
return userSdk_1.userSdk(url, credentials, userId);
|
|
68
|
+
};
|
|
69
|
+
const enroll = async (params) => {
|
|
70
|
+
const path = `/enrollment`;
|
|
71
|
+
const mappedUser = {
|
|
72
|
+
firstname: params.firstName,
|
|
73
|
+
lastname: params.lastName,
|
|
74
|
+
gender: params.gender.toUpperCase(),
|
|
75
|
+
identification_number: params.identificationNumber,
|
|
76
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
77
|
+
email: params.email,
|
|
78
|
+
plan: params.plan,
|
|
79
|
+
start_date: date_fns_1.format(params.startDate, 'yyyy-MM-dd'),
|
|
80
|
+
};
|
|
81
|
+
await makeRequest('POST', path, {
|
|
82
|
+
user_data: mappedUser,
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const getConverageInfo = async (identificationValue) => {
|
|
86
|
+
const path = `/info-coverage/${identificationValue}`;
|
|
87
|
+
const response = await makeRequest('GET', path);
|
|
88
|
+
const raw = response.data.info;
|
|
89
|
+
const mappedCoverageInfo = {
|
|
90
|
+
financerId: raw.id_financiador,
|
|
91
|
+
defaultAffiliationId: raw.id_afiliacion_default,
|
|
92
|
+
plan: raw.plan,
|
|
93
|
+
identificationNumber: raw.nro_documento,
|
|
94
|
+
credentialNumber: raw.nro_credencial,
|
|
95
|
+
lastName: raw.apellido,
|
|
96
|
+
firstName: raw.nombre,
|
|
97
|
+
birthdate: utils_1.parseDate(raw.fecha_nacimiento),
|
|
98
|
+
financerPlanId: raw.id_financiador_plan,
|
|
99
|
+
gender: raw.sexo.toLowerCase(),
|
|
100
|
+
brand: raw.brand,
|
|
101
|
+
holderIdentificationNumber: raw.nro_documento_titular,
|
|
102
|
+
copaymentValue: raw.valor_copago,
|
|
103
|
+
mobilePhone: raw.telefono_movil,
|
|
104
|
+
company: raw.empresa,
|
|
105
|
+
email: raw.email,
|
|
106
|
+
dischargeDate: raw.fecha_alta ? utils_1.parseDateTime(raw.fecha_alta) : null,
|
|
107
|
+
leavingDate: raw.fecha_baja ? utils_1.parseDateTime(raw.fecha_baja) : null,
|
|
108
|
+
identificacion_tributaria: raw.identificacion_tributaria,
|
|
109
|
+
deregistrationDate: raw.fecha_baja_padron
|
|
110
|
+
? utils_1.parseDateTime(raw.fecha_baja_padron)
|
|
111
|
+
: null,
|
|
112
|
+
authorizationCode: raw.codigo_autorizacion,
|
|
113
|
+
authorizationCodeExpiration: raw.codigo_autorizacion_vencimiento
|
|
114
|
+
? utils_1.parseDateTime(raw.codigo_autorizacion_vencimiento)
|
|
115
|
+
: null,
|
|
116
|
+
};
|
|
117
|
+
return mappedCoverageInfo;
|
|
118
|
+
};
|
|
119
|
+
return {
|
|
120
|
+
declareUser: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declareUserParams]), schemas_1.doc24Schemas.declareUserResponse, declareUser),
|
|
121
|
+
getUserId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.user]), zod_1.number(), getUserId),
|
|
122
|
+
sendVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendVerificationCodeParams]), zod_1.void(), sendVerificationCode),
|
|
123
|
+
getUserInstance: validation_1.validateFunction(zod_1.tuple([zod_1.union([schemas_1.doc24Schemas.user, zod_1.number()])]),
|
|
124
|
+
// TODO: validate?
|
|
125
|
+
zod_1.any(), getUserInstance),
|
|
126
|
+
enroll: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.enrollmentParams]), zod_1.void(), enroll),
|
|
127
|
+
getConverageInfo: validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.coverageInfo, getConverageInfo),
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
exports.getUserMethods = getUserMethods;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
export var __esModule: boolean;
|
|
2
|
+
export function doc24Sdk(params: any): Promise<{
|
|
3
|
+
getRequestHandler: (params: any) => Promise<import("./types").Doc24.Webhook.Handler>;
|
|
4
|
+
declareUser: (params: {
|
|
5
|
+
code?: string | undefined;
|
|
6
|
+
channel?: "1" | "2" | undefined;
|
|
7
|
+
user: {
|
|
8
|
+
firstName: string;
|
|
9
|
+
lastName: string;
|
|
10
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
11
|
+
identificationValue: string;
|
|
12
|
+
countryId: string;
|
|
13
|
+
birthdate: Date;
|
|
14
|
+
gender: "m" | "f";
|
|
15
|
+
phone: string;
|
|
16
|
+
email: string;
|
|
17
|
+
};
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
patientId: number | null;
|
|
20
|
+
userInfo: {
|
|
21
|
+
phone: string;
|
|
22
|
+
email: string;
|
|
23
|
+
};
|
|
24
|
+
askCode: boolean;
|
|
25
|
+
userId: number;
|
|
26
|
+
}>;
|
|
27
|
+
getUserId: (user: {
|
|
28
|
+
firstName: string;
|
|
29
|
+
lastName: string;
|
|
30
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
31
|
+
identificationValue: string;
|
|
32
|
+
countryId: string;
|
|
33
|
+
birthdate: Date;
|
|
34
|
+
gender: "m" | "f";
|
|
35
|
+
phone: string;
|
|
36
|
+
email: string;
|
|
37
|
+
}) => Promise<number>;
|
|
38
|
+
getUserInstance: (user: number | {
|
|
39
|
+
firstName: string;
|
|
40
|
+
lastName: string;
|
|
41
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
42
|
+
identificationValue: string;
|
|
43
|
+
countryId: string;
|
|
44
|
+
birthdate: Date;
|
|
45
|
+
gender: "m" | "f";
|
|
46
|
+
phone: string;
|
|
47
|
+
email: string;
|
|
48
|
+
}) => Promise<import("./types").Doc24.UserSdk>;
|
|
49
|
+
getProfessional: (professionalId: number) => Promise<{
|
|
50
|
+
firstName: string;
|
|
51
|
+
lastName: string;
|
|
52
|
+
birthdate: Date;
|
|
53
|
+
gender: "m" | "f";
|
|
54
|
+
phone: string | null;
|
|
55
|
+
email: string;
|
|
56
|
+
id: number;
|
|
57
|
+
logoUrl: string;
|
|
58
|
+
specialties: {
|
|
59
|
+
id: number;
|
|
60
|
+
description: string;
|
|
61
|
+
}[];
|
|
62
|
+
matriculation: {
|
|
63
|
+
number: string;
|
|
64
|
+
type: string;
|
|
65
|
+
}[];
|
|
66
|
+
degree: string;
|
|
67
|
+
languages: string[];
|
|
68
|
+
resume: {
|
|
69
|
+
link: string;
|
|
70
|
+
brief: string;
|
|
71
|
+
};
|
|
72
|
+
}>;
|
|
73
|
+
getAvailableScheduleClinics: () => Promise<{
|
|
74
|
+
specialties: {
|
|
75
|
+
id: number;
|
|
76
|
+
description: string;
|
|
77
|
+
}[];
|
|
78
|
+
specialtiesER: {
|
|
79
|
+
id: number;
|
|
80
|
+
description: string;
|
|
81
|
+
}[];
|
|
82
|
+
professionals: {
|
|
83
|
+
id: number;
|
|
84
|
+
fullName: string;
|
|
85
|
+
clinicId: number;
|
|
86
|
+
specialties: {
|
|
87
|
+
id: number;
|
|
88
|
+
description: string;
|
|
89
|
+
}[];
|
|
90
|
+
}[];
|
|
91
|
+
}>;
|
|
92
|
+
enroll: (params: {
|
|
93
|
+
firstName: string;
|
|
94
|
+
lastName: string;
|
|
95
|
+
birthdate: Date;
|
|
96
|
+
gender: "m" | "f";
|
|
97
|
+
email: string;
|
|
98
|
+
startDate: Date;
|
|
99
|
+
identificationNumber: string;
|
|
100
|
+
plan: string;
|
|
101
|
+
}) => Promise<void>;
|
|
102
|
+
getConverageInfo: (identificationValue: string) => Promise<{
|
|
103
|
+
firstName: string | null;
|
|
104
|
+
lastName: string | null;
|
|
105
|
+
birthdate: Date;
|
|
106
|
+
gender: "m" | "f";
|
|
107
|
+
email: string | null;
|
|
108
|
+
identificationNumber: string;
|
|
109
|
+
plan: string | null;
|
|
110
|
+
financerId: number | null;
|
|
111
|
+
defaultAffiliationId: number | null;
|
|
112
|
+
credentialNumber: string | null;
|
|
113
|
+
financerPlanId: number | null;
|
|
114
|
+
brand: number | null;
|
|
115
|
+
holderIdentificationNumber: string | null;
|
|
116
|
+
copaymentValue: number | null;
|
|
117
|
+
mobilePhone: string | null;
|
|
118
|
+
company: string | null;
|
|
119
|
+
dischargeDate: Date | null;
|
|
120
|
+
leavingDate: Date | null;
|
|
121
|
+
identificacion_tributaria: string | null;
|
|
122
|
+
deregistrationDate: Date | null;
|
|
123
|
+
authorizationCode: string | null;
|
|
124
|
+
authorizationCodeExpiration: Date | null;
|
|
125
|
+
} | null>;
|
|
126
|
+
sendVerificationCode: (params: {
|
|
127
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
128
|
+
identificationValue: string;
|
|
129
|
+
channel: "1" | "2";
|
|
130
|
+
}) => Promise<any>;
|
|
131
|
+
getDiagnosticaHistory: (patient: {
|
|
132
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
133
|
+
identificationValue: string;
|
|
134
|
+
gender: "m" | "f";
|
|
135
|
+
}, from: Date, to: Date) => Promise<{
|
|
136
|
+
date: Date;
|
|
137
|
+
location: string;
|
|
138
|
+
exams: string[];
|
|
139
|
+
deepLink: string;
|
|
140
|
+
}[]>;
|
|
141
|
+
getDiagnosticaDeepLink: (kiosk: string, user: {
|
|
142
|
+
firstName: string;
|
|
143
|
+
lastName: string;
|
|
144
|
+
identificationType: "dni";
|
|
145
|
+
identificationValue: string;
|
|
146
|
+
gender: "m" | "f";
|
|
147
|
+
phone: string;
|
|
148
|
+
email: string;
|
|
149
|
+
language: string;
|
|
150
|
+
birthday: Date;
|
|
151
|
+
}, patient: {
|
|
152
|
+
firstName: string;
|
|
153
|
+
lastName: string;
|
|
154
|
+
identificationType: "dni";
|
|
155
|
+
identificationValue: string;
|
|
156
|
+
gender: "m" | "f";
|
|
157
|
+
birthday: Date;
|
|
158
|
+
}) => Promise<{
|
|
159
|
+
forwardingRequired: true;
|
|
160
|
+
deepLink: string;
|
|
161
|
+
} | {
|
|
162
|
+
forwardingRequired: false;
|
|
163
|
+
}>;
|
|
164
|
+
getDiagnosticaAccess: (kiosk: string, user: {
|
|
165
|
+
firstName: string;
|
|
166
|
+
lastName: string;
|
|
167
|
+
identificationType: "dni";
|
|
168
|
+
identificationValue: string;
|
|
169
|
+
gender: "m" | "f";
|
|
170
|
+
phone: string;
|
|
171
|
+
email: string;
|
|
172
|
+
language: string;
|
|
173
|
+
birthday: Date;
|
|
174
|
+
}, patient: {
|
|
175
|
+
firstName: string;
|
|
176
|
+
lastName: string;
|
|
177
|
+
identificationType: "dni";
|
|
178
|
+
identificationValue: string;
|
|
179
|
+
gender: "m" | "f";
|
|
180
|
+
birthday: Date;
|
|
181
|
+
}) => Promise<void>;
|
|
182
|
+
}>;
|
package/lib/lib/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.doc24Sdk = void 0;
|
|
4
|
+
const webhook_1 = require("./webhook");
|
|
5
|
+
const baseSdk_1 = require("./baseSdk");
|
|
6
|
+
const request_1 = require("./request");
|
|
7
|
+
const doc24Sdk = async (params) => {
|
|
8
|
+
const baseSdk = await baseSdk_1.getBaseSdk(params.url, params.credentials);
|
|
9
|
+
const makeRequest = await request_1.getRequestFactory(params.url, params.credentials);
|
|
10
|
+
return {
|
|
11
|
+
...baseSdk,
|
|
12
|
+
getRequestHandler: async (params) => {
|
|
13
|
+
await makeRequest('PUT', '/webhook', {
|
|
14
|
+
url: params.baseAddress,
|
|
15
|
+
issuer: params.credentials.iss,
|
|
16
|
+
secret: params.credentials.key,
|
|
17
|
+
});
|
|
18
|
+
return webhook_1.getRequestHandler(params.credentials, baseSdk, params.eventHandlers);
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
exports.doc24Sdk = doc24Sdk;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export var __esModule: boolean;
|
|
2
|
+
export function getDiagnosticaMethods(makeRequest: any): {
|
|
3
|
+
getDiagnosticaHistory: (...params: any[]) => Promise<any>;
|
|
4
|
+
getDiagnosticaDeepLink: (...params: any[]) => Promise<any>;
|
|
5
|
+
getDiagnosticaAccess: (...params: any[]) => Promise<any>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDiagnosticaMethods = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const validation_1 = require("../request/validation");
|
|
7
|
+
const schemas_1 = require("../schemas");
|
|
8
|
+
const getDiagnosticaMethods = (makeRequest) => {
|
|
9
|
+
const getDiagnosticaHistory = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.diagnosticaPatientFilter, zod_1.date(), zod_1.date()]), schemas_1.doc24Schemas.diagnosticaHistoryAppointment.array(), async (patient, from, to) => {
|
|
10
|
+
const path = '/history-diagnostica';
|
|
11
|
+
const response = await makeRequest('POST', path, {
|
|
12
|
+
patient: {
|
|
13
|
+
gender: patient.gender,
|
|
14
|
+
id_type: patient.identificationType === 'ndi'
|
|
15
|
+
? 'DNI'
|
|
16
|
+
: patient.identificationType,
|
|
17
|
+
id_value: patient.identificationValue,
|
|
18
|
+
},
|
|
19
|
+
dateFrom: from.toISOString(),
|
|
20
|
+
dateTo: to.toISOString(),
|
|
21
|
+
});
|
|
22
|
+
const list = response.data.info;
|
|
23
|
+
return list.map((i) => ({
|
|
24
|
+
date: new Date(Date.parse(i.date)),
|
|
25
|
+
location: i.location,
|
|
26
|
+
exams: i.exams,
|
|
27
|
+
deepLink: i.deeplink,
|
|
28
|
+
}));
|
|
29
|
+
});
|
|
30
|
+
const getDiagnosticaDeepLink = validation_1.validateFunction(zod_1.tuple([
|
|
31
|
+
zod_1.string(),
|
|
32
|
+
schemas_1.doc24Schemas.diagnosticaUser,
|
|
33
|
+
schemas_1.doc24Schemas.diagnosticaPatient,
|
|
34
|
+
]), schemas_1.doc24Schemas.diagnosticaDeepLinkResponse, async (kiosk, user, patient) => {
|
|
35
|
+
const path = '/deeplink-diagnostica';
|
|
36
|
+
const response = await makeRequest('POST', path, {
|
|
37
|
+
kiosk,
|
|
38
|
+
user: mapUserData(user),
|
|
39
|
+
patient: mapPatientData(patient),
|
|
40
|
+
});
|
|
41
|
+
const data = response.data.info.data;
|
|
42
|
+
if (data.forwarding_required)
|
|
43
|
+
return { forwardingRequired: true, deepLink: data.deeplink };
|
|
44
|
+
return { forwardingRequired: false };
|
|
45
|
+
});
|
|
46
|
+
const getDiagnosticaAccess = validation_1.validateFunction(zod_1.tuple([
|
|
47
|
+
zod_1.string(),
|
|
48
|
+
schemas_1.doc24Schemas.diagnosticaUser,
|
|
49
|
+
schemas_1.doc24Schemas.diagnosticaPatient,
|
|
50
|
+
]), zod_1.void(), async (kiosk, user, patient) => {
|
|
51
|
+
const path = '/access-diagnostica';
|
|
52
|
+
await makeRequest('POST', path, {
|
|
53
|
+
kiosk,
|
|
54
|
+
user: mapUserData(user),
|
|
55
|
+
patient: mapPatientData(patient),
|
|
56
|
+
});
|
|
57
|
+
return;
|
|
58
|
+
});
|
|
59
|
+
return { getDiagnosticaHistory, getDiagnosticaDeepLink, getDiagnosticaAccess };
|
|
60
|
+
};
|
|
61
|
+
exports.getDiagnosticaMethods = getDiagnosticaMethods;
|
|
62
|
+
const mapPatientData = (patient) => {
|
|
63
|
+
return {
|
|
64
|
+
name: patient.firstName,
|
|
65
|
+
surname: patient.lastName,
|
|
66
|
+
birthday: date_fns_1.format(patient.birthday, 'yyyy-MM-dd'),
|
|
67
|
+
id_type: 'DNI',
|
|
68
|
+
id_value: patient.identificationValue,
|
|
69
|
+
gender: patient.gender.toLocaleUpperCase(),
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
const mapUserData = (user) => {
|
|
73
|
+
return {
|
|
74
|
+
...mapPatientData(user),
|
|
75
|
+
phone: user.phone,
|
|
76
|
+
email: user.email,
|
|
77
|
+
language: user.language,
|
|
78
|
+
};
|
|
79
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export var __esModule: boolean;
|
|
2
|
+
export function getBaseSdk(url: any, credentials: any): Promise<{
|
|
3
|
+
getProfessional: (...params: any[]) => Promise<any>;
|
|
4
|
+
getAvailableScheduleClinics: (...params: any[]) => Promise<any>;
|
|
5
|
+
declareUser: (params_0?: {
|
|
6
|
+
user: any;
|
|
7
|
+
channel: any;
|
|
8
|
+
code: any;
|
|
9
|
+
} | undefined) => Promise<{
|
|
10
|
+
userId: any;
|
|
11
|
+
patientId: any;
|
|
12
|
+
userInfo: any;
|
|
13
|
+
askCode: any;
|
|
14
|
+
}>;
|
|
15
|
+
getUserId: (user?: any) => Promise<any>;
|
|
16
|
+
sendVerificationCode: (params?: any) => Promise<void>;
|
|
17
|
+
getUserInstance: (user?: any) => Promise<any>;
|
|
18
|
+
enroll: (params?: any) => Promise<void>;
|
|
19
|
+
getConverageInfo: (identificationValue?: any) => Promise<{
|
|
20
|
+
firstName: string | null;
|
|
21
|
+
lastName: string | null;
|
|
22
|
+
birthdate: Date;
|
|
23
|
+
gender: "m" | "f";
|
|
24
|
+
email: string | null;
|
|
25
|
+
identificationNumber: string;
|
|
26
|
+
plan: string | null;
|
|
27
|
+
financerId: number | null;
|
|
28
|
+
defaultAffiliationId: number | null;
|
|
29
|
+
credentialNumber: string | null;
|
|
30
|
+
financerPlanId: number | null;
|
|
31
|
+
brand: number | null;
|
|
32
|
+
holderIdentificationNumber: string | null;
|
|
33
|
+
copaymentValue: number | null;
|
|
34
|
+
mobilePhone: string | null;
|
|
35
|
+
company: string | null;
|
|
36
|
+
dischargeDate: Date | null;
|
|
37
|
+
leavingDate: Date | null;
|
|
38
|
+
identificacion_tributaria: string | null;
|
|
39
|
+
deregistrationDate: Date | null;
|
|
40
|
+
authorizationCode: string | null;
|
|
41
|
+
authorizationCodeExpiration: Date | null;
|
|
42
|
+
} | null>;
|
|
43
|
+
getDiagnosticaHistory: (...params: any) => Promise<any>;
|
|
44
|
+
getDiagnosticaDeepLink: (...params: any) => Promise<{
|
|
45
|
+
forwardingRequired: true;
|
|
46
|
+
deepLink: string;
|
|
47
|
+
} | {
|
|
48
|
+
forwardingRequired: false;
|
|
49
|
+
}>;
|
|
50
|
+
getDiagnosticaAccess: (...params: any) => Promise<void>;
|
|
51
|
+
}>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBaseSdk = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const request_1 = require("../request");
|
|
6
|
+
const validation_1 = require("../request/validation");
|
|
7
|
+
const schemas_1 = require("../schemas");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const diagnostica_1 = require("./diagnostica");
|
|
10
|
+
const user_1 = require("./user");
|
|
11
|
+
const getBaseSdk = async (url, credentials) => {
|
|
12
|
+
const makeRequest = await request_1.getRequestFactory(url, credentials);
|
|
13
|
+
const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
|
|
14
|
+
const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
|
|
15
|
+
const baseSdk = {
|
|
16
|
+
...diagnosticaMethods,
|
|
17
|
+
...userMethods,
|
|
18
|
+
getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
|
|
19
|
+
const path = `/professional/${professionalId}`;
|
|
20
|
+
const response = await makeRequest('GET', path);
|
|
21
|
+
const raw = response.data;
|
|
22
|
+
return {
|
|
23
|
+
id: raw.professional_id,
|
|
24
|
+
firstName: raw.name,
|
|
25
|
+
lastName: raw.lastname,
|
|
26
|
+
birthdate: utils_1.parseDate(raw.birthdate),
|
|
27
|
+
gender: raw.gender.toLowerCase(),
|
|
28
|
+
email: raw.email,
|
|
29
|
+
phone: raw.phone,
|
|
30
|
+
logoUrl: raw.image,
|
|
31
|
+
matriculation: raw.matriculation,
|
|
32
|
+
specialties: raw.specialties.map((s) => ({
|
|
33
|
+
id: s.specialty_id,
|
|
34
|
+
description: s.specialty,
|
|
35
|
+
})),
|
|
36
|
+
degree: raw.degree,
|
|
37
|
+
languages: raw.languages.map((l) => l.languages),
|
|
38
|
+
resume: {
|
|
39
|
+
link: raw.resume_link,
|
|
40
|
+
brief: raw.resume_brief,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}),
|
|
44
|
+
getAvailableScheduleClinics: validation_1.validateFunction(zod_1.tuple([]), schemas_1.doc24Schemas.availableScheduleClinics, async () => {
|
|
45
|
+
const path = `/schedule/clinics`;
|
|
46
|
+
const response = await makeRequest('GET', path);
|
|
47
|
+
const mapSpeciality = (s) => ({
|
|
48
|
+
id: s.id_especialidad,
|
|
49
|
+
description: s.especialidad,
|
|
50
|
+
});
|
|
51
|
+
const mapped = {
|
|
52
|
+
specialties: response.data.specialties.map(mapSpeciality),
|
|
53
|
+
specialtiesER: response.data.specialties_er.map(mapSpeciality),
|
|
54
|
+
professionals: response.data.professionals.map((p) => ({
|
|
55
|
+
id: p.id_profesional,
|
|
56
|
+
fullName: p.denominacion,
|
|
57
|
+
clinicId: p.id_consultorio,
|
|
58
|
+
specialties: p.especialidades.map(mapSpeciality),
|
|
59
|
+
})),
|
|
60
|
+
};
|
|
61
|
+
return mapped;
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
return baseSdk;
|
|
65
|
+
};
|
|
66
|
+
exports.getBaseSdk = getBaseSdk;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var __esModule: boolean;
|
|
2
|
+
export function getUserMethods(makeRequest: any, url: any, credentials: any): {
|
|
3
|
+
declareUser: (...params: any[]) => Promise<any>;
|
|
4
|
+
getUserId: (...params: any[]) => Promise<any>;
|
|
5
|
+
sendVerificationCode: (...params: any[]) => Promise<any>;
|
|
6
|
+
getUserInstance: (...params: any[]) => Promise<any>;
|
|
7
|
+
enroll: (...params: any[]) => Promise<any>;
|
|
8
|
+
getConverageInfo: (...params: any[]) => Promise<any>;
|
|
9
|
+
};
|