From 9b719a5eae98f89e566b6efc7ea6c2686f1bf7e7 Mon Sep 17 00:00:00 2001 From: adriano Date: Tue, 24 Sep 2024 13:00:14 -0300 Subject: [PATCH] fix: set default value to crmCallDuration is equals 0 --- backend/controllers/crmController.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/controllers/crmController.js b/backend/controllers/crmController.js index 696786e..d6762e5 100644 --- a/backend/controllers/crmController.js +++ b/backend/controllers/crmController.js @@ -86,8 +86,8 @@ const callJournaling = async (req, res) => { // throw new CustomError.BadRequestError(`The crmCallDuration property must be provided when operation is outboundAsweredCall`) - if (!crmCallDuration || crmCallDuration.trim() == "") - crmCallDuration = "300" + if (!crmCallDuration || crmCallDuration.trim() == "" || crmCallDuration == "0") + crmCallDuration = "10" if (operationStatus == "hangup") @@ -135,10 +135,10 @@ const oauthCallBack = async (req, res) => { redirect_uri: process.env.URL_OAUTH_CALLBACK, code } - + // 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 - const rest = crmOauth.crm.crmRest + const rest = crmOauth.crm.crmRest const salesforceUrls = rest.map(endpoint => { const key = Object.keys(endpoint)[0] const url = endpoint[key].request.url @@ -146,8 +146,8 @@ const oauthCallBack = async (req, res) => { if (url.includes("salesforce")) { return `${key} URL: ${url}` } - }).filter(Boolean) - + }).filter(Boolean) + if (salesforceUrls.find(url => url.includes('salesforce'))) { authCodeProof = { ...authCodeProof, ...{