diff --git a/src/core/contractVerification.js b/src/core/contractVerification.js index 28b89132008098e40f74f6c4de517924d0f17c61..684c3aa049aa14cb734c8c087448e80648872f8b 100644 --- a/src/core/contractVerification.js +++ b/src/core/contractVerification.js @@ -52,7 +52,7 @@ async function verifyContract(url, apiAuthKey, appLogin, contractId, pointId) { if (Array.isArray(currentContracts)) { currentContract = parseContracts(parsedReply)[0] } else { - currentContract = parseContracts(parsedReply) + currentContract = currentContracts } if ( (currentContract.etatCode === contractState.ACTIF || diff --git a/src/core/findUserPdl.js b/src/core/findUserPdl.js index b9edb6230ce0027aa10aa2c1afd7ee696eeb0a33..ff8d0ae5b940c8025eaf3e17d61cecfa09a62733 100644 --- a/src/core/findUserPdl.js +++ b/src/core/findUserPdl.js @@ -25,7 +25,7 @@ async function findUserPdl( inseeCode, escalierEtEtageEtAppartement = '' ) { - log('info', 'Fetching user data') + log('info', 'Fetching user pdl') const sgeHeaders = { 'Content-Type': 'text/xml;charset=UTF-8', apikey: apiAuthKey, @@ -57,10 +57,10 @@ async function findUserPdl( try { return parseUserPdl(parsedReply) } catch (error) { - log('error', 'Error while parsing user PDL: ' + error) + log('warn', 'Error while parsing user PDL: ' + error) if (parsedReply.Envelope.Body.Fault) { log( - 'error', + 'warn', `Enedis issue ${parsedReply.Envelope.Body.Fault.detail.erreur.resultat.$.code}: ${parsedReply.Envelope.Body.Fault.faultstring}` ) } diff --git a/src/index.js b/src/index.js index 84c418467b2474c0e3878fbf3d5d659f386dd1a6..d96fa6d766f85c6d1ddc03c6a05b2d2684795570 100644 --- a/src/index.js +++ b/src/index.js @@ -219,6 +219,7 @@ async function start(fields, cozyParameters) { log('info', 'Successfully logged in') await gatherData(baseUrl, apiAuthKey, sgeLogin, pointId) + log('info', 'Konnector success') } /**