Newer
Older
221001
221002
221003
221004
221005
221006
221007
221008
221009
221010
221011
221012
221013
221014
221015
221016
221017
221018
221019
221020
221021
221022
221023
221024
221025
221026
221027
221028
221029
221030
221031
221032
221033
221034
221035
221036
221037
221038
221039
221040
221041
221042
221043
221044
221045
221046
221047
221048
221049
221050
221051
221052
*/
async function formateDataForDoctype(data) {
log('info', 'Formating data')
return data.map(record => {
let date = moment(record.d, 'YYYY/MM/DD h:mm:ss')
return {
load: record.v,
year: parseInt(date.format('YYYY')),
month: parseInt(date.format('M')),
day: parseInt(date.format('D')),
hour: parseInt(date.format('H')),
minute: parseInt(date.format('m')),
}
})
}
/**
* Format tag in order to be manipulated easly
* @param {string} name
* @returns {string} name
*/
function parseTags(name) {
if (name.split(':')[1] !== undefined) {
return name.split(':')[1]
}
return name
}
/**
*
* @param {string} value
* @param {string} name
* @returns {string|number} value
*/
function parseValue(value, name) {
// Wh => KWh
if (name === 'v') {
return parseFloat((parseInt(value) / 1000).toFixed(2))
}
return value
}
module.exports = {
parseSgeXmlData,
parseSgeXmlTechnicalData,
formateDataForDoctype,
parseTags,
parseValue,
}
/***/ }),
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const { log } = __webpack_require__(1)
/**
* Query SGE in order to get info
* @param {number} pointId
* @param {string} appLogin
* @param {string} startDt
* @param {string} endDt
* @returns {string}
*/
function userMesureDetailles(
pointId,
221070
221071
221072
221073
221074
221075
221076
221077
221078
221079
221080
221081
221082
221083
221084
221085
221086
startDt,
endDt,
mesureType = 'ENERGIE',
unit = 'EA'
) {
log(
'info',
`Query data ${mesureType}/${unit} between ${startDt} and ${endDt}`
)
return `<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v2="http://www.enedis.fr/sge/b2b/services/consultationmesuresdetaillees/v2.0"
xmlns:v1="http://www.enedis.fr/sge/b2b/technique/v1.0">
<soapenv:Header/>
<soapenv:Body>
<v2:consulterMesuresDetaillees>
<demande>
<initiateurLogin>${appLogin}</initiateurLogin>
221088
221089
221090
221091
221092
221093
221094
221095
221096
221097
221098
221099
221100
221101
221102
221103
221104
221105
221106
<pointId>${pointId}</pointId>
<mesuresTypeCode>${mesureType}</mesuresTypeCode>
<grandeurPhysique>${unit}</grandeurPhysique>
<soutirage>true</soutirage>
<injection>false</injection>
<dateDebut>${startDt}</dateDebut>
<dateFin>${endDt}</dateFin>
<mesuresCorrigees>false</mesuresCorrigees>
<accordClient>true</accordClient>
</demande>
</v2:consulterMesuresDetaillees>
</soapenv:Body>
</soapenv:Envelope>
`
}
/**
* Get user technical data
* @param {number} pointId
* @param {string} appLogin
function userTechnicalData(pointId, appLogin) {
log('info', `Query userMesureDetailles`)
return `<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v2="http://www.enedis.fr/sge/b2b/services/consulterdonneestechniquescontractuelles/v1.0"
xmlns:v1="http://www.enedis.fr/sge/b2b/technique/v1.0">
<soapenv:Header/>
<soapenv:Body>
<v2:consulterDonneesTechniquesContractuelles>
<pointId>${pointId}</pointId>
<loginUtilisateur>${appLogin}</loginUtilisateur>
<autorisationClient>true</autorisationClient>
</v2:consulterDonneesTechniquesContractuelles>
</soapenv:Body>
</soapenv:Envelope>
`
}
/**
* Get user max power
* @param {number} pointId
* @param {string} appLogin
* @param {string} startDt
* @param {string} endDt
* @returns {string}
*/
function userMaxPower(pointId, appLogin, startDt, endDt) {
log('info', `Query userMesureDetailles`)
return `<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v2="http://www.enedis.fr/sge/b2b/services/consultationmesuresdetaillees/v2.0"
xmlns:v1="http://www.enedis.fr/sge/b2b/technique/v1.0">
<soapenv:Header/>
<soapenv:Body>
<v2:consulterMesuresDetaillees>
<demande>
<initiateurLogin>${appLogin}</initiateurLogin>
221147
221148
221149
221150
221151
221152
221153
221154
221155
221156
221157
221158
221159
221160
221161
221162
221163
<pointId>${pointId}</pointId>
<mesuresTypeCode>PMAX</mesuresTypeCode>
<grandeurPhysique>PMA</grandeurPhysique>
<soutirage>true</soutirage>
<injection>false</injection>
<dateDebut>${startDt}</dateDebut>
<dateFin>${endDt}</dateFin>
<mesuresPas>P1D</mesuresPas>
<mesuresCorrigees>false</mesuresCorrigees>
<accordClient>true</accordClient>
</demande>
</v2:consulterMesuresDetaillees>
</soapenv:Body>
</soapenv:Envelope>
`
}
221164
221165
221166
221167
221168
221169
221170
221171
221172
221173
221174
221175
221176
221177
221178
221179
221180
221181
221182
221183
221184
221185
221186
221187
221188
221189
221190
221191
221192
221193
221194
221195
221196
221197
221198
221199
221200
221201
221202
221203
221204
221205
221206
221207
221208
221209
221210
221211
221212
221213
221214
221215
221216
221217
221218
221219
221220
221221
221222
221223
221224
221225
221226
221227
221228
221229
221230
221231
221232
221233
221234
221235
221236
221237
221238
221239
221240
221241
221242
221243
221244
221245
221246
221247
221248
221249
221250
221251
221252
221253
221254
221255
221256
221257
221258
221259
221260
221261
221262
221263
221264
221265
221266
221267
221268
221269
221270
221271
221272
221273
221274
221275
221276
221277
221278
221279
221280
221281
221282
221283
221284
221285
221286
221287
221288
221289
221290
221291
221292
221293
221294
221295
221296
221297
221298
221299
221300
221301
221302
221303
221304
221305
221306
221307
221308
221309
/**
* Use rechercherPoint to find user PDL if exist
* @param {string} name
* @param {string} postalCode
* @param {string} address
* @returns {string} PDL
*/
function searchUser(appLogin, name, postalCode, inseeCode, address) {
log('info', `Query searchUser`)
return `<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v2="http://www.enedis.fr/sge/b2b/services/rechercherpoint/v2.0"
xmlns:v1="http://www.enedis.fr/sge/b2b/technique/v1.0">
<soapenv:Header/>
<soapenv:Body>
<v2:rechercherPoint>
<criteres>
<adresseInstallation>
<numeroEtNomVoie>${address}</numeroEtNomVoie>
<codePostal>${postalCode}</codePostal>
<codeInseeCommune>${inseeCode}</codeInseeCommune>
</adresseInstallation>
<nomClientFinalOuDenominationSociale>${name}</nomClientFinalOuDenominationSociale>
<rechercheHorsPerimetre>true</rechercheHorsPerimetre>
</criteres>
<loginUtilisateur>${appLogin}</loginUtilisateur>
</v2:rechercherPoint>
</soapenv:Body>
</soapenv:Envelope>`
}
/**
* Search if user as a service
* @param {string} appLogin
* @param {string} contractId
* @param {string} pointId
* @returns {*}
*/
function searchServiceSouscrit(appLogin, contractId, pointId) {
log('info', `Query activateDataCollect`)
return `<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v2="http://www.enedis.fr/sge/b2b/rechercherservicessouscritsmesures/v1.0"
xmlns:v1="http://www.enedis.fr/sge/b2b/technique/v1.0">
<soapenv:Header/>
<soapenv:Body>
<v2:rechercherServicesSouscritsMesures>
<criteres>
<pointId>${pointId}</pointId>
<contratId>${contractId}</contratId>
</criteres>
<loginUtilisateur>${appLogin}</loginUtilisateur>
</v2:rechercherServicesSouscritsMesures>
</soapenv:Body>
</soapenv:Envelope>`
}
/**
* Activate half hour data collect for user
* @param {string} appLogin
* @param {string} contractId
* @param {string} pointId
* @param {string} name
* @param {string} startDate
* @param {string} endDate
* @returns {*}
*/
function activateDataCollect(
appLogin,
contractId,
pointId,
name,
startDate,
endDate
) {
log('info', `Query activateDataCollect`)
return `<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v2="http://www.enedis.fr/sge/b2b/commandercollectepublicationmesures/v3.0"
xmlns:v1="http://www.enedis.fr/sge/b2b/technique/v1.0">
<soapenv:Header/>
<soapenv:Body>
<v2:commanderCollectePublicationMesures>
<demande>
<donneesGenerales>
<objetCode>AME</objetCode>
<pointId>${pointId}</pointId>
<initiateurLogin>${appLogin}</initiateurLogin>
<contratId>${contractId}</contratId>
</donneesGenerales>
<accesMesures>
<dateDebut>${startDate}</dateDebut>
<dateFin>${endDate}</dateFin>
<declarationAccordClient>
<accord>true</accord>
<personnePhysique>
<nom>${name}</nom>
</personnePhysique>
</declarationAccordClient>
<mesuresTypeCode>CDC</mesuresTypeCode>
<soutirage>true</soutirage>
<injection>false</injection>
<mesuresPas>PT30M</mesuresPas>
<mesuresCorrigees>false</mesuresCorrigees>
<transmissionRecurrente>true</transmissionRecurrente>
<periodiciteTransmission>P1D</periodiciteTransmission>
</accesMesures>
</demande>
</v2:commanderCollectePublicationMesures>
</soapenv:Body>
</soapenv:Envelope>`
}
/**
*
* @param {string} appLogin
* @param {string} contractId
* @param {string} pointId
* @param {string} serviceSouscritId
* @returns {*}
*/
function stopDataCollect(appLogin, contractId, pointId, serviceSouscritId) {
log('info', `Query stopDataCollect`)
return `<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v2="http://www.enedis.fr/sge/b2b/commanderarretservicesouscritmesures/v1.0"
xmlns:v1="http://www.enedis.fr/sge/b2b/technique/v1.0">
<soapenv:Header/>
<soapenv:Body>
<v2:commanderArretServiceSouscritMesures>
<demande>
<donneesGenerales>
<objetCode>ASS</objetCode>
<pointId>${pointId}</pointId>
<initiateurLogin>${appLogin}</initiateurLogin>
<contratId>${contractId}</contratId>
</donneesGenerales>
<arretServiceSouscrit>
<serviceSouscritId>${serviceSouscritId}</serviceSouscritId>
</arretServiceSouscrit>
</demande>
</v2:commanderArretServiceSouscritMesures>
</soapenv:Body>
</soapenv:Envelope>`
}
module.exports = {
userTechnicalData,
userMaxPower,
userMesureDetailles,
searchUser,
searchServiceSouscrit,
activateDataCollect,
stopDataCollect,
221318
221319
221320
221321
221322
221323
221324
221325
221326
221327
221328
221329
221330
221331
221332
221333
221334
221335
221336
221337
221338
221339
221340
221341
221342
221343
221344
221345
221346
221347
221348
221349
221350
221351
221352
221353
221354
221355
221356
221357
221358
221359
221360
221361
221362
221363
221364
221365
221366
221367
221368
221369
221370
221371
221372
221373
221374
221375
221376
221377
221378
221379
221380
221381
221382
221383
221384
221385
221386
221387
221388
221389
221390
221391
221392
221393
221394
221395
221396
221397
221398
221399
221400
221401
221402
221403
221404
221405
221406
221407
221408
221409
221410
221411
221412
}
/***/ })
/******/ ]);
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ id: moduleId,
/******/ loaded: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = __webpack_module_cache__;
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/node module decorator */
/******/ (() => {
/******/ __webpack_require__.nmd = (module) => {
/******/ module.paths = [];
/******/ if (!module.children) module.children = [];
/******/ return module;
/******/ };
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // module cache are used so entry inlining is disabled
/******/ // startup
/******/ // Load entry module and return exports
/******/ var __webpack_exports__ = __webpack_require__(__webpack_require__.s = 0);
/******/
/******/ })()
;