@integraciones_doc24/sdk 0.33.1 → 0.34.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.
@@ -14,12 +14,12 @@ export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
14
14
  language: string;
15
15
  firstName: string;
16
16
  lastName: string;
17
- phone: string;
18
- email: string;
19
17
  birthday: Date;
20
18
  identificationType: "dni";
21
19
  identificationValue: string;
22
20
  gender: "m" | "f";
21
+ phone: string;
22
+ email: string;
23
23
  }, patient: {
24
24
  firstName: string;
25
25
  lastName: string;
@@ -37,12 +37,12 @@ export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
37
37
  language: string;
38
38
  firstName: string;
39
39
  lastName: string;
40
- phone: string;
41
- email: string;
42
40
  birthday: Date;
43
41
  identificationType: "dni";
44
42
  identificationValue: string;
45
43
  gender: "m" | "f";
44
+ phone: string;
45
+ email: string;
46
46
  }, patient: {
47
47
  firstName: string;
48
48
  lastName: string;
@@ -38,7 +38,7 @@ const getDiagnosticaMethods = (makeRequest) => {
38
38
  user: mapUserData(user),
39
39
  patient: mapPatientData(patient),
40
40
  });
41
- const data = response.data.data.info.data;
41
+ const data = response.data.info.data;
42
42
  if (data.forwarding_required)
43
43
  return { forwardingRequired: true, deepLink: data.deeplink };
44
44
  return { forwardingRequired: false };
@@ -1,46 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getBaseSdk = void 0;
4
- const date_fns_1 = require("date-fns");
5
4
  const zod_1 = require("zod");
6
5
  const request_1 = require("../request");
7
6
  const validation_1 = require("../request/validation");
8
7
  const schemas_1 = require("../schemas");
9
- const userSdk_1 = require("../userSdk");
10
8
  const utils_1 = require("../utils");
11
9
  const diagnostica_1 = require("./diagnostica");
12
- const external_1 = require("./external");
10
+ const user_1 = require("./user");
13
11
  const getBaseSdk = async (url, credentials) => {
14
12
  const makeRequest = await request_1.getRequestFactory(url, credentials);
15
- const getUserId = async (user) => {
16
- const mappedUser = {
17
- lastname: user.lastName,
18
- firstname: user.firstName,
19
- identification_type: utils_1.getIndetificationTypeId(user.identificationType),
20
- identification_value: user.identificationValue,
21
- birthdate: date_fns_1.format(user.birthdate, 'yyyy-MM-dd'),
22
- gender: user.gender.toUpperCase(),
23
- phone: user.phone,
24
- email: user.email,
25
- country_id: user.countryId,
26
- };
27
- const response = await makeRequest('POST', '/user', {
28
- user_data: mappedUser,
29
- });
30
- return response.data.user_id;
31
- };
32
13
  const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
33
- const externalMethods = external_1.getExternalMethods(makeRequest);
14
+ const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
34
15
  const baseSdk = {
35
16
  ...diagnosticaMethods,
36
- ...externalMethods,
37
- declareUser: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.user]), zod_1.number(), getUserId),
38
- getUserInstance: validation_1.validateFunction(zod_1.tuple([zod_1.union([schemas_1.doc24Schemas.user, zod_1.number()])]),
39
- // TODO: validate?
40
- zod_1.any(), async (user) => {
41
- const userId = typeof user === 'number' ? user : await getUserId(user);
42
- return userSdk_1.userSdk(url, credentials, userId);
43
- }),
17
+ ...userMethods,
44
18
  getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
45
19
  const path = `/professional/${professionalId}`;
46
20
  const response = await makeRequest('GET', path);
@@ -85,21 +59,6 @@ const getBaseSdk = async (url, credentials) => {
85
59
  };
86
60
  return mapped;
87
61
  }),
