diff --git a/src/core/findUserPdl.js b/src/core/findUserPdl.js index e7c46bbdbb9de4c59ff76f66d36da898e97f3f08..8afbd4155fde7dd4b008790e2a39b60534360416 100644 --- a/src/core/findUserPdl.js +++ b/src/core/findUserPdl.js @@ -29,7 +29,7 @@ async function findUserPdl( 'Content-Type': 'text/xml;charset=UTF-8', apikey: apiAuthKey, } - + log('info', rechercherPoint(appLogin, name, postalCode, inseeCode, address)) const { response } = await soapRequest({ url: url, headers: sgeHeaders, diff --git a/src/helpers/getAccountId.js b/src/helpers/getAccountId.js deleted file mode 100644 index 5608da18e98dfc01de97cbef7246735cdf211032..0000000000000000000000000000000000000000 --- a/src/helpers/getAccountId.js +++ /dev/null @@ -1,12 +0,0 @@ -function getAccountId() { - try { - return process.env.NODE_ENV === 'development' || - process.env.NODE_ENV === 'test' - ? 'fakeAccountId' - : JSON.parse(process.env.COZY_FIELDS).account - } catch (err) { - throw new Error(`You must provide 'account' in COZY_FIELDS: ${err.message}`) - } -} - -module.exports = { getAccountId } diff --git a/src/index.js b/src/index.js index 91b051476a3fe76f9c4e3af9dfbb2bab1c12ab2b..507e81f7fa9d643b9029aadee23f61edf89c7e93 100644 --- a/src/index.js +++ b/src/index.js @@ -33,7 +33,7 @@ const { verifyContract } = require('./core/contractVerification') const { terminateContract } = require('./core/contractTermination') const { getContractStartDate } = require('./core/contractStartDate') const { getAccount, saveAccountData } = require('./requests/cozy') -const { getAccountId } = require('./helpers/getAccountId') +const { iSLocal } = require('./helpers/env') moment.locale('fr') // set the language moment.tz.setDefault('Europe/Paris') // set the timezone @@ -48,6 +48,7 @@ let startDailyDateString = startDailyDate.format('YYYY-MM-DD') const startLoadDate = moment().subtract(7, 'day') const endDate = moment() const endDateString = endDate.format('YYYY-MM-DD') +const ACCOUNT_ID = iSLocal() ? 'default_account_id' : 'enedis-sge-grandlyon' module.exports = new BaseKonnector(start) @@ -62,7 +63,7 @@ module.exports = new BaseKonnector(start) */ async function start(fields, cozyParameters) { log('info', 'Konnector configuration ...') - const ACCOUNT_ID = await getAccountId() + const pointId = fields.pointId let baseUrl = fields.wso2BaseUrl let apiAuthKey = fields.apiToken