@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.
Files changed (250) hide show
  1. package/lib/baseSdk/diagnostica.d.ts +6 -6
  2. package/lib/baseSdk/index.js +5 -1
  3. package/lib/baseSdk/user.d.ts +4 -51
  4. package/lib/baseSdk/user.js +25 -67
  5. package/lib/index.d.ts +16 -44
  6. package/lib/lib/baseSdk/diagnostica.d.ts +11 -0
  7. package/lib/lib/baseSdk/diagnostica.js +79 -0
  8. package/lib/lib/baseSdk/index.d.ts +161 -0
  9. package/lib/lib/baseSdk/index.js +66 -0
  10. package/lib/lib/baseSdk/user.d.ts +41 -0
  11. package/lib/lib/baseSdk/user.js +130 -0
  12. package/lib/lib/index.d.ts +182 -0
  13. package/lib/lib/index.js +22 -0
  14. package/lib/lib/lib/baseSdk/diagnostica.d.ts +6 -0
  15. package/lib/lib/lib/baseSdk/diagnostica.js +79 -0
  16. package/lib/lib/lib/baseSdk/index.d.ts +51 -0
  17. package/lib/lib/lib/baseSdk/index.js +66 -0
  18. package/lib/lib/lib/baseSdk/user.d.ts +9 -0
  19. package/lib/lib/lib/baseSdk/user.js +130 -0
  20. package/lib/lib/lib/index.d.ts +168 -0
  21. package/lib/lib/lib/index.js +22 -0
  22. package/lib/lib/lib/lib/baseSdk/diagnostica.d.ts +6 -0
  23. package/lib/lib/lib/lib/baseSdk/diagnostica.js +79 -0
  24. package/lib/lib/lib/lib/baseSdk/index.d.ts +14 -0
  25. package/lib/lib/lib/lib/baseSdk/index.js +66 -0
  26. package/lib/lib/lib/lib/baseSdk/user.d.ts +9 -0
  27. package/lib/lib/lib/lib/baseSdk/user.js +130 -0
  28. package/lib/lib/lib/lib/index.d.ts +58 -0
  29. package/lib/lib/lib/lib/index.js +22 -0
  30. package/lib/lib/lib/lib/request/index.d.ts +2 -0
  31. package/lib/lib/lib/lib/request/index.js +26 -0
  32. package/lib/lib/lib/lib/request/token.d.ts +2 -0
  33. package/lib/lib/lib/lib/request/token.js +34 -0
  34. package/lib/lib/lib/lib/request/validation.d.ts +10 -0
  35. package/lib/lib/lib/lib/request/validation.js +28 -0
  36. package/lib/lib/lib/lib/schemas.d.ts +1334 -0
  37. package/lib/lib/lib/lib/schemas.js +325 -0
  38. package/lib/lib/lib/lib/test.d.ts +1 -0
  39. package/lib/lib/lib/lib/test.js +55 -0
  40. package/lib/lib/lib/lib/types.d.ts +1 -0
  41. package/lib/lib/lib/lib/types.js +2 -0
  42. package/lib/lib/lib/lib/userSdk/chat.d.ts +9 -0
  43. package/lib/lib/lib/lib/userSdk/chat.js +98 -0
  44. package/lib/lib/lib/lib/userSdk/index.d.ts +24 -0
  45. package/lib/lib/lib/lib/userSdk/index.js +27 -0
  46. package/lib/lib/lib/lib/userSdk/patients.d.ts +5 -0
  47. package/lib/lib/lib/lib/userSdk/patients.js +55 -0
  48. package/lib/lib/lib/lib/userSdk/schedule.d.ts +7 -0
  49. package/lib/lib/lib/lib/userSdk/schedule.js +76 -0
  50. package/lib/lib/lib/lib/userSdk/specialties.d.ts +4 -0
  51. package/lib/lib/lib/lib/userSdk/specialties.js +19 -0
  52. package/lib/lib/lib/lib/userSdk/videoVisit.d.ts +10 -0
  53. package/lib/lib/lib/lib/userSdk/videoVisit.js +147 -0
  54. package/lib/lib/lib/lib/utils.d.ts +4 -0
  55. package/lib/lib/lib/lib/utils.js +19 -0
  56. package/lib/lib/lib/lib/webhook/index.d.ts +8 -0
  57. package/lib/lib/lib/lib/webhook/index.js +55 -0
  58. package/lib/lib/lib/lib/webhook/responses.d.ts +36 -0
  59. package/lib/lib/lib/lib/webhook/responses.js +42 -0
  60. package/lib/lib/lib/lib/webhook/token.d.ts +2 -0
  61. package/lib/lib/lib/lib/webhook/token.js +23 -0
  62. package/lib/lib/lib/request/index.d.ts +2 -0
  63. package/lib/lib/lib/request/index.js +26 -0
  64. package/lib/lib/lib/request/token.d.ts +2 -0
  65. package/lib/lib/lib/request/token.js +34 -0
  66. package/lib/lib/lib/request/validation.d.ts +10 -0
  67. package/lib/lib/lib/request/validation.js +28 -0
  68. package/lib/lib/lib/schemas.d.ts +1334 -0
  69. package/lib/lib/lib/schemas.js +325 -0
  70. package/lib/lib/lib/src/baseSdk/diagnostica.d.ts +6 -0
  71. package/lib/lib/lib/src/baseSdk/diagnostica.js +79 -0
  72. package/lib/lib/lib/src/baseSdk/index.d.ts +51 -0
  73. package/lib/lib/lib/src/baseSdk/index.js +66 -0
  74. package/lib/lib/lib/src/baseSdk/user.d.ts +9 -0
  75. package/lib/lib/lib/src/baseSdk/user.js +130 -0
  76. package/lib/lib/lib/src/index.d.ts +169 -0
  77. package/lib/lib/lib/src/index.js +22 -0
  78. package/lib/lib/lib/src/request/index.d.ts +2 -0
  79. package/lib/lib/lib/src/request/index.js +26 -0
  80. package/lib/lib/lib/src/request/token.d.ts +2 -0
  81. package/lib/lib/lib/src/request/token.js +34 -0
  82. package/lib/lib/lib/src/request/validation.d.ts +10 -0
  83. package/lib/lib/lib/src/request/validation.js +28 -0
  84. package/lib/lib/lib/src/schemas.d.ts +1340 -0
  85. package/lib/lib/lib/src/schemas.js +325 -0
  86. package/lib/lib/lib/src/types.d.ts +1 -0
  87. package/lib/lib/lib/src/types.js +2 -0
  88. package/lib/lib/lib/src/userSdk/chat.d.ts +9 -0
  89. package/lib/lib/lib/src/userSdk/chat.js +98 -0
  90. package/lib/lib/lib/src/userSdk/index.d.ts +102 -0
  91. package/lib/lib/lib/src/userSdk/index.js +27 -0
  92. package/lib/lib/lib/src/userSdk/patients.d.ts +5 -0
  93. package/lib/lib/lib/src/userSdk/patients.js +55 -0
  94. package/lib/lib/lib/src/userSdk/schedule.d.ts +7 -0
  95. package/lib/lib/lib/src/userSdk/schedule.js +76 -0
  96. package/lib/lib/lib/src/userSdk/specialties.d.ts +4 -0
  97. package/lib/lib/lib/src/userSdk/specialties.js +19 -0
  98. package/lib/lib/lib/src/userSdk/videoVisit.d.ts +10 -0
  99. package/lib/lib/lib/src/userSdk/videoVisit.js +147 -0
  100. package/lib/lib/lib/src/utils.d.ts +4 -0
  101. package/lib/lib/lib/src/utils.js +19 -0
  102. package/lib/lib/lib/src/webhook/index.d.ts +8 -0
  103. package/lib/lib/lib/src/webhook/index.js +55 -0
  104. package/lib/lib/lib/src/webhook/responses.d.ts +36 -0
  105. package/lib/lib/lib/src/webhook/responses.js +42 -0
  106. package/lib/lib/lib/src/webhook/token.d.ts +2 -0
  107. package/lib/lib/lib/src/webhook/token.js +23 -0
  108. package/lib/lib/lib/test.d.ts +1 -0
  109. package/lib/lib/lib/test.js +55 -0
  110. package/lib/lib/lib/types.d.ts +1 -0
  111. package/lib/lib/lib/types.js +2 -0
  112. package/lib/lib/lib/userSdk/chat.d.ts +9 -0
  113. package/lib/lib/lib/userSdk/chat.js +98 -0
  114. package/lib/lib/lib/userSdk/index.d.ts +102 -0
  115. package/lib/lib/lib/userSdk/index.js +27 -0
  116. package/lib/lib/lib/userSdk/patients.d.ts +5 -0
  117. package/lib/lib/lib/userSdk/patients.js +55 -0
  118. package/lib/lib/lib/userSdk/schedule.d.ts +7 -0
  119. package/lib/lib/lib/userSdk/schedule.js +76 -0
  120. package/lib/lib/lib/userSdk/specialties.d.ts +4 -0
  121. package/lib/lib/lib/userSdk/specialties.js +19 -0
  122. package/lib/lib/lib/userSdk/videoVisit.d.ts +10 -0
  123. package/lib/lib/lib/userSdk/videoVisit.js +147 -0
  124. package/lib/lib/lib/utils.d.ts +4 -0
  125. package/lib/lib/lib/utils.js +19 -0
  126. package/lib/lib/lib/webhook/index.d.ts +8 -0
  127. package/lib/lib/lib/webhook/index.js +55 -0
  128. package/lib/lib/lib/webhook/responses.d.ts +36 -0
  129. package/lib/lib/lib/webhook/responses.js +42 -0
  130. package/lib/lib/lib/webhook/token.d.ts +2 -0
  131. package/lib/lib/lib/webhook/token.js +23 -0
  132. package/lib/lib/request/index.d.ts +2 -0
  133. package/lib/lib/request/index.js +26 -0
  134. package/lib/lib/request/token.d.ts +2 -0
  135. package/lib/lib/request/token.js +34 -0
  136. package/lib/lib/request/validation.d.ts +10 -0
  137. package/lib/lib/request/validation.js +28 -0
  138. package/lib/lib/schemas.d.ts +1334 -0
  139. package/lib/lib/schemas.js +325 -0
  140. package/lib/lib/src/baseSdk/diagnostica.d.ts +11 -0
  141. package/lib/lib/src/baseSdk/diagnostica.js +79 -0
  142. package/lib/lib/src/baseSdk/index.d.ts +162 -0
  143. package/lib/lib/src/baseSdk/index.js +66 -0
  144. package/lib/lib/src/baseSdk/user.d.ts +41 -0
  145. package/lib/lib/src/baseSdk/user.js +130 -0
  146. package/lib/lib/src/index.d.ts +183 -0
  147. package/lib/lib/src/index.js +22 -0
  148. package/lib/lib/src/request/index.d.ts +2 -0
  149. package/lib/lib/src/request/index.js +26 -0
  150. package/lib/lib/src/request/token.d.ts +2 -0
  151. package/lib/lib/src/request/token.js +34 -0
  152. package/lib/lib/src/request/validation.d.ts +10 -0
  153. package/lib/lib/src/request/validation.js +28 -0
  154. package/lib/lib/src/schemas.d.ts +1340 -0
  155. package/lib/lib/src/schemas.js +325 -0
  156. package/lib/lib/src/types.d.ts +1 -0
  157. package/lib/lib/src/types.js +2 -0
  158. package/lib/lib/src/userSdk/chat.d.ts +9 -0
  159. package/lib/lib/src/userSdk/chat.js +98 -0
  160. package/lib/lib/src/userSdk/index.d.ts +241 -0
  161. package/lib/lib/src/userSdk/index.js +27 -0
  162. package/lib/lib/src/userSdk/patients.d.ts +13 -0
  163. package/lib/lib/src/userSdk/patients.js +55 -0
  164. package/lib/lib/src/userSdk/schedule.d.ts +15 -0
  165. package/lib/lib/src/userSdk/schedule.js +76 -0
  166. package/lib/lib/src/userSdk/specialties.d.ts +4 -0
  167. package/lib/lib/src/userSdk/specialties.js +19 -0
  168. package/lib/lib/src/userSdk/videoVisit.d.ts +72 -0
  169. package/lib/lib/src/userSdk/videoVisit.js +147 -0
  170. package/lib/lib/src/utils.d.ts +4 -0
  171. package/lib/lib/src/utils.js +19 -0
  172. package/lib/lib/src/webhook/index.d.ts +8 -0
  173. package/lib/lib/src/webhook/index.js +55 -0
  174. package/lib/lib/src/webhook/responses.d.ts +36 -0
  175. package/lib/lib/src/webhook/responses.js +42 -0
  176. package/lib/lib/src/webhook/token.d.ts +2 -0
  177. package/lib/lib/src/webhook/token.js +23 -0
  178. package/lib/lib/test.d.ts +1 -0
  179. package/lib/lib/test.js +55 -0
  180. package/lib/lib/types.d.ts +1 -0
  181. package/lib/lib/types.js +2 -0
  182. package/lib/lib/userSdk/chat.d.ts +9 -0
  183. package/lib/lib/userSdk/chat.js +98 -0
  184. package/lib/lib/userSdk/index.d.ts +240 -0
  185. package/lib/lib/userSdk/index.js +27 -0
  186. package/lib/lib/userSdk/patients.d.ts +13 -0
  187. package/lib/lib/userSdk/patients.js +55 -0
  188. package/lib/lib/userSdk/schedule.d.ts +15 -0
  189. package/lib/lib/userSdk/schedule.js +76 -0
  190. package/lib/lib/userSdk/specialties.d.ts +4 -0
  191. package/lib/lib/userSdk/specialties.js +19 -0
  192. package/lib/lib/userSdk/videoVisit.d.ts +72 -0
  193. package/lib/lib/userSdk/videoVisit.js +147 -0
  194. package/lib/lib/utils.d.ts +4 -0
  195. package/lib/lib/utils.js +19 -0
  196. package/lib/lib/webhook/index.d.ts +8 -0
  197. package/lib/lib/webhook/index.js +55 -0
  198. package/lib/lib/webhook/responses.d.ts +36 -0
  199. package/lib/lib/webhook/responses.js +42 -0
  200. package/lib/lib/webhook/token.d.ts +2 -0
  201. package/lib/lib/webhook/token.js +23 -0
  202. package/lib/schemas.d.ts +30 -220
  203. package/lib/schemas.js +2 -33
  204. package/lib/src/baseSdk/diagnostica.d.ts +54 -0
  205. package/lib/src/baseSdk/diagnostica.js +79 -0
  206. package/lib/src/baseSdk/index.d.ts +2 -0
  207. package/lib/src/baseSdk/index.js +66 -0
  208. package/lib/src/baseSdk/user.d.ts +89 -0
  209. package/lib/src/baseSdk/user.js +130 -0
  210. package/lib/src/index.d.ts +188 -0
  211. package/lib/src/index.js +22 -0
  212. package/lib/src/request/index.d.ts +3 -0
  213. package/lib/src/request/index.js +26 -0
  214. package/lib/src/request/token.d.ts +2 -0
  215. package/lib/src/request/token.js +34 -0
  216. package/lib/src/request/validation.d.ts +10 -0
  217. package/lib/src/request/validation.js +28 -0
  218. package/lib/src/schemas.d.ts +1311 -0
  219. package/lib/src/schemas.js +325 -0
  220. package/lib/src/types.d.ts +124 -0
  221. package/lib/src/types.js +2 -0
  222. package/lib/src/userSdk/chat.d.ts +57 -0
  223. package/lib/src/userSdk/chat.js +98 -0
  224. package/lib/src/userSdk/index.d.ts +2 -0
  225. package/lib/src/userSdk/index.js +27 -0
  226. package/lib/src/userSdk/patients.d.ts +33 -0
  227. package/lib/src/userSdk/patients.js +55 -0
  228. package/lib/src/userSdk/schedule.d.ts +44 -0
  229. package/lib/src/userSdk/schedule.js +76 -0
  230. package/lib/src/userSdk/specialties.d.ts +7 -0
  231. package/lib/src/userSdk/specialties.js +19 -0
  232. package/lib/src/userSdk/videoVisit.d.ts +111 -0
  233. package/lib/src/userSdk/videoVisit.js +147 -0
  234. package/lib/src/utils.d.ts +4 -0
  235. package/lib/src/utils.js +19 -0
  236. package/lib/src/webhook/index.d.ts +2 -0
  237. package/lib/src/webhook/index.js +55 -0
  238. package/lib/src/webhook/responses.d.ts +35 -0
  239. package/lib/src/webhook/responses.js +42 -0
  240. package/lib/src/webhook/token.d.ts +2 -0
  241. package/lib/src/webhook/token.js +23 -0
  242. package/lib/test.js +1 -36
  243. package/lib/types.d.ts +2 -10
  244. package/lib/userSdk/chat.d.ts +1 -1
  245. package/lib/userSdk/patients.d.ts +2 -22
  246. package/lib/userSdk/patients.js +6 -34
  247. package/lib/userSdk/videoVisit.d.ts +2 -2
  248. package/lib/utils.d.ts +1 -1
  249. package/lib/utils.js +3 -3
  250. package/package.json +1 -1