88
- enroll: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.enrollmentParams]), zod_1.void(), async (params) => {
89
- const path = `/enrollment`;
90
- await makeRequest('POST', path, {
91
- user_data: {
92
- firstname: params.firstName,
93
- lastname: params.lastName,
94
- gender: params.gender.toUpperCase(),
95
- identification_number: params.identificationNumber,
96
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
97
- email: params.email,
98
- plan: params.plan,
99
- start_date: date_fns_1.format(params.startDate, 'yyyy-MM-dd'),
100
- },
101
- });
102
- }),
103
62
  };
104
63
  return baseSdk;
105
64
  };
@@ -0,0 +1,41 @@
1
+ import { RequestMaker } from '../request';
2
+ import { Doc24 } from '../types';
3
+ export declare const getUserMethods: (makeRequest: RequestMaker, url: string, credentials: Doc24.SdkCredentials) => {
4
+ declareUser: (user: {
5
+ firstName: string;
6
+ lastName: string;
7
+ identificationType: "ndi" | "passport" | "credential";
8
+ identificationValue: string;
9
+ gender: "m" | "f";
10
+ phone: string;
11
+ email: string;
12
+ countryId: string;
13
+ birthdate: Date;
14
+ }) => Promise<any>;
15
+ getUserInstance: (...params: any) => Promise<any>;
16
+ enroll: (...params: any) => Promise<void>;
17
+ getConverageInfo: (identificationValue: string) => Promise<{
18
+ nro_credencial?: any;
19
+ valor_copago?: any;
20
+ telefono_movil?: any;
21
+ empresa?: any;
22
+ fecha_baja?: any;
23
+ identificacion_tributaria?: any;
24
+ fecha_baja_padron?: any;
25
+ codigo_autorizacion?: any;
26
+ codigo_autorizacion_vencimiento?: any;
27
+ email: string | null;
28
+ plan: string | null;
29
+ id_afiliacion_default: number;
30
+ id_financiador: number | null;
31
+ nro_documento: string;
32
+ apellido: string;
33
+ nombre: string;
34
+ fecha_nacimiento: string;
35
+ id_financiador_plan: number | null;
36
+ sexo: "M" | "F";
37
+ brand: number;
38
+ nro_documento_titular: string;
39
+ fecha_alta: string;
40
+ } | null>;
41
+ };
@@ -0,0 +1,59 @@
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 getUserId = async (user) => {
12
+ const mappedUser = {
13
+ lastname: user.lastName,
14
+ firstname: user.firstName,
15
+ identification_type: utils_1.getIndetificationTypeId(user.identificationType),
16
+ identification_value: user.identificationValue,
17
+ birthdate: date_fns_1.format(user.birthdate, 'yyyy-MM-dd'),
18
+ gender: user.gender.toUpperCase(),
19
+ phone: user.phone,
20
+ email: user.email,
21
+ country_id: user.countryId,
22
+ };
23
+ const response = await makeRequest('POST', '/user', {
24
+ user_data: mappedUser,
25
+ });
26
+ return response.data.user_id;
27
+ };
28
+ const getConverageInfo = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.coverageInfo, async (identificationValue) => {
29
+ const path = `/info-coverage/${identificationValue}`;
30
+ const response = await makeRequest('GET', path);
31
+ return response.data.info;
32
+ });
33
+ return {
34
+ declareUser: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.user]), zod_1.number(), getUserId),
35
+ getUserInstance: validation_1.validateFunction(zod_1.tuple([zod_1.union([schemas_1.doc24Schemas.user, zod_1.number()])]),
36
+ // TODO: validate?
37
+ zod_1.any(), async (user) => {
38
+ const userId = typeof user === 'number' ? user : await getUserId(user);
39
+ return userSdk_1.userSdk(url, credentials, userId);
40
+ }),
41
+ enroll: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.enrollmentParams]), zod_1.void(), async (params) => {
42
+ const path = `/enrollment`;
43
+ await makeRequest('POST', path, {
44
+ user_data: {
45
+ firstname: params.firstName,
46
+ lastname: params.lastName,
47
+ gender: params.gender.toUpperCase(),
48
+ identification_number: params.identificationNumber,
49
+ birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
50
+ email: params.email,
51
+ plan: params.plan,
52
+ start_date: date_fns_1.format(params.startDate, 'yyyy-MM-dd'),
53
+ },
54
+ });
55
+ }),
56
+ getConverageInfo,
57
+ };
58
+ };
59
+ exports.getUserMethods = getUserMethods;
package/lib/index.d.ts CHANGED
@@ -8,34 +8,34 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
8
8
  declareUser: (user: {
9
9
  firstName: string;
10
10
  lastName: string;
11
- phone: string;
12
- birthdate: Date;
13
- email: string;
14
11
  identificationType: "ndi" | "passport" | "credential";
15
12
  identificationValue: string;
16
13
  gender: "m" | "f";
14
+ phone: string;
15
+ email: string;
17
16
  countryId: string;
17
+ birthdate: Date;
18
18
  }) => Promise<number>;
