konnectors / cozy-konnector-cesu Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU Affero General Public License v3.0
License: GNU Affero General Public License v3.0
The main interaction with the CESU website is through a call to "/bulletinsSalaire" which returns JSON-formatted information.
This return object does seem to have messages in it which could be handled - either displayed to the end user, or at least sent in the logs for later analysis or understanding.
Ex of a result:
{
"listeMessages" : [ {
"codeInterne" : 31,
"contenu" : "La date de recherche doit être comprise dans les 5 dernières années",
"log" : null
} ],
"hasMessage" : true,
"hasMsgAvert" : false,
"hasMsgErrFonc" : true,
"hasMsgErrTech" : false,
"hasMsgInfo" : false,
"listeObjets" : [ ]
}
Based on their name and a guess of their usage,, we could also use the "has*" properties to decide how to present the output:
(spinoff of #159)
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
When using this connector, no document is fetched / synchronized.
Analyzing the code, I found that this request was sent to the CESU website:
'/bulletinsSalaire?numInterneSalarie=&dtDebutRecherche=20130101&dtFinRecherche=20500101&numStart=0&nbAffiche=1000&numeroOrdre=0'
Once submitted to the website, the following result is received:
{
"listeMessages" : [ {
"codeInterne" : 31,
"contenu" : "La date de recherche doit être comprise dans les 5 dernières années",
"log" : null
} ],
"hasMessage" : true,
"hasMsgAvert" : false,
"hasMsgErrFonc" : true,
"hasMsgErrTech" : false,
"hasMsgInfo" : false,
"listeObjets" : [ ]
}
which certainly explains the lack of response.
When updating the "dtDebutRecherche" to 20140101, I receive a JSON with expected results.
I propose that the request is updated to match this constraint. Not hardcoded, but computed from the current time in order to be time proof.
It may also be the opportunity to handle received messages, and logging them or presenting them to the user.
Synchronisation doesn't download files, at least for employees bulletins, likely to be broken also for employers though.
Can reproduce both locally and on Cozy Cloud.
Here are the logs from a standalone run (note that employer name, bulletins number, my cesu number and EUR amounts were manually redacted and were correct in the original logs) :
yarn run v1.22.21
$ cozy-konnector-standalone
BaseKonnector: debug : Preparing konnector...
BaseKonnector: debug : Running konnector main...
cozy-konnector-libs: info : Authenticating...
cozy-konnector-libs: info : Correctly logged in
cozy-konnector-libs: info : Cesu number found in page
cozy-client-js-stub: debug : Checking if /EMPLOYER_NAME exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
cozy-client-js-stub: debug : Checking if /EMPLOYER_NAME exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
cozy-client-js-stub: debug : Checking if /EMPLOYER_NAME exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
cozy-client-js-stub: debug : Checking if / exists
cozy-client-js-stub: debug : Checking if / exists
cozy-client-js-stub: debug : Checking if / exists
cozy-client-js-stub: debug : Creating new directory EMPLOYER_NAME
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
cozy-client-js-stub: debug : Creating new directory EMPLOYER_NAME
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
cozy-client-js-stub: debug : Creating new directory EMPLOYER_NAME
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
saveFiles: debug : Checking existence of BULLETINNO1
saveFiles: debug : Checking existence of BULLETINNO2
saveFiles: debug : Checking existence of BULLETINNO3
saveFiles: debug : not found
saveFiles: debug : not found
saveFiles: debug : not found
saveFiles: debug : Checking existence of /EMPLOYER_NAME/2023-12_XXXEUR.pdf
cozy-client-js-stub: debug : Checking if /EMPLOYER_NAME/2023-12_XXXEUR.pdf exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME/2023-12_XXXEUR.pdf
saveFiles: debug : Checking existence of /EMPLOYER_NAME/2023-11_XXXEUR.pdf
cozy-client-js-stub: debug : Checking if /EMPLOYER_NAME/2023-11_XXXEUR.pdf exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME/2023-11_XXXEUR.pdf
saveFiles: debug : Checking existence of /EMPLOYER_NAME/2023-10_XXXEUR.pdf
cozy-client-js-stub: debug : Checking if /EMPLOYER_NAME/2023-10_XXXEUR.pdf exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME/2023-10_XXXEUR.pdf
saveFiles: debug : /EMPLOYER_NAME/2023-12_XXXEUR.pdf does not exist
saveFiles: debug : /EMPLOYER_NAME/2023-11_XXXEUR.pdf does not exist
saveFiles: debug : /EMPLOYER_NAME/2023-10_XXXEUR.pdf does not exist
saveFiles: debug : {
fileurl: 'https://www.cesu.urssaf.fr/cesuwebdec/salaries/MYCESUNUMBER/editions/bulletinSalairePE?refDoc=BULLETINNO1',
filename: '2023-12_XXXEUR.pdf',
amount: xxx,
isRefund: true,
date: 2023-12-31T00:00:00.000Z,
vendorRef: 'BULLETINNO1',
subPath: 'EMPLOYER_NAME',
fileAttributes: {
metadata: {
contentAuthor: 'cesu.urssaf.fr',
issueDate: 2024-01-13T22:57:21.517Z,
carbonCopy: true,
qualification: [Qualification]
}
},
requestOptions: { jar: RequestJar { _jar: [CookieJar] } },
vendor: 'cesu',
matchingCriterias: { labelRegex: '.*' }
}
saveFiles: debug : File /EMPLOYER_NAME/2023-12_XXXEUR.pdf does not exist yet or is not valid
cozy-client-js-stub: debug : Checking if //EMPLOYER_NAME exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
saveFiles: debug : {
fileurl: 'https://www.cesu.urssaf.fr/cesuwebdec/salaries/MYCESUNUMBER/editions/bulletinSalairePE?refDoc=BULLETINNO2',
filename: '2023-11_XXXEUR.pdf',
amount: xxx,
isRefund: true,
date: 2023-11-30T00:00:00.000Z,
vendorRef: 'BULLETINNO2',
subPath: 'EMPLOYER_NAME',
fileAttributes: {
metadata: {
contentAuthor: 'cesu.urssaf.fr',
issueDate: 2024-01-13T22:57:21.518Z,
carbonCopy: true,
qualification: [Qualification]
}
},
requestOptions: { jar: RequestJar { _jar: [CookieJar] } },
vendor: 'cesu',
matchingCriterias: { labelRegex: '.*' }
}
saveFiles: debug : File /EMPLOYER_NAME/2023-11_XXXEUR.pdf does not exist yet or is not valid
cozy-client-js-stub: debug : Checking if //EMPLOYER_NAME exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
saveFiles: debug : {
fileurl: 'https://www.cesu.urssaf.fr/cesuwebdec/salaries/MYCESUNUMBER/editions/bulletinSalairePE?refDoc=BULLETINNO3',
filename: '2023-10_XXXEUR.pdf',
amount: xxx,
isRefund: true,
date: 2023-10-31T00:00:00.000Z,
vendorRef: 'BULLETINNO3',
subPath: 'EMPLOYER_NAME',
fileAttributes: {
metadata: {
contentAuthor: 'cesu.urssaf.fr',
issueDate: 2024-01-13T22:57:21.518Z,
carbonCopy: true,
qualification: [Qualification]
}
},
requestOptions: { jar: RequestJar { _jar: [CookieJar] } },
vendor: 'cesu',
matchingCriterias: { labelRegex: '.*' }
}
saveFiles: debug : File /EMPLOYER_NAME/2023-10_XXXEUR.pdf does not exist yet or is not valid
cozy-client-js-stub: debug : Checking if //EMPLOYER_NAME exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
cozy-client-js-stub: debug : Creating new file 2023-12_XXXEUR.pdf
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME/2023-12_XXXEUR.pdf
cozy-client-js-stub: debug : Creating new file 2023-11_XXXEUR.pdf
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME/2023-11_XXXEUR.pdf
cozy-client-js-stub: debug : Creating new file 2023-10_XXXEUR.pdf
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME/2023-10_XXXEUR.pdf
saveFiles: warn : File download error Error: read ECONNRESET
saveFiles: warn : File download error Error: read ECONNRESET
saveFiles: warn : File download error Error: read ECONNRESET
Done in 1.34s.
yarn run v1.22.21
$ cozy-konnector-standalone
BaseKonnector: debug : Preparing konnector...
BaseKonnector: debug : Running konnector main...
cozy-konnector-libs: info : Authenticating...
cozy-konnector-libs: info : Correctly logged in
cozy-konnector-libs: info : Cesu number found in page
cozy-client-js-stub: debug : Checking if /EMPLOYER_NAME exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
cozy-client-js-stub: debug : Checking if /EMPLOYER_NAME exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
cozy-client-js-stub: debug : Checking if /EMPLOYER_NAME exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
saveFiles: debug : Checking existence of BULLETINNO1
saveFiles: debug : Checking existence of BULLETINNO2
saveFiles: debug : Checking existence of BULLETINNO3
saveFiles: debug : not found
saveFiles: debug : not found
saveFiles: debug : not found
saveFiles: debug : Checking existence of /EMPLOYER_NAME/2023-12_XXXEUR.pdf
cozy-client-js-stub: debug : Checking if /EMPLOYER_NAME/2023-12_XXXEUR.pdf exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME/2023-12_XXXEUR.pdf
saveFiles: debug : Checking existence of /EMPLOYER_NAME/2023-11_XXXEUR.pdf
cozy-client-js-stub: debug : Checking if /EMPLOYER_NAME/2023-11_XXXEUR.pdf exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME/2023-11_XXXEUR.pdf
saveFiles: debug : Checking existence of /EMPLOYER_NAME/2023-10_XXXEUR.pdf
cozy-client-js-stub: debug : Checking if /EMPLOYER_NAME/2023-10_XXXEUR.pdf exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME/2023-10_XXXEUR.pdf
saveFiles: warn : /EMPLOYER_NAME/2023-12_XXXEUR.pdf is empty
saveFiles: warn : BAD_FILE_SIZE
saveFiles: warn : /EMPLOYER_NAME/2023-11_XXXEUR.pdf is empty
saveFiles: warn : BAD_FILE_SIZE
saveFiles: warn : /EMPLOYER_NAME/2023-10_XXXEUR.pdf is empty
saveFiles: warn : BAD_FILE_SIZE
saveFiles: error : Could not get a file name for the entry
saveFiles: warn : false is invalid
saveFiles: error : Could not get a file name for the entry
saveFiles: warn : false is invalid
saveFiles: error : Could not get a file name for the entry
saveFiles: warn : false is invalid
saveFiles: info : Error in shouldReplaceFile : BAD_DOWNLOADED_FILE
saveFiles: debug : Will replace /EMPLOYER_NAME/EMPLOYER_NAME/2023-12_XXXEUR.pdf...
saveFiles: debug : {
fileurl: 'https://www.cesu.urssaf.fr/cesuwebdec/salaries/MYCESUNUMBER/editions/bulletinSalairePE?refDoc=BULLETINNO1',
filename: '2023-12_XXXEUR.pdf',
amount: XXX,
isRefund: true,
date: 2023-12-31T00:00:00.000Z,
vendorRef: 'BULLETINNO1',
subPath: 'EMPLOYER_NAME',
fileAttributes: {
metadata: {
contentAuthor: 'cesu.urssaf.fr',
issueDate: 2024-01-13T22:43:43.995Z,
carbonCopy: true,
qualification: [Qualification]
}
},
requestOptions: { jar: RequestJar { _jar: [CookieJar] } },
vendor: 'cesu',
matchingCriterias: { labelRegex: '.*' }
}
saveFiles: debug : File /EMPLOYER_NAME/2023-12_XXXEUR.pdf does not exist yet or is not valid
cozy-client-js-stub: debug : Checking if //EMPLOYER_NAME exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
saveFiles: info : Error in shouldReplaceFile : BAD_DOWNLOADED_FILE
saveFiles: debug : Will replace /EMPLOYER_NAME/EMPLOYER_NAME/2023-11_XXXEUR.pdf...
saveFiles: debug : {
fileurl: 'https://www.cesu.urssaf.fr/cesuwebdec/salaries/MYCESUNUMBER/editions/bulletinSalairePE?refDoc=BULLETINNO2',
filename: '2023-11_XXXEUR.pdf',
amount: XXX,
isRefund: true,
date: 2023-11-30T00:00:00.000Z,
vendorRef: 'BULLETINNO2',
subPath: 'EMPLOYER_NAME',
fileAttributes: {
metadata: {
contentAuthor: 'cesu.urssaf.fr',
issueDate: 2024-01-13T22:43:43.995Z,
carbonCopy: true,
qualification: [Qualification]
}
},
requestOptions: { jar: RequestJar { _jar: [CookieJar] } },
vendor: 'cesu',
matchingCriterias: { labelRegex: '.*' }
}
saveFiles: debug : File /EMPLOYER_NAME/2023-11_XXXEUR.pdf does not exist yet or is not valid
cozy-client-js-stub: debug : Checking if //EMPLOYER_NAME exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
saveFiles: info : Error in shouldReplaceFile : BAD_DOWNLOADED_FILE
saveFiles: debug : Will replace /EMPLOYER_NAME/EMPLOYER_NAME/2023-10_XXXEUR.pdf...
saveFiles: debug : {
fileurl: 'https://www.cesu.urssaf.fr/cesuwebdec/salaries/MYCESUNUMBER/editions/bulletinSalairePE?refDoc=BULLETINNO3',
filename: '2023-10_XXXEUR.pdf',
amount: XXX,
isRefund: true,
date: 2023-10-31T00:00:00.000Z,
vendorRef: 'BULLETINNO3',
subPath: 'EMPLOYER_NAME',
fileAttributes: {
metadata: {
contentAuthor: 'cesu.urssaf.fr',
issueDate: 2024-01-13T22:43:43.995Z,
carbonCopy: true,
qualification: [Qualification]
}
},
requestOptions: { jar: RequestJar { _jar: [CookieJar] } },
vendor: 'cesu',
matchingCriterias: { labelRegex: '.*' }
}
saveFiles: debug : File /EMPLOYER_NAME/2023-10_XXXEUR.pdf does not exist yet or is not valid
cozy-client-js-stub: debug : Checking if //EMPLOYER_NAME exists
cozy-client-js-stub: debug : Real path : /var/home/charlesp/Documents/cozy-konnector-cesu/data/EMPLOYER_NAME
saveFiles: debug : replacing file for 2023-12_XXXEUR.pdf
saveFiles: debug : replacing file for 2023-11_XXXEUR.pdf
saveFiles: debug : replacing file for 2023-10_XXXEUR.pdf
saveFiles: warn : unknown file download error: Cannot read properties of undefined (reading 'dir_id')
saveFiles: warn : unknown file download error: Cannot read properties of undefined (reading 'dir_id')
saveFiles: warn : unknown file download error: Cannot read properties of undefined (reading 'dir_id')
saveFiles: info : saveFiles created 3 files for 3 entries
hydrateAndFilter: debug : 0 items before hydrateAndFilter
hydrateAndFilter: debug : 0 items after hydrateAndFilter
saveFiles: warn : File download error Error: read ECONNRESET
saveFiles: warn : File download error Error: read ECONNRESET
saveFiles: warn : File download error Error: read ECONNRESET
saveFiles: warn : No file to download
saveFiles: info : saveFiles created 0 files for 0 entries
BaseKonnector: debug : The connector has been run
Done in 1.70s.
EMPLOYER_NAME
folder is created but empty (are files created but cleaned up after connector run? are files not being cleaned up on standalone due to differences between client-stub and client?)YYYY-MM_XXXEUR.pdf
), sometimes with bigger, corrupt filesWill investigate more thoroughly in the coming week. Can't reproduce any error through manual API calls, requests made by the connector seems to be correct. The only ECONNRESET error I can reproduce is when not sending any User-Agent header, which is not the case here, as the connector correctly sends one.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These problems occurred while renovating this repository. View logs.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
cozy-jobs-cli
, cozy-konnector-libs
)package.json
cozy-konnector-libs 4.56.4
date-fns 2.23.0
cozy-jobs-cli 1.20.2
cozy-konnector-build 1.6.0
.travis.yml
node 16.20.2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.