fix: set default value to crmCallDuration is equals 0

master
adriano 2024-09-24 13:00:14 -03:00
parent 6691427b37
commit 9b719a5eae
1 changed files with 6 additions and 6 deletions

View File

@ -86,8 +86,8 @@ const callJournaling = async (req, res) => {
// throw new CustomError.BadRequestError(`The crmCallDuration property must be provided when operation is outboundAsweredCall`) // throw new CustomError.BadRequestError(`The crmCallDuration property must be provided when operation is outboundAsweredCall`)
if (!crmCallDuration || crmCallDuration.trim() == "") if (!crmCallDuration || crmCallDuration.trim() == "" || crmCallDuration == "0")
crmCallDuration = "300" crmCallDuration = "10"
if (operationStatus == "hangup") if (operationStatus == "hangup")
@ -135,10 +135,10 @@ const oauthCallBack = async (req, res) => {
redirect_uri: process.env.URL_OAUTH_CALLBACK, redirect_uri: process.env.URL_OAUTH_CALLBACK,
code code
} }
// Refactor this. This is for salesforce only oauth2 that need a code_verifier. Try to find another // Refactor this. This is for salesforce only oauth2 that need a code_verifier. Try to find another
// way of gettig the code without need the code_verifier // way of gettig the code without need the code_verifier
const rest = crmOauth.crm.crmRest const rest = crmOauth.crm.crmRest
const salesforceUrls = rest.map(endpoint => { const salesforceUrls = rest.map(endpoint => {
const key = Object.keys(endpoint)[0] const key = Object.keys(endpoint)[0]
const url = endpoint[key].request.url const url = endpoint[key].request.url
@ -146,8 +146,8 @@ const oauthCallBack = async (req, res) => {
if (url.includes("salesforce")) { if (url.includes("salesforce")) {
return `${key} URL: ${url}` return `${key} URL: ${url}`
} }
}).filter(Boolean) }).filter(Boolean)
if (salesforceUrls.find(url => url.includes('salesforce'))) { if (salesforceUrls.find(url => url.includes('salesforce'))) {
authCodeProof = { authCodeProof = {
...authCodeProof, ...{ ...authCodeProof, ...{