Commit graph

401 commits

Author SHA1 Message Date
Martin
1ee67d511d amelioration(mails): permet a nos mails d'inclure des balises <a> pour faciliter l'usage des mail envoyés 2023-02-06 11:01:28 +01:00
Martin
f952e42ad1 amelioration(BalancerDeliveryMethod): evite d'envoyer les mails av PJ car pour le moment c'est une fonction payante chez Dolist 🤯 2023-02-03 17:19:36 +01:00
Colin Darie
6b011b8b44 chore(dolist): helper so we know if mail is sendable by API 2023-02-02 16:11:52 +01:00
Colin Darie
6a3de1b57a chore(dolist): cache sender_id so we don't request it at each send 2023-02-02 16:02:27 +01:00
Colin Darie
9641a40ea7 chore(mailer): MailDeliveryError with original exception backtrace 2023-02-02 15:59:18 +01:00
Colin Darie
61cd9aa8c7 feat(dolist): send mail having attachments 2023-02-02 15:52:20 +01:00
Colin Darie
41c196f2ec
feat(dolist): send email from API
Co-authored-by: mfo <mfo@users.noreply.github.com>
2023-02-02 14:52:33 +01:00
Colin Darie
ef864021f7 refactor(pj_service): explicit options with_{bills,champs_private} because expert & instructeurs does not need the same 2023-01-30 18:04:09 +01:00
simon lehericey
84d08d4d24 fix(expert_export): an expert export excludes annotation and avis 2023-01-19 12:09:16 +01:00
Colin Darie
784b0458fe feat(dolist): consolidate dispatched events with delivered emails 2023-01-18 09:56:40 +01:00
Colin Darie
ce7e674159 feat(mailer): make errors interceptable by jobs so they will retry
Comme on intercepte chaque `StandardError` pour le monitoring des mails
en erreur, l'erreur n'était plus visible par le job, et les emails
étaient perdus.

A la place on re-raise une autre erreur pour que le job échoue afin de
retry plus tard. Pour ne pas être "avalée" par le rescue_from,
cette erreur doit héritée d'`Exception` plutôt que `StandardError`.

NB: il faudrait parvenir à écrire un test pour vérifier ce comportement.

Pour être vérifié en dev, il faut activer `raise_delivery_errors`
comme en production.
2023-01-17 14:26:11 +01:00
Martin
733ba01695 amelioration(balancer_delivery_method): implemente le fait de forcer la methode de delivery au niveau de notre balancer de fournisseur demail 2023-01-11 17:13:05 +01:00
Lisa Durand
8ba13cb685 humanize raison sociale from api_entreprise in adapter 2023-01-11 14:42:38 +01:00
Colin Darie
e63e4fc975 fix(sentry/rna): add error context when RNA schema failed 2023-01-11 12:30:02 +01:00
François Vantomme
08d276472b refactor(links): use localized FAQ URLs 2023-01-11 11:28:03 +01:00
Colin Darie
05b517a847
fix(mailer): observers on balancer and balanced delivery methods
- Les observers doivent être déclarés *avant*
  le chargement de nos delivery methods (Sendinblue & Dolist),
  sinon ils seront ignorés par ces derniers

- dans le balancer, on ne peut pas appeler `.deliver` une seconde fois,
  sinon les observers (et interceptors) sont invoqués deux fois.
