diff --git a/index.js b/index.js index 87d44543565a894551e8f7eba2f03d9aa147a902..79e06651d91eb735f54abfe16c900973e90c142c 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 db90e7610e6a209669de5147a0d37efec0afed43..37f98e38efae710d7d326709dc72a44bc3bd7678 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')