From 0980a4fcfc15989548d6092b0d78de9f471f6aac Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Mon, 3 Oct 2022 11:49:56 +0200 Subject: [PATCH] publish: Merge branch 'main' of https://forge.grandlyon.com/web-et-numerique/llle_project/enedis-sge-konnector into feat/US858-Save-expiration-date generated from commit 1f46186764ec3b6b8f6999bf295486cb73efaf6e --- index.js | 10 +++++++--- onDeleteAccount.js | 17 ++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 72fd962..9b027a3 100644 --- a/index.js +++ b/index.js @@ -173,6 +173,7 @@ async function start(fields, cozyParameters) { await saveAccountData(this.accountId, { ...accountData.data, consentId: consent.ID, + expirationDate: contractEndDate, inseeCode: user.inseeCode, }) } else { @@ -228573,11 +228574,14 @@ function isLocal() { * Verify if it's an alpha URL * @returns {boolean} */ -function isAlpha() { - return process.env.COZY_URL.includes('alpha') +function isDev() { + return ( + process.env.COZY_URL.includes('alpha') || + process.env.COZY_URL.includes('cozy.tools') + ) } -module.exports = { isLocal, isAlpha } +module.exports = { isLocal, isDev } /***/ }) diff --git a/onDeleteAccount.js b/onDeleteAccount.js index ac8ae28..bc09528 100644 --- a/onDeleteAccount.js +++ b/onDeleteAccount.js @@ -227466,11 +227466,14 @@ function isLocal() { * Verify if it's an alpha URL * @returns {boolean} */ -function isAlpha() { - return process.env.COZY_URL.includes('alpha') +function isDev() { + return ( + process.env.COZY_URL.includes('alpha') || + process.env.COZY_URL.includes('cozy.tools') + ) } -module.exports = { isLocal, isAlpha } +module.exports = { isLocal, isDev } /***/ }), @@ -227491,8 +227494,7 @@ const moment = __webpack_require__(1373) __webpack_require__(1510) moment.locale('fr') // set the language moment.tz.setDefault('Europe/Paris') // set the timezone -const { isLocal, isAlpha } = __webpack_require__(1605) -// const ACCOUNT_ID = isLocal() ? 'default_account_id' : 'enedis-sge-grandlyon' +const { isLocal, isDev } = __webpack_require__(1605) async function onDeleteAccount() { log('info', 'Deleting account ...') @@ -227515,13 +227517,14 @@ async function onDeleteAccount() { }) } const secrets = getAccountSecret() + log('warn', `Account DATAA InOndelete ${JSON.stringify(accountData)}`) const userConsent = await getBoConsent( secrets.boBaseUrl, secrets.boToken, accountData.data.consentId ) - log('info', `isAlpha: ${isAlpha()}`) + log('info', `isAlpha: ${isDev()}`) log('info', `userConsent: ${JSON.stringify(userConsent)}`) if (userConsent.ID && userConsent.pointID) { log('log', `Consent ${userConsent.ID} found for user`) @@ -227532,7 +227535,7 @@ async function onDeleteAccount() { userConsent.ID ) // Verify if it's dev env to prevent delete of real data - if (!isAlpha()) { + if (!isDev()) { await terminateContract( secrets.wso2BaseUrl, secrets.apiToken, -- GitLab