2023-01-11 00:57:16 +01:00
Colin Darie
1f51267b25 chore(manager): link email users to events 2023-01-10 16:07:35 +01:00
Paul Chavard
c4a30084fe refactor(virus_scan): remove lock 2023-01-04 12:12:11 +01:00
Paul Chavard
6e18090fb3 refactor(virus_scan_result): use column instead of metadata on blob 2023-01-04 12:12:11 +01:00
simon lehericey
172a9d5599 feat(timestamp): add certigna 2022-12-07 19:28:01 +01:00
Paul Chavard
d306583a7b refactor(active_storage): PiecesJustificativesService::FakeAttachment -> ActiveStorage::FakeAttachment 2022-11-22 18:05:26 +01:00
Martin
2cd74d1010 amelioration(archives): positionne le fichier des reporting des erreurs en tête de l'arborescence 2022-10-20 15:14:57 +02:00
Damien Le Thiec
73f6063c87
Merge branch 'main' into feature/add_rna_type_de_champs 2022-10-11 15:36:46 +02:00
Colin Darie
073656342e fix(api_address): support Adresse BAN without postcode
Des adresses n'ont pas de code postal (dans certains TOM par exemple).
On fallback sur un string vide plutôt que nil pour limiter les effets de bord.
2022-10-11 12:25:12 +02:00
Damien Le Thiec
0d9f02c88d First draft autofetch data for RNA 2022-10-04 22:11:01 +02:00
Damien Le Thiec
ecd54de854 Extend RNA adapter while keeping depreciated version 2022-10-04 19:59:39 +02:00
Damien Le Thiec
542c5b518f Improve and connect RNA Adapter 2022-09-22 17:13:53 +02:00
Colin Darie
95a4e8a907
feat(api_entreprise): create etablissement with fallback when API is down
On créé l'établissement uniquement avec le SIRET, sans que ce soit bloquant
pour compléter le dossier. On demande à l'utilisateur de vérifier
lui-même la concordance du SIRET avec son entreprise.

