commit
79b0d8a407
4 changed files with 5 additions and 5 deletions
|
@ -14,7 +14,7 @@ class Champs::SiretController < ApplicationController
|
||||||
end
|
end
|
||||||
@error = "SIRET invalide"
|
@error = "SIRET invalide"
|
||||||
else
|
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?
|
if etablissement_attributes.present?
|
||||||
@etablissement = @champ.build_etablissement(etablissement_attributes)
|
@etablissement = @champ.build_etablissement(etablissement_attributes)
|
||||||
@etablissement.champ = @champ
|
@etablissement.champ = @champ
|
||||||
|
|
|
@ -107,7 +107,7 @@ class Users::DossiersController < UsersController
|
||||||
|
|
||||||
update_current_user_siret!(siret)
|
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?
|
if etablissement_attributes.present?
|
||||||
etablissement_attributes = ActionController::Parameters.new(etablissement_attributes).permit!
|
etablissement_attributes = ActionController::Parameters.new(etablissement_attributes).permit!
|
||||||
|
|
|
@ -2,7 +2,7 @@ class EtablissementUpdateJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
def perform(dossier, siret)
|
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 etablissement_attributes.present?
|
||||||
if dossier.entreprise.present?
|
if dossier.entreprise.present?
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class SIRETService
|
class ApiEntrepriseService
|
||||||
def self.fetch(siret, procedure_id, dossier = nil)
|
def self.get_etablissement_params_for_siret(siret, procedure_id, dossier = nil)
|
||||||
etablissement_params = ApiEntreprise::EtablissementAdapter.new(siret, procedure_id).to_params
|
etablissement_params = ApiEntreprise::EtablissementAdapter.new(siret, procedure_id).to_params
|
||||||
entreprise_params = ApiEntreprise::EntrepriseAdapter.new(siret, procedure_id).to_params
|
entreprise_params = ApiEntreprise::EntrepriseAdapter.new(siret, procedure_id).to_params
|
||||||
|
|
Loading…
Reference in a new issue