Giter VIP home page Giter VIP logo

cozy-konnector-cesu's People

Contributors

aenario avatar clochix avatar dependabot[bot] avatar doubleface avatar killiancourvoisier avatar lucst avatar renovate-bot avatar renovate[bot] avatar sblaisot avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cozy-konnector-cesu's Issues

Handle received messages

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:

  • hasMsgAvert -> Avertissement -> Warning in the logs
  • hasMsgErrFonc -> Erreur Fonctionnelle -> Logic error, user error (Display to user + logs)
  • hasMsgErrTech -> Erreur Technique -> Technical error, unexpected error (Display to user + logs)
  • hasMsgInfo -> Information -> Info in the logs

(spinoff of #159)

Action Required: Fix Renovate Configuration

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.

No document synchronized

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.

Files sometimes aren't correctly downloaded

What ?

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.

Logs

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) :

1️⃣ First run :

Click to expand
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.

🔢 Subsequent run (without cleaning output folder) :

Click to expand
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.

  • On Cozy Cloud, 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?)
  • On standalone run it is created and populated with 0-bytes empty files with the correct name (YYYY-MM_XXXEUR.pdf), sometimes with bigger, corrupt files

Will 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.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
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
.travis.yml
  • node 16.20.2

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.