Cf #7766
2022-09-16 10:43:59 +02:00
Colin Darie
d1c06aa92e feat(api_entreprise): add service api_up?, connected to their status page 2022-09-15 18:46:53 +02:00
Martin
cbe77dd2f6 bug(instructeurs/dossiers#telecharger_pjs): zipline does not play well with not available active storage attachments 2022-09-08 11:05:24 +02:00
Colin Darie
8762acc0b5 chore(services): fetch etablissement adresse from API Entreprise 2022-09-06 09:23:52 +02:00
Colin Darie
b75cff2fc3 refactor: API Entreprise instancified, more flexible for various input params
En fonction des resources, l'API est appelée :

- dans le contexte d'une Procedure ou non
- avec ou sans token injecté
- avec ou sans siret/siren
- avec ou sans user
2022-09-06 09:23:52 +02:00
Colin Darie
be965e4fdd fix(api_entreprise): don't fail with entreprise without date_creation 2022-09-05 15:52:06 +02:00
Kara Diaby
d18d89b41b modify Lib Datagouv API 2022-07-29 11:17:22 +02:00
Colin Darie
f05e9331a7 chore(entreprises): save etat_administratif from API 2022-07-25 10:58:02 +02:00
Christophe Robillard
e3206f3eec rename datagouv env var 2022-07-21 21:54:15 +02:00
Christophe Robillard
77a9a2ba12 can upload file to datagouv 2022-07-21 21:54:15 +02:00
simon lehericey
9c73bf1932 batch it 2022-07-20 15:48:16 +02:00
Colin Darie
d3232a28cd chore(api_entreprise): intercept token expiration for a more contextual frontend message
Auparavant le service échouait silencieusement et ne retournait rien,
ce qui dans les implémentations du front aboutissait au message que
l'établissement/l'entreprise n'a pas été trouvé.

Un type d'erreur spécifique sur l'expiration du token permet d'afficher
le message lié à un problème temporaire de récupération d'infos.
2022-07-18 09:57:19 +02:00
simon lehericey
14f841cdf2 show dolist logs to manager 2022-04-28 15:48:54 +02:00
Martin
55d77e33ed feat(ApiEntreprise.recipient): always use SIRET of dinum
Update config/env.example

Co-authored-by: LeSim <mail@simon.lehericey.net>
2022-04-27 14:30:50 +02:00
Paul Chavard
433c01b1e6 Revert "Merge pull request #7137 from betagouv/faster_pdf"
This reverts commit 9da44bd913, reversing
changes made to ebac71796c.
2022-04-12 19:22:07 +02:00
simon lehericey
4d3412daf5 batch it 2022-04-12 11:56:56 +02:00
simon lehericey
e1afb35ca2 fetch pjs_for_dossier by dossiers
put all bills in bills folder
2022-04-07 12:06:13 +02:00
simon lehericey
34b0578d70 pj_and_path only take dossier id 2022-04-07 12:06:13 +02:00
simon lehericey
7ac1288905 pj_service take a dossier collection ! 2022-04-07 12:06:13 +02:00
simon lehericey
51a6145d96 put dossier_pdf apart 2022-04-07 12:06:13 +02:00
simon lehericey
d5241381eb extract pj_path method 2022-04-07 12:06:13 +02:00
simon lehericey
97443e2ff6 inline create_list_from_dossier into caller 2022-04-07 12:06:13 +02:00
simon lehericey
51b71aaa01 always call create_list_from_dossiers 2022-04-07 12:06:13 +02:00
simon lehericey
cf79e340ef remove unused method 2022-04-07 12:06:13 +02:00
simon lehericey
3f7693ae13 style remove blank line 2022-04-07 12:06:13 +02:00
simon lehericey
bd0b88a410 move create_list_of_attachments 2022-04-05 11:55:14 +02:00
Martin
e765ef16fd fix(parallel_download_queue): appending content to file in those circumstances does not lead to good result. for now write response.body directly to the attachment [may lead to RAM overhead in case of big file... but i do not have another quick fix idea] 2022-04-01 18:22:28 +02:00
simon lehericey
31d52d2483 do not open all fd at once 2022-03-17 22:44:53 +01:00
Pierre de La Morinerie
3a16235868 db: Add a delete_orphans db helper 2022-03-08 14:47:43 +01:00
Pierre de La Morinerie
847abca122 config: simplify mailer configuration again
Move everything to initializers, and replace the email settings
interceptor by a BalancerDeliveryMethod.

It has the advantage that it can be configured entirely from the
`config/environment.rb` file, without an extra file to look at.
2022-02-08 12:44:43 +01:00
Pierre de La Morinerie
04cfc8ed9d config: use alternate delivery methods to configure ActionMailer
Previously `SENDINBLUE_BALANCING` was used only when
`SENDINBLUE_ENABLED` was *disabled* (otherwise only SendInBlue was ever
used).

This commit:

- Ensure that `SENDINBLUE_BALANCING` is used only when SendInBlue is
  *enabled* (which is more intuitive).
- Make it easier to add other delivery methods.
2022-02-08 12:44:43 +01:00
Pierre de La Morinerie
68fd3aea39 config: rename SOURCE to LOGRAGE_SOURCE 2022-01-19 15:43:44 +01:00
Martin
383a92bcd9 fix(parallel_download_queue): tophoeus does not like raise from a request handler [crash straight to first frame] 2022-01-07 14:24:37 +01:00
Martin
3eb1c1a421 feat(async_backend): switch to typhoeus 2022-01-04 16:27:23 +01:00
Martin
ce1b189dcd refactor(DownloadManager): extract parallel download in dedicated class. move error management in custom class for procedure exports using the didicated class 2022-01-04 16:17:03 +01:00
Martin
2ed9cccba0 extract download all attachments in dedicated class using async/async-http for better perf 2022-01-04 16:17:03 +01:00
François Vantomme
14e0c68266 feat(api particulier): add MESRI field 2021-12-16 16:45:18 +01:00
François Vantomme
115adbec70 style(api particulier): harmonize pole emploi resource name constant 2021-12-16 16:45:17 +01:00
François Vantomme
3d81d4b541 feat(api particulier): add MESRI adapter 2021-12-16 16:45:17 +01:00
François Vantomme
66a9109cd7 feat(api particulier): add MESRI support to sources service 2021-12-16 16:45:17 +01:00
simon lehericey
f0b0e7fd9a Switch to usage of zip unix binary to create archive. Also use a dedicated queue for DelayedJob
use dedicated archives queue

As the used disk space will increase, we want a fined grain control

move zip logic in dedicated method

zip

wip

wip

fix(spec): pass spec in green

tech(improvements): avoid File.delete(folder), favor FileUtils.remove_entry_secure which is safer. Also wrap most of code that open file within blocks so it is cleaned when the block ends. Lastly use  attachement.download to avoid big memory pressure [download in chunk, write in chunk] otherwise big file [124>1GO] are loaded in memory. what if we run multiple jobs/download in parallel ?

fix(spec): try to retry with grace

clean(procedure_archive_service_spec.rb): better retry [avoid to rewrite on open file]

lint(things): everything
2021-12-13 16:37:04 +01:00
Paul Chavard
b67818e425 feat(helpscout): add a tag to messages submited through contact form 2021-12-09 11:47:13 +01:00
François Vantomme
4cfc9f7d86 feat(api particulier): add Pole Emploi adapter 2021-12-08 10:36:11 +01:00
François Vantomme
cfb8c184fe perf(api particulier): use filter_map instead of map.compact
https://docs.rubocop.org/rubocop-performance/cops_performance.html#performancemapcompact
2021-12-08 10:36:11 +01:00
François Vantomme
a24cf18c9d feat (api particulier): add Pole Emploi support to sources service 2021-12-08 10:36:11 +01:00
Pierre de La Morinerie
c75dba701d lib: replace URI.encode by CGI.escape
URI.encode was removed in Ruby 3.

Fix an error when adding a phone number to a Helpscout ticket.
2021-12-07 15:25:26 +01:00
François Vantomme
f0913edebd feat(api particulier): add DGFiP adapter 2021-12-07 11:03:05 +01:00
François Vantomme
97de7c197d feat(api particulier): add DGFIP support to sources service 2021-12-07 11:03:05 +01:00
kara Diaby
9ee9389ba1 add the good retry_on StaleObjectError 2021-11-05 13:32:21 +01:00
simon lehericey
35c7f05a0a source service supports unknown scope 2021-10-12 14:27:20 +02:00
simon lehericey
b69dafc3d4 CNAF in lowercase 2021-10-12 14:26:40 +02:00
simon lehericey
17a2b5dc53 fix a strange encoding error 2021-10-12 14:26:40 +02:00
Pierre de La Morinerie
0b02fce5e4 jobs: move ActiveJobLogSubscriber out of initializers
This is a class of its own, it doesn't need to be in the initializers.
2021-10-12 11:40:19 +02:00
kara Diaby
6ef5b5d474 modify downloable file 2021-10-05 15:00:21 +02:00
simon lehericey
57604b9c89 add schema validations 2021-09-22 12:08:24 +02:00
simon lehericey
75043070da add CNAFAdapter 2021-09-22 12:08:24 +02:00
simon lehericey
a7651e3772 add api composition_familiale 2021-09-22 12:08:24 +02:00
simon lehericey
ceb09c5967 api remove useless symbolize 2021-09-22 12:08:24 +02:00
simon lehericey
07962cc2c7 service: match remote keys 2021-09-22 12:08:24 +02:00
simon lehericey
8d747ff16e add sanitize method to service 2021-09-21 11:21:10 -05:00
Pierre de La Morinerie
6656d1130b i18n: refactor admin support locales
This allow i18n-tasks to better detect dynamic keys.
2021-09-21 10:44:20 -05:00
Pierre de La Morinerie
f9220891a7 i18n: refactor user support locales
This allow i18n-tasks to better detect dynamic keys.
2021-09-21 10:44:20 -05:00
simon lehericey
8327c6fd0c add ApiParticulier::Service::Sources 2021-09-17 13:50:23 +02:00
simon lehericey
87cb16093f fetch token introspection
Co-authored-by: François VANTOMME <akarzim@gmail.com>
2021-09-15 14:37:04 +02:00
Christophe Robillard
ddea0b9a45 purge old sendinblue mails 2021-08-20 08:52:39 +02:00
Paul Chavard
44ebd0e8a5 Fix api education wrong data type 2021-06-08 12:25:24 +02:00
Paul Chavard
01c558953b Remove API GEO legacy adapter 2021-05-24 11:50:16 +02:00
Christophe Robillard
01f180022b prend en compte uniquement les pj pour estimer la taille d'un dossier 2021-05-04 12:50:12 +02:00
Pierre de La Morinerie
13d2364fd5 jobs: add Excon::Error::Socket to the list of transient errors
In ActiveStorage::Purge job we see a lot of SSL errors:

> Connection reset by peer - SSL_connect (Errno::ECONNRESET)

These errors seem transient, and resolve themselves after a while.
2021-05-04 11:38:22 +02:00
Christophe Robillard
3d04221dab generate pdf export for dossier only on demand 2021-04-29 17:30:38 +02:00
Christophe Robillard
f40d96fbd2 Revert "Revert "Export de tous les dossier d'une démarche""
This reverts commit d9a588b52e.
2021-04-29 17:29:47 +02:00
krichtof
d9a588b52e
Revert "Export de tous les dossier d'une démarche" 2021-04-29 16:07:18 +02:00
Pierre de La Morinerie
2cb6ec7c51 jobs: add more transient errors
These errors occur frequently during interactions with OVH's
ObjectStorage.
2021-04-29 14:08:12 +02:00