package/lib/test.js CHANGED
@@ -10,43 +10,8 @@ const test = async () => {
10
10
  key: '33Ypv5jQ1VTr1KcOImdBhPnoRDqmPlYR3JWbrlUim9U=',
11
11
  },
12
12
  });
13
- const userSdk = await baseSdk.getUserInstance(15135);
14
- let res = await userSdk.declarePatient({
15
- patient: {
16
- firstName: 'Rafael Elias',
17
- lastName: 'Mian',
18
- identificationType: 'ndi',
19
- identificationValue: '37970350',
20
- countryId: 'AR',
21
- birthdate: new Date('1996-07-03'),
22
- gender: 'm',
23
- },
24
- });
25
- // let res = await baseSdk.declareUser({
26
- // user: {
27
- // firstName: 'Rafael Elias',
28
- // lastName: 'Mian',
29
- // identificationType: 'ndi',
30
- // identificationValue: '37970350',
31
- // countryId: 'AR',
32
- // birthdate: new Date('1996-07-03'),
33
- // gender: 'm',
34
- // email: 'rafaelmian35@gmail.com',
35
- // phone: '+5493764203061',
36
- // },
37
- // // channel: '1',
38
- // // code: '370356',
39
- // });
13
+ const res = await baseSdk.getAvailableScheduleClinics();
40
14
  console.log(res);
