Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
node_crisp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
web
node_crisp
Commits
cb2c0abf
Commit
cb2c0abf
authored
Sep 03, 2021
by
Gabriel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementa flujo para reserva espontanea con casos de error
parent
bbb9589f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
21 deletions
+36
-21
ips_turnos_bajo_demanda.js
handlers/ips_turnos_bajo_demanda.js
+36
-21
No files found.
handlers/ips_turnos_bajo_demanda.js
View file @
cb2c0abf
...
@@ -7,7 +7,6 @@ const config = require('config');
...
@@ -7,7 +7,6 @@ const config = require('config');
const
LINK_CONDICIONES_DE_USO
=
'https://www.integrandosalud.com/es-ar/ip-condiciones-de-uso/'
;
const
LINK_CONDICIONES_DE_USO
=
'https://www.integrandosalud.com/es-ar/ip-condiciones-de-uso/'
;
const
ID_AGENDA_IPS
=
config
.
get
(
'idAgendaIPS'
);
const
ID_AGENDA_IPS
=
config
.
get
(
'idAgendaIPS'
);
const
ID_DOMINIO_IPS
=
config
.
get
(
'idDominioIPS'
);
const
ID_DOMINIO_IPS
=
config
.
get
(
'idDominioIPS'
);
let
ID_PERSONA_FEDERADA
;
const
SI
=
'SI'
;
const
SI
=
'SI'
;
const
NO
=
'NO'
;
const
NO
=
'NO'
;
...
@@ -122,16 +121,27 @@ module.exports =
...
@@ -122,16 +121,27 @@ module.exports =
},
},
resp_correo
:
async
function
(
message
,
userData
,
website_id
,
session_id
){
resp_correo
:
async
function
(
message
,
userData
,
website_id
,
session_id
){
userData
[
CORREO
]
=
message
.
content
;
userData
[
CORREO
]
=
message
.
content
;
let
federarResp
=
await
is
.
federarUsuario
(
userData
[
TIPO_DOCUMENTO
],
userData
[
NUMERO_DOCUMENTO
],
userData
[
FECHA_NACIMIENTO
],
userData
[
SEXO
]);
let
existeUsuario
=
await
is
.
existeUsuario
(
userData
[
TIPO_DOCUMENTO
],
userData
[
NUMERO_DOCUMENTO
],
userData
[
FECHA_NACIMIENTO
],
userData
[
SEXO
]);
if
(
!
federarResp
.
success
){
if
(
existeUsuario
.
existe
){
//Error al federar
if
(
existeUsuario
.
id_persona_federada
!==
null
){
await
crisp
.
sendTextMessage
(
website_id
,
session_id
,
'Uno de los datos ingresados es inválido'
);
await
this
.
crearTurnoBajoDemanda
(
ID_AGENDA_IPS
,
existeUsuario
.
id_persona_federada
,
message
,
userData
,
website_id
,
session_id
);
await
crisp
.
sendTextMessage
(
website_id
,
session_id
,
'Intentemos nuevamente'
);
await
limpiarDatos
(
message
,
userData
,
website_id
,
session_id
);
await
this
.
ask_tipo_documento
(
message
,
userData
,
website_id
,
session_id
);
}
}
else
{
else
{
let
turnoDemandaResp
=
await
is
.
crearTurnoBajoDemanda
(
ID_AGENDA_IPS
,
ID_PERSONA_FEDERADA
);
let
federarUsuario
=
await
is
.
federarUsuario
(
userData
[
TIPO_DOCUMENTO
],
userData
[
NUMERO_DOCUMENTO
],
fechaArgToFechaUsa
(
userData
[
FECHA_NACIMIENTO
]),
userData
[
SEXO
],
userData
[
CORREO
],
userData
[
TELEFONO
],
ID_DOMINIO_IPS
);
if
(
federarUsuario
.
id_persona_federada
!==
null
){
await
this
.
crearTurnoBajoDemanda
(
ID_AGENDA_IPS
,
federarUsuario
.
id_persona_federada
,
message
,
userData
,
website_id
,
session_id
)
}
else
{
await
this
.
errorDatosInvalidos
(
message
,
userData
,
website_id
,
session_id
);
}
}
}
else
{
await
this
.
errorDatosInvalidos
(
message
,
userData
,
website_id
,
session_id
);
}
},
crearTurnoBajoDemanda
:
async
function
(
idAgenda
,
idPersonaFederada
,
message
,
userData
,
website_id
,
session_id
){
let
turnoDemandaResp
=
await
is
.
crearTurnoBajoDemanda
(
idAgenda
,
idPersonaFederada
);
if
(
!
turnoDemandaResp
.
success
){
if
(
!
turnoDemandaResp
.
success
){
//Error al crear turno
//Error al crear turno
await
crisp
.
sendTextMessage
(
website_id
,
session_id
,
'Disculpame, en este momento no puedo contactarte con un profesional'
);
await
crisp
.
sendTextMessage
(
website_id
,
session_id
,
'Disculpame, en este momento no puedo contactarte con un profesional'
);
...
@@ -144,6 +154,11 @@ module.exports =
...
@@ -144,6 +154,11 @@ module.exports =
await
crisp
.
sendTextMessage
(
website_id
,
session_id
,
`[Iniciar consulta](
${
turnoDemandaResp
.
link_vc
}
)`
);
await
crisp
.
sendTextMessage
(
website_id
,
session_id
,
`[Iniciar consulta](
${
turnoDemandaResp
.
link_vc
}
)`
);
await
limpiarDatos
(
message
,
userData
,
website_id
,
session_id
);
await
limpiarDatos
(
message
,
userData
,
website_id
,
session_id
);
}
}
}
},
errorDatosInvalidos
:
async
function
(
message
,
userData
,
website_id
,
session_id
){
await
crisp
.
sendTextMessage
(
website_id
,
session_id
,
'Uno de los datos ingresados es inválido'
);
await
crisp
.
sendTextMessage
(
website_id
,
session_id
,
'Intentemos nuevamente'
);
await
limpiarDatos
(
message
,
userData
,
website_id
,
session_id
);
await
this
.
ask_tipo_documento
(
message
,
userData
,
website_id
,
session_id
);
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment