chore: Added companyId 12928 to ignore automatic ticket creation
parent
f601dbb699
commit
3e204da937
|
@ -119,8 +119,11 @@ const callJournaling = async (req, res) => {
|
|||
console.log('update-answer')
|
||||
|
||||
// Referente a cliente a gabriel, pois os tickets estao sendo abertos diretamente em um botao do hitphone
|
||||
// if (companyId != "14223")
|
||||
if (companyId != "12928") {
|
||||
console.log(`################## CRIAÇÃO AUTOMATICA DE TICKET COMPANY ID ${companyId} ##################`)
|
||||
await ticketCRM(companyId, crmPhone, crmAgent, crmFirstName)
|
||||
}
|
||||
|
||||
|
||||
const resp = await redirectContactLinkCRM(companyId, crmPhone, crmAgent, crmFirstName)
|
||||
return res.status(StatusCodes.OK).json({ contact: resp })
|
||||
|
@ -375,9 +378,17 @@ const createTicket = async (req, res) => {
|
|||
|
||||
let { companyId, crmPhone } = req.body
|
||||
|
||||
mustContainProperties(req, ['companyId', 'crmPhone'])
|
||||
mustContainProperties(req, ['companyId', 'crmPhone'])
|
||||
|
||||
const crmTicketLinks = await ticketCRM(companyId, crmPhone)
|
||||
const crmTicketLinks = await ticketCRM(companyId, crmPhone).catch(function (error) {
|
||||
|
||||
console.error(`Error on create ticket: companyID ${companyId} | crmPhone: ${crmPhone}`)
|
||||
console.error(error?.response?.data)
|
||||
console.error(error?.response?.status)
|
||||
console.error(error?.response?.headers)
|
||||
|
||||
throw new Error(`Error on create ticket: companyID ${companyId} | crmPhone: ${crmPhone}`)
|
||||
})
|
||||
|
||||
return res.status(StatusCodes.OK).json({ crmTicketLinks })
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ const sendEventTicketCreatedToSocket = require('./sendEventTicketCreatedToSocket
|
|||
const journalingRequest = require('./journalingRequest')
|
||||
|
||||
|
||||
async function ticketCRM(companyId, crmPhone, crmAgent="0000", crmFirstName = 'Username') {
|
||||
async function ticketCRM(companyId, crmPhone, crmAgent = "0000", crmFirstName = 'Username') {
|
||||
|
||||
const crmFiles = await loadCRM(companyId)
|
||||
|
||||
|
@ -65,6 +65,9 @@ async function ticketCRM(companyId, crmPhone, crmAgent="0000", crmFirstName = 'U
|
|||
obj_ticket.ticketId
|
||||
)
|
||||
|
||||
if (obj_ticket_status)
|
||||
console.log("obj_ticket_status: ", JSON.stringify(obj_ticket_status, null, 6))
|
||||
|
||||
if (obj_ticket_status) {
|
||||
const { auxTicketStatus, error } = obj_ticket_status
|
||||
|
||||
|
@ -100,7 +103,7 @@ async function ticketCRM(companyId, crmPhone, crmAgent="0000", crmFirstName = 'U
|
|||
}
|
||||
//
|
||||
|
||||
}
|
||||
}
|
||||
return crmTicketLinks
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue