Merge branch 'develop' into staging
This commit is contained in:
commit
49aaa0a87e
8 changed files with 8 additions and 64 deletions
|
@ -86,8 +86,7 @@ class Users::DossiersController < UsersController
|
||||||
end
|
end
|
||||||
rescue RestClient::ResourceNotFound, RestClient::BadRequest
|
rescue RestClient::ResourceNotFound, RestClient::BadRequest
|
||||||
errors_valid_siret
|
errors_valid_siret
|
||||||
rescue RestClient::ServiceUnavailable
|
|
||||||
render '/dossiers/degraded', formats: 'js'
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
flash.alert = t('errors.messages.dossier_not_found')
|
flash.alert = t('errors.messages.dossier_not_found')
|
||||||
redirect_to url_for users_dossiers_path
|
redirect_to url_for users_dossiers_path
|
||||||
|
|
|
@ -7,14 +7,10 @@ class DossierService
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossier_informations!
|
def dossier_informations!
|
||||||
@entreprise_adapter = SIADE::EntrepriseAdapter.new(DossierService.siren @siret).to_params
|
@entreprise_adapter = SIADE::EntrepriseAdapter.new(DossierService.siren @siret)
|
||||||
|
|
||||||
if @entreprise_adapter[:http_code] == 404
|
if @entreprise_adapter.to_params.nil?
|
||||||
raise RestClient::ResourceNotFound
|
raise RestClient::ResourceNotFound
|
||||||
elsif @entreprise_adapter[:http_code] == 503 ||
|
|
||||||
@entreprise_adapter[:http_code] == 500 ||
|
|
||||||
@entreprise_adapter[:http_code] == 400
|
|
||||||
raise RestClient::ServiceUnavailable
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@etablissement_adapter = SIADE::EtablissementAdapter.new(@siret)
|
@etablissement_adapter = SIADE::EtablissementAdapter.new(@siret)
|
||||||
|
@ -38,6 +34,7 @@ class DossierService
|
||||||
@dossier
|
@dossier
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def self.siren siret
|
def self.siren siret
|
||||||
siret[0..8]
|
siret[0..8]
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
<% if flash.empty? %>
|
|
||||||
$('.row.etape.etape_2').hide(300, render_new_siret);
|
|
||||||
$('.row.etape.etape_2').slideDown(400, the_terms);
|
|
||||||
toggle_etape_1();
|
|
||||||
<% else %>
|
|
||||||
error_form_siret('<%= invalid_siret %>');
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% flash.clear %>
|
|
||||||
|
|
||||||
function render_new_siret(){
|
|
||||||
$('.row.etape.etape_2').html("<%= escape_javascript(render partial: '/dossiers/etapes/etape2_degraded', locals: { facade: @facade } ) %>");
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
= render partial: 'dossiers/etapes/etape_2/degraded'
|
|
|
@ -1,23 +0,0 @@
|
||||||
.etape.etapes_menu.col-md-3.col-lg-3
|
|
||||||
%h3
|
|
||||||
Mes informations
|
|
||||||
%br
|
|
||||||
|
|
||||||
.etape.etapes_informations.col-md-9.col-lg-9
|
|
||||||
.row
|
|
||||||
#recap_info_entreprise
|
|
||||||
%h3.text-warning
|
|
||||||
INSEE Indisponible
|
|
||||||
|
|
||||||
%p
|
|
||||||
%b
|
|
||||||
Notre partenaire l'INSEE est actuellement indisponible. Nous ne pouvons donc pas récupérer les informations de votre entreprise. Une fois de retour, vos informations seront automatiquement ajoutées à votre dossier.
|
|
||||||
|
|
||||||
%br
|
|
||||||
= form_for @facade.dossier, url: { controller: '/users/dossiers', action: :update } do |f|
|
|
||||||
= f.hidden_field :id
|
|
||||||
%label{ style:'font-weight:normal' }
|
|
||||||
= f.check_box :autorisation_donnees
|
|
||||||
J'autorise les décideurs publics à vérifier les informations de mon organisation auprès des administrations concernées. Ces informations resteront strictement confidentielles.
|
|
||||||
%br
|
|
||||||
= f.submit 'Etape suivante', class: "btn btn btn-info", style: 'float:right', id: 'etape_suivante', disabled: :disabled
|
|
|
@ -4,19 +4,9 @@ class SIADE::EntrepriseAdapter
|
||||||
end
|
end
|
||||||
|
|
||||||
def data_source
|
def data_source
|
||||||
@data_source ||= JSON.parse(SIADE::API.entreprise(@siren), symbolize_names: true).merge(http_code: 200)
|
@data_source ||= JSON.parse(SIADE::API.entreprise(@siren), symbolize_names: true)
|
||||||
rescue RestClient::ServiceUnavailable
|
rescue
|
||||||
@data_source = {http_code: 503}
|
@data_source = nil
|
||||||
rescue RestClient::ResourceNotFound
|
|
||||||
@data_source = {http_code: 404}
|
|
||||||
rescue RestClient::InternalServerError
|
|
||||||
@data_source = {http_code: 500}
|
|
||||||
rescue => e
|
|
||||||
if e.http_code == 400
|
|
||||||
@data_source = {http_code: 400}
|
|
||||||
else
|
|
||||||
@data_source = nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_params
|
def to_params
|
||||||
|
@ -29,7 +19,7 @@ class SIADE::EntrepriseAdapter
|
||||||
|
|
||||||
params
|
params
|
||||||
rescue
|
rescue
|
||||||
data_source
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def attr_to_fetch
|
def attr_to_fetch
|
||||||
|
|
|
@ -15,9 +15,6 @@ describe SIADE::API do
|
||||||
it 'raises RestClient::ResourceNotFound' do
|
it 'raises RestClient::ResourceNotFound' do
|
||||||
expect { subject }.to raise_error(RestClient::ResourceNotFound)
|
expect { subject }.to raise_error(RestClient::ResourceNotFound)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(subject.http_code).to eq status }
|
|
||||||
|
|
||||||
end
|
end
|
||||||
context 'when siret exist' do
|
context 'when siret exist' do
|
||||||
let(:siren) { '418166096' }
|
let(:siren) { '418166096' }
|
||||||
|
|
|
@ -12,8 +12,6 @@ describe SIADE::EntrepriseAdapter do
|
||||||
expect(subject).to be_an_instance_of(Hash)
|
expect(subject).to be_an_instance_of(Hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(described_class.new('418166096').data_source[:http_code]).to eq 200 }
|
|
||||||
|
|
||||||
context 'Attributs Entreprises' do
|
context 'Attributs Entreprises' do
|
||||||
it 'L\'entreprise contient bien un siren' do
|
it 'L\'entreprise contient bien un siren' do
|
||||||
expect(subject[:siren]).to eq('418166096')
|
expect(subject[:siren]).to eq('418166096')
|
||||||
|
|
Loading…
Reference in a new issue