diff --git a/app/controllers/champs/siret_controller.rb b/app/controllers/champs/siret_controller.rb index b1fb41b55..cbe0a70ad 100644 --- a/app/controllers/champs/siret_controller.rb +++ b/app/controllers/champs/siret_controller.rb @@ -14,7 +14,7 @@ class Champs::SiretController < ApplicationController end @error = "SIRET invalide" else - etablissement_attributes = SIRETService.fetch(siret, @champ.dossier.procedure_id) + etablissement_attributes = ApiEntrepriseService.get_etablissement_params_for_siret(siret, @champ.dossier.procedure_id) if etablissement_attributes.present? @etablissement = @champ.build_etablissement(etablissement_attributes) @etablissement.champ = @champ diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index 12fd0573a..f02b3b992 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -107,7 +107,7 @@ class Users::DossiersController < UsersController update_current_user_siret!(siret) - etablissement_attributes = SIRETService.fetch(siret, @facade.dossier.procedure_id, @facade.dossier) + etablissement_attributes = ApiEntrepriseService.get_etablissement_params_for_siret(siret, @facade.dossier.procedure_id, @facade.dossier) if etablissement_attributes.present? etablissement_attributes = ActionController::Parameters.new(etablissement_attributes).permit! diff --git a/app/jobs/etablissement_update_job.rb b/app/jobs/etablissement_update_job.rb index 10566f8cf..fa85e144c 100644 --- a/app/jobs/etablissement_update_job.rb +++ b/app/jobs/etablissement_update_job.rb @@ -2,7 +2,7 @@ class EtablissementUpdateJob < ApplicationJob queue_as :default def perform(dossier, siret) - etablissement_attributes = SIRETService.fetch(siret, dossier.procedure_id, dossier) + etablissement_attributes = ApiEntrepriseService.get_etablissement_params_for_siret(siret, dossier.procedure_id, dossier) if etablissement_attributes.present? if dossier.entreprise.present? diff --git a/app/services/siret_service.rb b/app/services/api_entreprise_service.rb similarity index 91% rename from app/services/siret_service.rb rename to app/services/api_entreprise_service.rb index a037fe2b5..ea77019a9 100644 --- a/app/services/siret_service.rb +++ b/app/services/api_entreprise_service.rb @@ -1,5 +1,5 @@ -class SIRETService - def self.fetch(siret, procedure_id, dossier = nil) +class ApiEntrepriseService + def self.get_etablissement_params_for_siret(siret, procedure_id, dossier = nil) etablissement_params = ApiEntreprise::EtablissementAdapter.new(siret, procedure_id).to_params entreprise_params = ApiEntreprise::EntrepriseAdapter.new(siret, procedure_id).to_params