From 8e47f46459166d80da04ae3862abae2c8085a6a8 Mon Sep 17 00:00:00 2001 From: tulioperdigao <116309232+tulioperdigao@users.noreply.github.com> Date: Thu, 6 Nov 2025 12:42:04 -0300 Subject: [PATCH] =?UTF-8?q?FEAT:=20Fun=C3=A7=C3=A3o=20que=20fecha=20um=20t?= =?UTF-8?q?icket=20no=20Hubsoft.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/hubsoftService.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/services/hubsoftService.js b/src/services/hubsoftService.js index e8d0186..933dde3 100644 --- a/src/services/hubsoftService.js +++ b/src/services/hubsoftService.js @@ -55,6 +55,30 @@ const updateAtendimentoStatus = async (id_atendimento, newStatus) => { } }; -module.exports = { - updateAtendimentoStatus +const closeAtendimento = async (id_atendimento, closingMessage) => { + try { + const token = await getAuthToken(); + + const response = await axios.put(`${apiConfig.hubsoft.atendimentosUrl}${id_atendimento}`, { + "fechar_atendimento": true, + "parametros_fechamento": { + "descricao_fechamento": closingMessage + } + }, + { + headers: { + 'Authorization': `Bearer ${token}`, + 'Content-Type': 'application/json' + } + }); + return response.data; + } catch (error) { + logError(`Erro ao fechar atendimento ID ${id_atendimento}:`, error.response ? error.response.data : error.message); + throw error; + } +}; + +module.exports = { + updateAtendimentoStatus, + closeAtendimento };