feat: Add soluction to remove 0 at the beginning of the contact before creating call journaling
parent
c15918e362
commit
f601dbb699
|
@ -28,6 +28,8 @@ const whatsappJournalingCRM = require('../utils/whatsappJournalingCRM')
|
||||||
const redirectContactLinkCRM = require('../utils/redirectContactLinkCRM')
|
const redirectContactLinkCRM = require('../utils/redirectContactLinkCRM')
|
||||||
const sfcase = require('../utils/sfCase')
|
const sfcase = require('../utils/sfCase')
|
||||||
const sfCaseUpdate = require('../utils/sfCaseUpdate')
|
const sfCaseUpdate = require('../utils/sfCaseUpdate')
|
||||||
|
const removeZeroInicial = require('../utils/removeZeroInicial')
|
||||||
|
|
||||||
|
|
||||||
const contactCreate = async (req, res) => {
|
const contactCreate = async (req, res) => {
|
||||||
|
|
||||||
|
@ -81,8 +83,8 @@ const callJournaling = async (req, res) => {
|
||||||
console.log(`[REQ.BODY - ${new Date()}] callJournaling: `, JSON.stringify(req.body, null, 6))
|
console.log(`[REQ.BODY - ${new Date()}] callJournaling: `, JSON.stringify(req.body, null, 6))
|
||||||
|
|
||||||
|
|
||||||
// test remove
|
// Remove 0 from the beginning of the number. Ex: 011996067641 to 11996067641
|
||||||
// return res.status(StatusCodes.OK).send()
|
crmPhone = removeZeroInicial(crmPhone)
|
||||||
|
|
||||||
// Refactor this in the future.
|
// Refactor this in the future.
|
||||||
crmPhone = '55' + crmPhone
|
crmPhone = '55' + crmPhone
|
||||||
|
@ -373,6 +375,8 @@ const createTicket = async (req, res) => {
|
||||||
|
|
||||||
let { companyId, crmPhone } = req.body
|
let { companyId, crmPhone } = req.body
|
||||||
|
|
||||||
|
mustContainProperties(req, ['companyId', 'crmPhone'])
|
||||||
|
|
||||||
const crmTicketLinks = await ticketCRM(companyId, crmPhone)
|
const crmTicketLinks = await ticketCRM(companyId, crmPhone)
|
||||||
|
|
||||||
return res.status(StatusCodes.OK).json({ crmTicketLinks })
|
return res.status(StatusCodes.OK).json({ crmTicketLinks })
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
function removeZeroInicial(numero) {
|
||||||
|
return numero.replace(/^0+/, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = removeZeroInicial
|
Loading…
Reference in New Issue