diff --git a/app/lib/api_entreprise/entreprise_adapter.rb b/app/lib/api_entreprise/entreprise_adapter.rb index 3758e065b..377b7afb2 100644 --- a/app/lib/api_entreprise/entreprise_adapter.rb +++ b/app/lib/api_entreprise/entreprise_adapter.rb @@ -2,7 +2,8 @@ class ApiEntreprise::EntrepriseAdapter < ApiEntreprise::Adapter private def get_resource - ApiEntreprise::API.entreprise(@siret_or_siren, @procedure_id) + siren = @siret_or_siren[0..8] + ApiEntreprise::API.entreprise(siren, @procedure_id) end def process_params diff --git a/app/services/siret_service.rb b/app/services/siret_service.rb index 869039ea5..1aa089e01 100644 --- a/app/services/siret_service.rb +++ b/app/services/siret_service.rb @@ -3,7 +3,7 @@ class SIRETService procedure_id = dossier&.procedure_id etablissement_params = ApiEntreprise::EtablissementAdapter.new(siret, procedure_id).to_params - entreprise_params = ApiEntreprise::EntrepriseAdapter.new(siren(siret), procedure_id).to_params + entreprise_params = ApiEntreprise::EntrepriseAdapter.new(siret, procedure_id).to_params if etablissement_params.present? && entreprise_params.present? association_params = ApiEntreprise::RNAAdapter.new(siret, procedure_id).to_params @@ -23,10 +23,6 @@ class SIRETService end end - def self.siren(siret) - siret[0..8] - end - def self.handle_legacy_models!(params, entreprise_params, dossier, association_params) params[:entreprise_attributes] = entreprise_params.merge( {