UNPKG

giganet_conecta

Version:

Aplicação com o fim de facilitar conexões com APi's e Banco de Dados (MySql & Mongo).

47 lines (41 loc) 1.58 kB
const request = require("request"); // InserirOrdemServicoIxc module.exports = async function (id_cliente, id_assundo, id_login, mensagem) { try { const token = process.env.conecta_api_ixc_soft_token; try { const options = { method: "POST", url: "https://giganet-rs.com.br/webservice/v1/su_oss_chamado", headers: { "content-type": "application/json", Authorization: "Basic " + Buffer.from(token).toString("base64"), }, // Passado a ordem de serviço modificado body: JSON.stringify({ id: '', id_filial: '1', status: 'A', id_cliente: id_cliente, id_assunto: id_assundo, setor: '2', prioridade: 'N', mensagem: mensagem, id_login: id_login, origem_endereco: 'L' }), }; return await new Promise((resolve, reject) => { request(options, (error, response, body) => { if (error) { reject(error); } else { resolve(body); } }); }); } catch (error) { } } catch (error) { throw `Erro em inserir uma ordem de serviço no IXC Soft: ${error}`; } }