41
- // await new Promise((resolve) => setTimeout(resolve, 2000));
42
- // if (!res.ask_code) return res.userId;
43
- // await baseSdk.sendVerificationCode({
44
- // identificationType: 'ndi',
45
- // identificationValue: '37970350',
46
- // channel: '1',
47
- // });
48
- // console.log(res);
49
- return;
50
15
  }
51
16
  catch (e) {
52
17
  console.log(e);
package/lib/types.d.ts CHANGED
@@ -30,27 +30,19 @@ export declare namespace Doc24 {
30
30
  type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
31
31
  type DiagnosticaHistoryAppointment = TypeOf<typeof doc24Schemas.diagnosticaHistoryAppointment>;
32
32
  type DiagnosticaDeepLinkResponse = TypeOf<typeof doc24Schemas.diagnosticaDeepLinkResponse>;
33
- type SendVerificationCodeParams = TypeOf<typeof doc24Schemas.sendVerificationCodeParams>;
34
- type DeclareUserParams = TypeOf<typeof doc24Schemas.declareUserParams>;
35
- type DeclareUserResponse = TypeOf<typeof doc24Schemas.declareUserResponse>;
36
- type DeclarePatientParams = TypeOf<typeof doc24Schemas.declarePatientParams>;
37
- type DeclarePatientResponse = TypeOf<typeof doc24Schemas.declarePatientResponse>;
38
33
  type BaseSdk = {
39
- declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
40
- getUserId: (user: User) => Promise<number>;
34
+ declareUser: (user: User) => Promise<number>;
41
35
  getUserInstance: (user: User | number) => Promise<UserSdk>;
42
36
  getProfessional: (professionalId: number) => Promise<Professional>;
43
37
  getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
44
38
  enroll: (params: EnrollmentParams) => Promise<void>;
45
39
  getConverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
46
- sendVerificationCode: (params: SendVerificationCodeParams) => Promise<any>;
47
40
  getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
48
41
  getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
49
42
  getDiagnosticaAccess: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<void>;
50
43
  };
51
44
  type UserSdk = {
52
- declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
53
- getPatientId: (patient: Patient) => Promise<number>;
45
+ declarePatient: (patient: Patient) => Promise<number>;
54
46
  getSpecialties: (mode: SpecialtyMode, language: string) => Promise<Specialty[]>;
55
47
  getScheduleDates: (patientId: number, filter?: ScheduleAvailabilityFilter) => Promise<Date[]>;
56
48
  getSchedule: (patientId: number, specialtyId: number, filter?: ScheduleFilter) => Promise<AvailableAppointment[]>;
@@ -24,9 +24,9 @@ export declare const getChatMethods: (makeRequest: RequestMaker) => {
24
24
  getPatientChats: (patientId: number) => Promise<{
25
25
  id: number;
26
26
  patient: {
27
+ id: number;
27
28
  firstName: string;
28
29
  lastName: string;
29
- id: number;
30
30
  };
31
31
  professional: {
32
32
  id: number;
@@ -1,32 +1,12 @@
1
1
  import { RequestMaker } from '../request';
2
2
  export declare const getPatientMethods: (makeRequest: RequestMaker) => {
3
- declarePatient: (params: {
4
- code?: string | undefined;
5
- channel?: "1" | "2" | undefined;
6
- patient: {
7
- firstName: string;
8
- lastName: string;
9
- identificationType: "ndi" | "passport" | "credential";
10
- identificationValue: string;
11
- countryId: string;
12
- birthdate: Date;
13
- gender: "m" | "f";
14
- };
15
- }) => Promise<{
16
- patientId: number | null;
17
- userInfo: {
18
- phone: string;
19
- email: string;
20
- };
21
- askCode: boolean;
22
- }>;
23
- getPatientId: (patient: {
3
+ declarePatient: (patient: {
24
4
  firstName: string;
25
5
  lastName: string;
26
6
  identificationType: "ndi" | "passport" | "credential";
27
7
  identificationValue: string;
8
+ gender: "m" | "f";
28
9
  countryId: string;
29
10
  birthdate: Date;
30
- gender: "m" | "f";
31
11
  }) => Promise<number>;
32
12
  };
@@ -7,49 +7,21 @@ const validation_1 = require("../request/validation");
7
7
  const schemas_1 = require("../schemas");
8
8
  const utils_1 = require("../utils");
9
9
  const getPatientMethods = (makeRequest) => {
10
- const declarePatient = async ({ patient, channel, code, }) => {
11
- const path = '/patient';
10
+ const declarePatient = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), async (patient) => {
12
11
  const mappedPatient = {
13
12
  lastname: patient.lastName,
14
13
  firstname: patient.firstName,
15
- identification_type: utils_1.getIdetificationTypeId(patient.identificationType),
14
+ identification_type: utils_1.getIndetificationTypeId(patient.identificationType),
16
15
  identification_value: patient.identificationValue,
17
16
  birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
18
17
  gender: patient.gender.toUpperCase(),
19
18
  country_id: patient.countryId,
20
19
  };
21
- const parsedChannel = channel ? parseInt(channel) : channel;
22
- const response = await makeRequest('POST', path, {
20
+ const response = await makeRequest('POST', '/patient', {
23
21
  user_data: mappedPatient,
24
- channel: parsedChannel,
25
- code,
26
22
  });
27
- const mappedResponse = {
28
- patientId: response.data.patient_id,
29
- userInfo: response.data.user_info,
30
- askCode: response.data.ask_code,
31
- };
32
- return mappedResponse;
33
- };
34
- const getPatientId = async (patient) => {
35
- const path = '/patient';
36
- const mappedPatient = {
37
- lastname: patient.lastName,
38
- firstname: patient.firstName,
39
- identification_type: utils_1.getIdetificationTypeId(patient.identificationType),
40
- identification_value: patient.identificationValue,
41
- birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
42
- gender: patient.gender.toUpperCase(),
43
- country_id: patient.countryId,
44
- };
45
- const response = await makeRequest('POST', path, {
46
- user_data: mappedPatient,
47
- });
48
- return response.data.user_id;
49
- };
50
- return {
51
- declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
52
- getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
53
- };
23
+ return response.data.patient_id;
24
+ });
25
+ return { declarePatient };
54
26
  };
55
27
  exports.getPatientMethods = getPatientMethods;
@@ -32,9 +32,9 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
32
32
  patientId: number;
33
33
  creationDate: Date;
34
34
  user: {
35
+ id: number;
35
36
  phone: string | null;
36
37
  email: string | null;
37
- id: number;
38
38
  };
39
39
  vcToken: string;
40
40
  }>;
@@ -53,9 +53,9 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
53
53
  patientId: number;
54
54
  creationDate: Date;
55
55
  user: {
56
+ id: number;
56
57
  phone: string | null;
57
58
  email: string | null;
58
- id: number;
59
59
  };
60
60
  vcToken: string;
61
61
  }[]>;
package/lib/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { Doc24 } from '.';
2
2
  export declare const parseDate: (str: string) => Date;
3
3
  export declare const parseDateTime: (str: string) => Date;
4
- export declare const getIdetificationTypeId: (type: Doc24.IdentificationType) => 6 | 5 | 999;
4
+ export declare const getIndetificationTypeId: (type: Doc24.IdentificationType) => 6 | 5 | 999;
package/lib/utils.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getIdetificationTypeId = exports.parseDateTime = exports.parseDate = void 0;
3
+ exports.getIndetificationTypeId = exports.parseDateTime = exports.parseDate = void 0;
4
4
  const date_fns_1 = require("date-fns");
5
5
  const timeZone = '-03';
6
6
  const parseDate = (str) => exports.parseDateTime(`${str} 00:00:00`);
7
7
  exports.parseDate = parseDate;
8
8
  const parseDateTime = (str) => date_fns_1.parse(`${str} ${timeZone}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
9
9
  exports.parseDateTime = parseDateTime;
10
- const getIdetificationTypeId = (type) => {
10
+ const getIndetificationTypeId = (type) => {
11
11
  if (type === 'ndi')
12
12
  return 6;
13
13
  if (type === 'passport')
@@ -16,4 +16,4 @@ const getIdetificationTypeId = (type) => {
16
16
  return 999;
17
17
  throw new Error('Invalid identificationType');
18
18
  };
19
- exports.getIdetificationTypeId = getIdetificationTypeId;
19
+ exports.getIndetificationTypeId = getIndetificationTypeId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "1.1.1",
3
+ "version": "1.3.0",
4
4
  "publishConfig": {
5
5
  "tag": "1.x"
6
6
  },