19
19
  getUserInstance: (user: number | {
20
20
  firstName: string;
21
21
  lastName: string;
22
- phone: string;
23
- birthdate: Date;
24
- email: string;
25
22
  identificationType: "ndi" | "passport" | "credential";
26
23
  identificationValue: string;
27
24
  gender: "m" | "f";
25
+ phone: string;
26
+ email: string;
28
27
  countryId: string;
28
+ birthdate: Date;
29
29
  }) => Promise<Doc24.UserSdk>;
30
30
  getProfessional: (professionalId: number) => Promise<{
31
31
  id: number;
32
32
  logoUrl: string;
33
33
  firstName: string;
34
34
  lastName: string;
35
+ gender: "m" | "f";
35
36
  phone: string | null;
36
- birthdate: Date;
37
37
  email: string;
38
- gender: "m" | "f";
38
+ birthdate: Date;
39
39
  specialties: {
40
40
  id: number;
41
41
  description: string;
@@ -69,13 +69,37 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
69
69
  enroll: (params: {
70
70
  firstName: string;
71
71
  lastName: string;
72
- identificationNumber: string;
73
- birthdate: Date;
74
- email: string;
75
72
  gender: "m" | "f";
73
+ email: string;
74
+ birthdate: Date;
76
75
  startDate: Date;
76
+ identificationNumber: string;
77
77
  plan: string;
78
78
  }) => Promise<void>;
79
+ getConverageInfo: (identificationValue: string) => Promise<{
80
+ nro_credencial?: any;
81
+ valor_copago?: any;
82
+ telefono_movil?: any;
83
+ empresa?: any;
84
+ fecha_baja?: any;
85
+ identificacion_tributaria?: any;
86
+ fecha_baja_padron?: any;
87
+ codigo_autorizacion?: any;
88
+ codigo_autorizacion_vencimiento?: any;
89
+ email: string | null;
90
+ plan: string | null;
91
+ id_afiliacion_default: number;
92
+ id_financiador: number | null;
93
+ nro_documento: string;
94
+ apellido: string;
95
+ nombre: string;
96
+ fecha_nacimiento: string;
97
+ id_financiador_plan: number | null;
98
+ sexo: "M" | "F";
99
+ brand: number;
100
+ nro_documento_titular: string;
101
+ fecha_alta: string;
102
+ } | null>;
79
103
  getDiagnosticaHistory: (patient: {
80
104
  identificationType: "ndi" | "passport" | "credential";
81
105
  identificationValue: string;
@@ -90,12 +114,12 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
90
114
  language: string;
91
115
  firstName: string;
92
116
  lastName: string;
93
- phone: string;
94
- email: string;
95
117
  birthday: Date;
96
118
  identificationType: "dni";
97
119
  identificationValue: string;
98
120
  gender: "m" | "f";
121
+ phone: string;
122
+ email: string;
99
123
  }, patient: {
100
124
  firstName: string;
101
125
  lastName: string;
@@ -113,12 +137,12 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
113
137
  language: string;
114
138
  firstName: string;
115
139
  lastName: string;
116
- phone: string;
117
- email: string;
118
140
  birthday: Date;
119
141
  identificationType: "dni";
120
142
  identificationValue: string;
121
143
  gender: "m" | "f";
144
+ phone: string;
145
+ email: string;
122
146
  }, patient: {
123
147
  firstName: string;
124
148
  lastName: string;
@@ -127,30 +151,5 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
127
151
  identificationValue: string;
128
152
  gender: "m" | "f";
129
153
  }) => Promise<void>;
130
- externalLogin: (user: string, password: string) => Promise<{
131
- firstName: string;
132
- lastName: string;
133
- phone: string;
134
- identificationNumber: string;
135
- email: string;
136
- birthday: Date;
137
- gender: "m" | "f";
138
- countryId: string;
139
- }>;
140
- preExternalEnroll: (params: {
141
- phone: string;
142
- identificationNumber: string;
143
- birthdate: Date;
144
- email: string;
145
- }) => Promise<void>;
146
- externalEnroll: (params: {
147
- phone: string;
148
- identificationNumber: string;
149
- birthdate: Date;
150
- email: string;
151
- password: string;
152
- emailCode: string;
153
- phoneCode: string;
154
- }) => Promise<void>;
155
154
  }>;
156
155
  export type { Doc24 } from './types';
package/lib/schemas.d.ts CHANGED
@@ -49,23 +49,23 @@ export declare const doc24Schemas: {
49
49
  }>, "strip", import("zod").ZodTypeAny, {
50
50
  firstName: string;
51
51
  lastName: string;
52
- phone: string;
53
- birthdate: Date;
54
- email: string;
55
52
  identificationType: "ndi" | "passport" | "credential";
56
53
  identificationValue: string;
57
54
  gender: "m" | "f";
55
+ phone: string;
56
+ email: string;
58
57
  countryId: string;
58
+ birthdate: Date;
59
59
  }, {
60
60
  firstName: string;
61
61
  lastName: string;
62
- phone: string;
63
- birthdate: Date;
64
- email: string;
65
62
  identificationType: "ndi" | "passport" | "credential";
66
63
  identificationValue: string;
67
64
  gender: "m" | "f";
65
+ phone: string;
66
+ email: string;
68
67
  countryId: string;
68
+ birthdate: Date;
69
69
  }>;
70
70
  patient: import("zod").ZodObject<{
71
71
  firstName: import("zod").ZodString;
@@ -78,19 +78,19 @@ export declare const doc24Schemas: {
78
78
  }, "strip", import("zod").ZodTypeAny, {
79
79
  firstName: string;
80
80
  lastName: string;
81
- birthdate: Date;
82
81
  identificationType: "ndi" | "passport" | "credential";
83
82
  identificationValue: string;
84
83
  gender: "m" | "f";
85
84
  countryId: string;
85
+ birthdate: Date;
86
86
  }, {
87
87
  firstName: string;
88
88
  lastName: string;
89
- birthdate: Date;
90
89
  identificationType: "ndi" | "passport" | "credential";
91
90
  identificationValue: string;
92
91
  gender: "m" | "f";
93
92
  countryId: string;
93
+ birthdate: Date;
94
94
  }>;
95
95
  specialtyMode: import("zod").ZodEnum<["appointment", "chat", "instant"]>;
96
96
  specialty: import("zod").ZodObject<{
@@ -657,10 +657,10 @@ export declare const doc24Schemas: {
657
657
  logoUrl: string;
658
658
  firstName: string;
659
659
  lastName: string;
660
+ gender: "m" | "f";
660
661
  phone: string | null;
661
- birthdate: Date;
662
662
  email: string;
663
- gender: "m" | "f";
663
+ birthdate: Date;
664
664
  specialties: {
665
665
  id: number;
666
666
  description: string;
@@ -680,10 +680,10 @@ export declare const doc24Schemas: {
680
680
  logoUrl: string;
681
681
  firstName: string;
682
682
  lastName: string;
683
+ gender: "m" | "f";
683
684
  phone: string | null;
684
- birthdate: Date;
685
685
  email: string;
686
- gender: "m" | "f";
686
+ birthdate: Date;
687
687
  specialties: {
688
688
  id: number;
689
689
  description: string;
@@ -909,91 +909,21 @@ export declare const doc24Schemas: {
909
909
  }, "strip", import("zod").ZodTypeAny, {
910
910
  firstName: string;
911
911
  lastName: string;
912
- identificationNumber: string;
913
- birthdate: Date;
914
- email: string;
915
912
  gender: "m" | "f";
916
- startDate: Date;
917
- plan: string;
918
- }, {
919
- firstName: string;
920
- lastName: string;
921
- identificationNumber: string;
922
- birthdate: Date;
923
913
  email: string;
924
- gender: "m" | "f";
914
+ birthdate: Date;
925
915
  startDate: Date;
926
- plan: string;
927
- }>;
928
- externalLoginResponse: import("zod").ZodObject<{
929
- firstName: import("zod").ZodString;
930
- lastName: import("zod").ZodString;
931
- countryId: import("zod").ZodString;
932
- birthday: import("zod").ZodDate;
933
- identificationNumber: import("zod").ZodString;
934
- gender: import("zod").ZodEnum<["m", "f"]>;
935
- email: import("zod").ZodString;
936
- phone: import("zod").ZodString;
937
- }, "strip", import("zod").ZodTypeAny, {
938
- firstName: string;
939
- lastName: string;
940
- phone: string;
941
916
  identificationNumber: string;
942
- email: string;
943
- birthday: Date;
944
- gender: "m" | "f";
945
- countryId: string;
917
+ plan: string;
946
918
  }, {
947
919
  firstName: string;
948
920
  lastName: string;
949
- phone: string;
950
- identificationNumber: string;
951
- email: string;
952
- birthday: Date;
953
921
  gender: "m" | "f";
954
- countryId: string;
955
- }>;
956
- preExternalEnrollmentParams: import("zod").ZodObject<{
957
- phone: import("zod").ZodString;
958
- identificationNumber: import("zod").ZodString;
959
- birthdate: import("zod").ZodDate;
960
- email: import("zod").ZodString;
961
- }, "strip", import("zod").ZodTypeAny, {
962
- phone: string;
963
- identificationNumber: string;
964
- birthdate: Date;
965
922
  email: string;
966
- }, {
967
- phone: string;
968
- identificationNumber: string;
969
- birthdate: Date;
970
- email: string;
971
- }>;
972
- externalEnrollmentParams: import("zod").ZodObject<import("zod").extendShape<{
973
- phone: import("zod").ZodString;
974
- identificationNumber: import("zod").ZodString;
975
- birthdate: import("zod").ZodDate;
976
- email: import("zod").ZodString;
977
- }, {
978
- password: import("zod").ZodString;
979
- emailCode: import("zod").ZodString;
980
- phoneCode: import("zod").ZodString;
981
- }>, "strip", import("zod").ZodTypeAny, {
982
- phone: string;
983
- identificationNumber: string;
984
923
  birthdate: Date;
985
- email: string;
986
- password: string;
987
- emailCode: string;
988
- phoneCode: string;
989
- }, {
990
- phone: string;
924
+ startDate: Date;
991
925
  identificationNumber: string;
992
- birthdate: Date;
993
- email: string;
994
- password: string;
995
- emailCode: string;
996
- phoneCode: string;
926
+ plan: string;
997
927
  }>;
998
928
  diagnosticaPatientFilter: import("zod").ZodObject<{
999
929
  gender: import("zod").ZodEnum<["m", "f"]>;
@@ -1039,22 +969,22 @@ export declare const doc24Schemas: {
1039
969
  language: string;
1040
970
  firstName: string;
1041
971
  lastName: string;
1042
- phone: string;
1043
- email: string;
1044
972
  birthday: Date;
1045
973
  identificationType: "dni";
1046
974
  identificationValue: string;
1047
975
  gender: "m" | "f";
976
+ phone: string;
977
+ email: string;
1048
978
  }, {
1049
979
  language: string;
1050
980
  firstName: string;
1051
981
  lastName: string;
1052
- phone: string;
1053
- email: string;
1054
982
  birthday: Date;
1055
983
  identificationType: "dni";
1056
984
  identificationValue: string;
1057
985
  gender: "m" | "f";
986
+ phone: string;
987
+ email: string;
1058
988
  }>;
1059
989
  diagnosticaPatient: import("zod").ZodObject<{
1060
990
  firstName: import("zod").ZodString;
@@ -1094,4 +1024,74 @@ export declare const doc24Schemas: {
1094
1024
  }, {
1095
1025
  forwardingRequired: false;
1096
1026
  }>]>;
1027
+ coverageInfo: import("zod").ZodNullable<import("zod").ZodObject<{
1028
+ id_afiliacion_default: import("zod").ZodNumber;
1029
+ id_financiador: import("zod").ZodNullable<import("zod").ZodNumber>;
1030
+ plan: import("zod").ZodNullable<import("zod").ZodString>;
1031
+ nro_documento: import("zod").ZodString;
1032
+ nro_credencial: import("zod").ZodNullable<import("zod").ZodAny>;
1033
+ apellido: import("zod").ZodString;
1034
+ nombre: import("zod").ZodString;
1035
+ fecha_nacimiento: import("zod").ZodString;
1036
+ id_financiador_plan: import("zod").ZodNullable<import("zod").ZodNumber>;
1037
+ sexo: import("zod").ZodEnum<["M", "F"]>;
1038
+ brand: import("zod").ZodNumber;
1039
+ nro_documento_titular: import("zod").ZodString;
1040
+ valor_copago: import("zod").ZodNullable<import("zod").ZodAny>;
1041
+ telefono_movil: import("zod").ZodNullable<import("zod").ZodAny>;
1042
+ empresa: import("zod").ZodNullable<import("zod").ZodAny>;
1043
+ email: import("zod").ZodNullable<import("zod").ZodString>;
1044
+ fecha_alta: import("zod").ZodString;
1045
+ fecha_baja: import("zod").ZodNullable<import("zod").ZodAny>;
1046
+ identificacion_tributaria: import("zod").ZodNullable<import("zod").ZodAny>;
1047
+ fecha_baja_padron: import("zod").ZodNullable<import("zod").ZodAny>;
1048
+ codigo_autorizacion: import("zod").ZodNullable<import("zod").ZodAny>;
1049
+ codigo_autorizacion_vencimiento: import("zod").ZodNullable<import("zod").ZodAny>;
1050
+ }, "strip", import("zod").ZodTypeAny, {
1051
+ nro_credencial?: any;
1052
+ valor_copago?: any;
1053
+ telefono_movil?: any;
1054
+ empresa?: any;
1055
+ fecha_baja?: any;
1056
+ identificacion_tributaria?: any;
1057
+ fecha_baja_padron?: any;
1058
+ codigo_autorizacion?: any;
1059
+ codigo_autorizacion_vencimiento?: any;
1060
+ email: string | null;
1061
+ plan: string | null;
1062
+ id_afiliacion_default: number;
1063
+ id_financiador: number | null;
1064
+ nro_documento: string;
1065
+ apellido: string;
1066
+ nombre: string;
1067
+ fecha_nacimiento: string;
1068
+ id_financiador_plan: number | null;
1069
+ sexo: "M" | "F";
1070
+ brand: number;
1071
+ nro_documento_titular: string;
1072
+ fecha_alta: string;
1073
+ }, {
1074
+ nro_credencial?: any;
1075
+ valor_copago?: any;
1076
+ telefono_movil?: any;
1077
+ empresa?: any;
1078
+ fecha_baja?: any;
1079
+ identificacion_tributaria?: any;
1080
+ fecha_baja_padron?: any;
1081
+ codigo_autorizacion?: any;
1082
+ codigo_autorizacion_vencimiento?: any;
1083
+ email: string | null;
1084
+ plan: string | null;
1085
+ id_afiliacion_default: number;
1086
+ id_financiador: number | null;
1087
+ nro_documento: string;
1088
+ apellido: string;
1089
+ nombre: string;
1090
+ fecha_nacimiento: string;
1091
+ id_financiador_plan: number | null;
1092
+ sexo: "M" | "F";
1093
+ brand: number;
1094
+ nro_documento_titular: string;
1095
+ fecha_alta: string;
1096
+ }>>;
1097
1097
  };
package/lib/schemas.js CHANGED
@@ -124,27 +124,6 @@ const enrollmentParams = zod_1.object({
124
124
  plan: zod_1.string(),
125
125
  startDate: zod_1.date(),
126
126
  });
127
- const externalLoginResponse = zod_1.object({
128
- firstName: zod_1.string(),
129
- lastName: zod_1.string(),
130
- countryId: zod_1.string(),
131
- birthday: zod_1.date(),
132
- identificationNumber: zod_1.string(),
133
- gender,
134
- email: zod_1.string().email(),
135
- phone: zod_1.string(),
136
- });
137
- const preExternalEnrollmentParams = zod_1.object({
138
- phone: zod_1.string(),
139
- identificationNumber: zod_1.string(),
140
- birthdate: zod_1.date(),
141
- email: zod_1.string().email(),
142
- });
143
- const externalEnrollmentParams = preExternalEnrollmentParams.merge(zod_1.object({
144
- password: zod_1.string(),
145
- emailCode: zod_1.string(),
146
- phoneCode: zod_1.string(),
147
- }));
148
127
  const diagnosticaHistoryAppointment = zod_1.object({
149
128
  date: zod_1.date(),
150
129
  location: zod_1.string(),
@@ -168,6 +147,30 @@ const diagnosticaDeepLinkResponse = zod_1.object({
168
147
  forwardingRequired: zod_1.literal(true),
169
148
  deepLink: zod_1.string().url(),
170
149
  }).or(zod_1.object({ forwardingRequired: zod_1.literal(false) }));
150
+ const coverageInfo = zod_1.object({
151
+ id_afiliacion_default: zod_1.number(),
152
+ id_financiador: zod_1.number().nullable(),
153
+ plan: zod_1.string().nullable(),
154
+ nro_documento: zod_1.string(),
155
+ nro_credencial: zod_1.any().nullable(),
156
+ apellido: zod_1.string(),
157
+ nombre: zod_1.string(),
158
+ fecha_nacimiento: zod_1.string(),
159
+ id_financiador_plan: zod_1.number().nullable(),
160
+ sexo: zod_1.enum(['M', 'F']),
161
+ brand: zod_1.number(),
162
+ nro_documento_titular: zod_1.string(),
163
+ valor_copago: zod_1.any().nullable(),
164
+ telefono_movil: zod_1.any().nullable(),
165
+ empresa: zod_1.any().nullable(),
166
+ email: zod_1.string().email().nullable(),
167
+ fecha_alta: zod_1.string(),
168
+ fecha_baja: zod_1.any().nullable(),
169
+ identificacion_tributaria: zod_1.any().nullable(),
170
+ fecha_baja_padron: zod_1.any().nullable(),
171
+ codigo_autorizacion: zod_1.any().nullable(),
172
+ codigo_autorizacion_vencimiento: zod_1.any().nullable(),
173
+ }).nullable();
171
174
  exports.doc24Schemas = {
172
175
  identificationType,
173
176
  sdkCredentials,
@@ -277,9 +280,6 @@ exports.doc24Schemas = {
277
280
  chatDetails,
278
281
  chatPost,
279
282
  enrollmentParams,
280
- externalLoginResponse,
281
- preExternalEnrollmentParams,
282
- externalEnrollmentParams,
283
283
  diagnosticaPatientFilter: zod_1.object({
284
284
  gender,
285
285
  identificationType,
@@ -289,4 +289,5 @@ exports.doc24Schemas = {
289
289
  diagnosticaUser,
290
290
  diagnosticaPatient,
291
291
  diagnosticaDeepLinkResponse,
292
+ coverageInfo,
292
293
  };
package/lib/test.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/lib/test.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const _1 = require(".");
4
+ const test = async () => {
5
+ const baseSdk = await _1.doc24Sdk({
6
+ url: 'https://tapi.doc24.com.ar/ws/sdk',
7
+ credentials: {
8
+ iss: 'wehealthy',
9
+ key: '33Ypv5jQ1VTr1KcOImdBhPnoRDqmPlYR3JWbrlUim9U=',
10
+ },
11
+ });
12
+ await baseSdk.getConverageInfo('37970350');
13
+ };
14
+ test();
package/lib/types.d.ts CHANGED
@@ -24,9 +24,7 @@ export declare namespace Doc24 {
24
24
  type ChatDetails = TypeOf<typeof doc24Schemas.chatDetails>;
25
25
  type ChatPost = TypeOf<typeof doc24Schemas.chatPost>;
26
26
  type EnrollmentParams = TypeOf<typeof doc24Schemas.enrollmentParams>;
27
- type ExternalLoginResponse = TypeOf<typeof doc24Schemas.externalLoginResponse>;
28
- type PreExternalEnrollmentParams = TypeOf<typeof doc24Schemas.preExternalEnrollmentParams>;
29
- type ExternalEnrollmentParams = TypeOf<typeof doc24Schemas.externalEnrollmentParams>;
27
+ type CoverageInfo = TypeOf<typeof doc24Schemas.coverageInfo>;
30
28
  type DiagnosticaPatientFilter = TypeOf<typeof doc24Schemas.diagnosticaPatientFilter>;
31
29
  type DiagnosticaUser = TypeOf<typeof doc24Schemas.diagnosticaUser>;
32
30
  type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
@@ -38,12 +36,10 @@ export declare namespace Doc24 {
38
36
  getProfessional: (professionalId: number) => Promise<Professional>;
39
37
  getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
40
38
  enroll: (params: EnrollmentParams) => Promise<void>;
39
+ getConverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
41
40
  getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
42
41
  getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
43
42
  getDiagnosticaAccess: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<void>;
44
- externalLogin: (user: string, password: string) => Promise<ExternalLoginResponse>;
45
- preExternalEnroll: (params: PreExternalEnrollmentParams) => Promise<void>;
46
- externalEnroll: (params: ExternalEnrollmentParams) => Promise<void>;
47
43
  };
48
44
  type UserSdk = {
49
45
  declarePatient: (patient: Patient) => Promise<number>;
@@ -3,10 +3,10 @@ export declare const getPatientMethods: (makeRequest: RequestMaker) => {
3
3
  declarePatient: (patient: {
4
4
  firstName: string;
5
5
  lastName: string;
6
- birthdate: Date;
7
6
  identificationType: "ndi" | "passport" | "credential";
8
7
  identificationValue: string;
9
8
  gender: "m" | "f";
10
9
  countryId: string;
10
+ birthdate: Date;
11
11
  }) => Promise<number>;
12
12
  };
@@ -0,0 +1,6 @@
1
+ import { RequestMaker } from '../request';
2
+ export declare const getSarasaMethods: (_makeRequest: RequestMaker) => {
3
+ getSarasa: (userId: string) => Promise<{
4
+ id: string;
5
+ }>;
6
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSarasaMethods = void 0;
4
+ const zod_1 = require("zod");
5
+ const validation_1 = require("../request/validation");
6
+ const schemas_1 = require("../schemas");
7
+ const getSarasaMethods = (_makeRequest) => {
8
+ const getSarasa = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.sarasa, async (userId) => {
9
+ return { id: userId };
10
+ });
11
+ return { getSarasa };
12
+ };
13
+ exports.getSarasaMethods = getSarasaMethods;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "0.33.1",
3
+ "version": "0.34.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {