From 63949e465985e9f91cf37b32b75c9cf8b71724e3 Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Thu, 11 Aug 2022 14:43:06 +0200
Subject: [PATCH] publish: fix: type issue on pointID

generated from commit 5c796436f2bf665853b17ab98f50d43573060755
---
 index.js           | 27 +++------------------------
 onDeleteAccount.js | 23 +----------------------
 2 files changed, 4 insertions(+), 46 deletions(-)

diff --git a/index.js b/index.js
index 85c77e6..37162f5 100644
--- a/index.js
+++ b/index.js
@@ -194,7 +194,7 @@ async function start(fields, cozyParameters) {
           apiAuthKey,
           sgeLogin,
           contractId,
-          fields.pointId,
+          pointId,
           userConsent.serviceId
         )
         await deleteBoConsent(
@@ -211,7 +211,7 @@ async function start(fields, cozyParameters) {
   }
   log('info', 'Successfully logged in')
 
-  await gatherData(baseUrl, apiAuthKey, sgeLogin, fields.pointId)
+  await gatherData(baseUrl, apiAuthKey, sgeLogin, pointId)
 }
 
 /**
@@ -223894,22 +223894,6 @@ async function createBoConsent(
   inseeCode
 ) {
   log('info', `Query createBoConsent`)
-  log('info', `token ${token}`)
-  log('info', pointID)
-  log('info', `string : ${typeof pointID === 'string'}`)
-  log('info', `number : ${typeof pointID === 'number'}`)
-  log('info', pointID)
-  log(
-    'info',
-    JSON.stringify({
-      pointID,
-      lastname,
-      firstname,
-      address,
-      postalCode,
-      inseeCode,
-    })
-  )
   const headers = {
     headers: {
       Authorization: `Bearer ${token}`,
@@ -223929,10 +223913,8 @@ async function createBoConsent(
       },
       headers
     )
-    log('info', JSON.stringify(data))
     return data
   } catch (e) {
-    log('error', JSON.stringify(e))
     log('error', `BO replied with ${e}`)
     throw errors.MAINTENANCE
   }
@@ -223954,12 +223936,10 @@ async function updateBoConsent(url, token, consent, serviceId) {
   }
 
   try {
-    log('info', `${consent.ID}`)
-    let consentId = '1'
+    let consentId = ''
     if (consent.ID) {
       consentId = consent.ID.toString()
     }
-    log('info', consentId)
     const { data } = await axios.put(
       `${url}/consent/${consentId}`,
       {
@@ -223981,7 +223961,6 @@ async function updateBoConsent(url, token, consent, serviceId) {
  * @returns {Promise<Consent>}
  */
 async function getBoConsent(url, token, boId) {
-  //TODO: Implement
   log('info', `Query getBoConsent ${boId}`)
   const headers = {
     headers: {
diff --git a/onDeleteAccount.js b/onDeleteAccount.js
index e170964..409952f 100644
--- a/onDeleteAccount.js
+++ b/onDeleteAccount.js
@@ -223282,22 +223282,6 @@ async function createBoConsent(
   inseeCode
 ) {
   log('info', `Query createBoConsent`)
-  log('info', `token ${token}`)
-  log('info', pointID)
-  log('info', `string : ${typeof pointID === 'string'}`)
-  log('info', `number : ${typeof pointID === 'number'}`)
-  log('info', pointID)
-  log(
-    'info',
-    JSON.stringify({
-      pointID,
-      lastname,
-      firstname,
-      address,
-      postalCode,
-      inseeCode,
-    })
-  )
   const headers = {
     headers: {
       Authorization: `Bearer ${token}`,
@@ -223317,10 +223301,8 @@ async function createBoConsent(
       },
       headers
     )
-    log('info', JSON.stringify(data))
     return data
   } catch (e) {
-    log('error', JSON.stringify(e))
     log('error', `BO replied with ${e}`)
     throw errors.MAINTENANCE
   }
@@ -223342,12 +223324,10 @@ async function updateBoConsent(url, token, consent, serviceId) {
   }
 
   try {
-    log('info', `${consent.ID}`)
-    let consentId = '1'
+    let consentId = ''
     if (consent.ID) {
       consentId = consent.ID.toString()
     }
-    log('info', consentId)
     const { data } = await axios.put(
       `${url}/consent/${consentId}`,
       {
@@ -223369,7 +223349,6 @@ async function updateBoConsent(url, token, consent, serviceId) {
  * @returns {Promise<Consent>}
  */
 async function getBoConsent(url, token, boId) {
-  //TODO: Implement
   log('info', `Query getBoConsent ${boId}`)
   const headers = {
     headers: {
-- 
GitLab