From 5912aa51e4742c4385152bd171f4b74235f9b3d9 Mon Sep 17 00:00:00 2001
From: gcarron <gcarron@grandlyon.com>
Date: Mon, 3 Oct 2022 16:45:16 +0200
Subject: [PATCH] publish: fix: change konnector slug

generated from commit 65d86baf8256ab6fc0c8256213f7502c3bff2b2a
---
 index.js | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/index.js b/index.js
index f8e8bec..6e1a882 100644
--- a/index.js
+++ b/index.js
@@ -214,9 +214,10 @@ async function start(fields, cozyParameters) {
         contractId,
         pointId,
         boBaseUrl,
-        boToken
+        boToken,
+        consentEndDate < today
       )
-      throw errors.USER_ACTION_NEEDED_OAUTH_OUTDATED
+      // throw errors.USER_ACTION_NEEDED_OAUTH_OUTDATED
     }
   }
   log('info', 'Successfully logged in')
@@ -234,6 +235,7 @@ async function start(fields, cozyParameters) {
  * @param {number} pointId
  * @param {string} boBaseUrl
  * @param {string} boToken
+ * @param {boolean} isConsentExpiration
  */
 async function deleteConsent(
   userConsent,
@@ -243,7 +245,8 @@ async function deleteConsent(
   contractId,
   pointId,
   boBaseUrl,
-  boToken
+  boToken,
+  isConsentExpiration
 ) {
   log('error', `Invalid or not found consent for user`)
   if (userConsent.serviceID) {
@@ -260,6 +263,9 @@ async function deleteConsent(
     log('error', `No service id retrieved from BO`)
     throw errors.VENDOR_DOWN
   }
+  if (isConsentExpiration) {
+    throw errors.USER_ACTION_NEEDED_OAUTH_OUTDATED
+  }
   throw errors.TERMS_VERSION_MISMATCH
 }
 
@@ -228389,6 +228395,7 @@ async function findUserPdl(
     return parseUserPdl(parsedReply)
   } catch (error) {
     log('error', 'Error while parsing user PDL: ' + error)
+
     if (parsedReply.Envelope.Body.Fault) {
       log(
         'error',
-- 
GitLab