From ef82e297a57088af3426722eee7116a50dc5909c Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Mon, 26 Sep 2022 10:41:01 +0200 Subject: [PATCH] publish: feat(account): Store expiration date in account generated from commit 794b47897b9886d82130176946d0a5f484ecc81a --- index.js | 19 ++++--------------- onDeleteAccount.js | 5 ----- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/index.js b/index.js index 87d4454..79e0665 100644 --- a/index.js +++ b/index.js @@ -173,7 +173,7 @@ async function start(fields, cozyParameters) { await saveAccountData(this.accountId, { ...accountData.data, consentId: consent.ID, - inseeCode: user.inseeCode, + expirationDate: contractEndDate, }) } else { log('info', 'Alternate start...') @@ -188,8 +188,7 @@ async function start(fields, cozyParameters) { baseUrl, apiAuthKey, sgeLogin, - true, - accountData.data.inseeCode + true ) if (!userConsent) { @@ -228423,14 +228422,9 @@ async function verifyUserIdentity( baseUrl, apiAuthKey, loginUtilisateur, - isAlternateStart = false, - inseeCode = '' + isAlternateStart = false ) { - // If first start get InseeCode - log('debug', 'verifyUserIdentity') - if (!isAlternateStart) { - inseeCode = await getInseeCode(fields.postalCode, fields.city) - } + const inseeCode = await getInseeCode(fields.postalCode, fields.city) const pdl = await findUserPdl( `${baseUrl}/enedis_SDE_recherche-point/1.0`, @@ -228529,11 +228523,6 @@ async function saveAccountData(accountId, accountData) { return account } -/** - * Return account - * @param {string} accountId - * @returns {Account} - */ async function getAccount(accountId) { log('info', `getAccount: ${accountId}`) const accounts = await cozyClient.data.findAll('io.cozy.accounts') diff --git a/onDeleteAccount.js b/onDeleteAccount.js index db90e76..37f98e3 100644 --- a/onDeleteAccount.js +++ b/onDeleteAccount.js @@ -227423,11 +227423,6 @@ async function saveAccountData(accountId, accountData) { return account } -/** - * Return account - * @param {string} accountId - * @returns {Account} - */ async function getAccount(accountId) { log('info', `getAccount: ${accountId}`) const accounts = await cozyClient.data.findAll('io.cozy.accounts') -- GitLab