egov_utils 1.5.0.alpha9 → 1.5.0.alpha11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/egov_utils/eGovUtilities.coffee.erb +1 -0
- data/app/services/egov_utils/iszr/addresses/fetch_for_legal_person.rb +1 -1
- data/app/services/egov_utils/iszr/find_address_by_ico.rb +78 -0
- data/app/services/egov_utils/iszr/find_person_by_ico.rb +63 -0
- data/app/services/egov_utils/iszr/legal_people/create_request.rb +43 -15
- data/app/services/egov_utils/iszr/legal_people/search.rb +1 -1
- data/app/services/egov_utils/iszr/legal_people/search_by_remote_id.rb +10 -2
- data/app/services/egov_utils/iszr/natural_people/create_request.rb +0 -1
- data/app/views/egov_utils/people/_new_form.html.haml +21 -21
- data/lib/egov_utils/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ed4c6bdd27ab9c2423bc2e68e5fd8b06d5e21d2f2e411e52e52dc066db560c3
|
4
|
+
data.tar.gz: d4d4fec938a553811e3d8889055a0863f57f3ea66f5788a6ac6112230ff1d827
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 165986c704bcb0dbe843eb4ad1492dcf449e99141efd6ad6691d65d1ccc709ca37c88773c09e36a45c212538369ae2df4edb3a4ef5615108ca5e3fd21f2d4e3f
|
7
|
+
data.tar.gz: 387830b245543af1c1b0f239706ef927c6d4cba2c55a54dfb1c8dfdcc51c08ac7ebf652c6a8d7d275040a2fd1fb9236e0e2c4052d881e80546503c13db9b9237
|
@@ -70,6 +70,7 @@ window.eGovUtilities =
|
|
70
70
|
$form = $(this).closest('.person-form');
|
71
71
|
$form.find('.natural_person').toggle( val == 'natural').find(':input').prop('disabled', val != 'natural');
|
72
72
|
$form.find('.legal_person').toggle( val == 'legal').find(':input').prop('disabled', val != 'legal');
|
73
|
+
$form.find("input[name*='[remote_id]']").val('');
|
73
74
|
)
|
74
75
|
$type_toggles.each (index)->
|
75
76
|
$el = $(this)
|
@@ -12,7 +12,7 @@ module EgovUtils
|
|
12
12
|
|
13
13
|
def strategy_class
|
14
14
|
if Rails.env.production?
|
15
|
-
EgovUtils::Iszr::
|
15
|
+
EgovUtils::Iszr::FindAddressByIco
|
16
16
|
else
|
17
17
|
EgovUtils::Iszr::Addresses::FetchForLegalPerson::FromSampleData
|
18
18
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
module Iszr
|
3
|
+
module LegalPeople
|
4
|
+
class FindAddressByIco < Request
|
5
|
+
string :remote_id
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def handle_response!
|
10
|
+
EgovUtils::Address.new(
|
11
|
+
street:
|
12
|
+
response_body.xpath('//UliceNazev').text.presence || response_body.xpath('//CastObceNazev').text,
|
13
|
+
house_number: response_body.xpath('//CisloDomovni').text,
|
14
|
+
orientation_number: response_body.xpath('//CisloOrientacni').text,
|
15
|
+
city: response_body.xpath('//ObecNazev').text,
|
16
|
+
postcode: response_body.xpath('//PostaKod').text,
|
17
|
+
egov_identifier: response_body.xpath('//AdresniMistoKod').text,
|
18
|
+
country: 203,
|
19
|
+
district: district.name,
|
20
|
+
region: region.name
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def body
|
25
|
+
Nokogiri::XML::Builder.new do |xml|
|
26
|
+
xml['e256'].RosCtiIco2(
|
27
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
28
|
+
'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:IszrRosCtiIco2:v1 IszrRosCtiIco2.xsd',
|
29
|
+
'xmlns:abs' => 'urn:cz:isvs:iszr:schemas:IszrAbstract:v1',
|
30
|
+
'xmlns:e256' => 'urn:cz:isvs:iszr:schemas:IszrRosCtiIco2:v1',
|
31
|
+
'xmlns:reg' => 'urn:cz:isvs:reg:schemas:RegTypy:v1',
|
32
|
+
'xmlns:ros' => 'urn:cz:isvs:ros:schemas:RosDotazyData:v2'
|
33
|
+
) {
|
34
|
+
xml['abs'].ZadostInfo {
|
35
|
+
xml['reg'].CasZadosti Time.current.iso8601
|
36
|
+
xml['reg'].Agenda EgovUtils::Settings['iszr']['agenda']
|
37
|
+
xml['reg'].AgendovaRole EgovUtils::Settings['iszr']['agendova_role']
|
38
|
+
xml['reg'].Ovm '00025429'
|
39
|
+
xml['reg'].Ais EgovUtils::Settings['iszr']['ais']
|
40
|
+
xml['reg'].Subjekt '00025429'
|
41
|
+
xml['reg'].Uzivatel 'Administrator'
|
42
|
+
xml['reg'].DuvodUcel 'ztotozneni'
|
43
|
+
xml['reg'].AgendaZadostId SecureRandom.uuid
|
44
|
+
}
|
45
|
+
xml['abs'].AutorizaceInfo {
|
46
|
+
xml['abs'].SeznamUdaju 'ObchodniNazev AdresaSidla ROBCti ROSCti RUIANCti'
|
47
|
+
}
|
48
|
+
xml['e256'].Zadost {
|
49
|
+
xml['e256'].RosCtiIco2Data {
|
50
|
+
xml['ros'].Ico remote_id
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def response_error_code
|
58
|
+
@response_error_code ||=
|
59
|
+
response_body.xpath('//VysledekSubKod').last&.text&.presence
|
60
|
+
end
|
61
|
+
|
62
|
+
def internal_error_code
|
63
|
+
return unless response_error_code
|
64
|
+
|
65
|
+
if response_error_code == 'ZAZNAM NENALEZEN'
|
66
|
+
"not_found"
|
67
|
+
elsif response_error_code == 'PREKROCEN POCET'
|
68
|
+
"multiple_records_found"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def service_id
|
73
|
+
'E256'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EgovUtils
|
4
|
+
module Iszr
|
5
|
+
class FindPersonByAifo < Request
|
6
|
+
string :remote_id
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def handle_response!
|
11
|
+
{
|
12
|
+
name: response_body.xpath('//OsobaNazev').text.capitalize,
|
13
|
+
ico: remote_id
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
def body
|
18
|
+
Nokogiri::XML::Builder.new do |xml|
|
19
|
+
xml[service_id].RobCtiAifo2(
|
20
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
21
|
+
'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiAifo2:v1 IszrRobCtiAifo2.xsd',
|
22
|
+
'xmlns:abs' => 'urn:cz:isvs:iszr:schemas:IszrAbstract:v1',
|
23
|
+
'xmlns:E276' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiAifo2:v1',
|
24
|
+
'xmlns:reg' => 'urn:cz:isvs:reg:schemas:RegTypy:v1',
|
25
|
+
'xmlns:rod' => 'urn:cz:isvs:rob:schemas:RobDotazyData:v1',
|
26
|
+
'xmlns:rob' => 'urn:cz:isvs:rob:schemas:RobTypy:v1'
|
27
|
+
) {
|
28
|
+
xml['abs'].ZadostInfo {
|
29
|
+
xml['reg'].CasZadosti Time.current.iso8601
|
30
|
+
xml['reg'].Agenda EgovUtils::Settings['iszr']['agenda']
|
31
|
+
xml['reg'].AgendovaRole EgovUtils::Settings['iszr']['agendova_role']
|
32
|
+
xml['reg'].Ovm '00025429'
|
33
|
+
xml['reg'].Ais EgovUtils::Settings['iszr']['ais']
|
34
|
+
xml['reg'].Subjekt '00025429'
|
35
|
+
xml['reg'].Uzivatel 'Administrator'
|
36
|
+
xml['reg'].DuvodUcel 'ztotozneni'
|
37
|
+
xml['reg'].AgendaZadostId SecureRandom.uuid
|
38
|
+
}
|
39
|
+
xml['abs'].AutorizaceInfo {
|
40
|
+
xml['abs'].SeznamUdaju 'Aifo Prijmeni Jmeno DatumNarozeni RUIANCti AdresaPobytu MistoNarozeni'
|
41
|
+
}
|
42
|
+
xml['abs'].MapaAifo(nacistData: true) {
|
43
|
+
xml['reg'].PrevodAifo {
|
44
|
+
xml['reg'].LokalniAifo 1
|
45
|
+
xml['reg'].GlobalniAifo remote_id
|
46
|
+
}
|
47
|
+
}
|
48
|
+
xml[service_id].Zadost {
|
49
|
+
xml[service_id].RobCtiAifo2Data {
|
50
|
+
xml['rod'].Aifo 1
|
51
|
+
xml['rod'].VyuzitiPoskytnuti 'poskytnuti'
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def service_id
|
59
|
+
'E276'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -6,32 +6,45 @@ module EgovUtils
|
|
6
6
|
|
7
7
|
private
|
8
8
|
|
9
|
+
def handle_response!
|
10
|
+
if internal_error_code
|
11
|
+
errors.add(:base, internal_error_code)
|
12
|
+
return
|
13
|
+
end
|
14
|
+
|
15
|
+
EgovUtils::Services::Iszr::LegalPeople.new(
|
16
|
+
name: response_body.xpath('//NazevOsoby').text.capitalize,
|
17
|
+
ico: response_body.xpath('//Ico').text,
|
18
|
+
remote_id: response_body.xpath('//Ico').text
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
9
22
|
def body
|
10
23
|
Nokogiri::XML::Builder.new do |xml|
|
11
|
-
xml['
|
24
|
+
xml['e256'].RosCtiIco2(
|
12
25
|
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
13
|
-
'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:
|
26
|
+
'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:IszrRosCtiIco2:v1 IszrRosCtiIco2.xsd',
|
14
27
|
'xmlns:abs' => 'urn:cz:isvs:iszr:schemas:IszrAbstract:v1',
|
15
|
-
'xmlns:
|
28
|
+
'xmlns:e256' => 'urn:cz:isvs:iszr:schemas:IszrRosCtiIco2:v1',
|
16
29
|
'xmlns:reg' => 'urn:cz:isvs:reg:schemas:RegTypy:v1',
|
17
30
|
'xmlns:ros' => 'urn:cz:isvs:ros:schemas:RosDotazyData:v2'
|
18
31
|
) {
|
19
32
|
xml['abs'].ZadostInfo {
|
20
|
-
xml['reg'].CasZadosti Time.current
|
21
|
-
xml['reg'].Agenda '
|
22
|
-
xml['reg'].AgendovaRole '
|
33
|
+
xml['reg'].CasZadosti Time.current.iso8601
|
34
|
+
xml['reg'].Agenda EgovUtils::Settings['iszr']['agenda']
|
35
|
+
xml['reg'].AgendovaRole EgovUtils::Settings['iszr']['agendova_role']
|
23
36
|
xml['reg'].Ovm '00025429'
|
24
|
-
xml['reg'].Ais '
|
25
|
-
xml['reg'].
|
26
|
-
xml['reg'].
|
37
|
+
xml['reg'].Ais EgovUtils::Settings['iszr']['ais']
|
38
|
+
xml['reg'].Subjekt '00025429'
|
39
|
+
xml['reg'].Uzivatel 'Administrator'
|
40
|
+
xml['reg'].DuvodUcel 'ztotozneni'
|
41
|
+
xml['reg'].AgendaZadostId SecureRandom.uuid
|
27
42
|
}
|
28
43
|
xml['abs'].AutorizaceInfo {
|
29
|
-
xml['abs'].SeznamUdaju '
|
30
|
-
FyzickaOsoba AdresaSidla Provozovny StatutarniOrgany DatumVznikuOpravneni DatumZanikuOpravneni
|
31
|
-
Ico Jmeno Prijmeni AdresaPobytu AdresaUradu ROBCti ROSCti RUIANCti'
|
44
|
+
xml['abs'].SeznamUdaju 'ObchodniNazev AdresaSidla ROBCti ROSCti RUIANCti'
|
32
45
|
}
|
33
|
-
xml['
|
34
|
-
xml['
|
46
|
+
xml['e256'].Zadost {
|
47
|
+
xml['e256'].RosCtiIco2Data {
|
35
48
|
xml['ros'].Ico ico
|
36
49
|
}
|
37
50
|
}
|
@@ -39,8 +52,23 @@ module EgovUtils
|
|
39
52
|
end
|
40
53
|
end
|
41
54
|
|
55
|
+
def response_error_code
|
56
|
+
@response_error_code ||=
|
57
|
+
response_body.xpath('//VysledekSubKod').last&.text&.presence
|
58
|
+
end
|
59
|
+
|
60
|
+
def internal_error_code
|
61
|
+
return unless response_error_code
|
62
|
+
|
63
|
+
if response_error_code == 'ZAZNAM NENALEZEN'
|
64
|
+
"not_found"
|
65
|
+
elsif response_error_code == 'PREKROCEN POCET'
|
66
|
+
"multiple_records_found"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
42
70
|
def service_id
|
43
|
-
'
|
71
|
+
'E256'
|
44
72
|
end
|
45
73
|
end
|
46
74
|
end
|
@@ -9,12 +9,20 @@ module EgovUtils
|
|
9
9
|
string :remote_id
|
10
10
|
|
11
11
|
def execute
|
12
|
-
|
12
|
+
if Rails.env.production?
|
13
|
+
find_remote_person
|
14
|
+
else
|
15
|
+
find_local_person
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
private
|
16
20
|
|
17
|
-
def
|
21
|
+
def find_remote_person
|
22
|
+
EgovUtils::Iszr::FindPersonByIco.run!(remote_id:)
|
23
|
+
end
|
24
|
+
|
25
|
+
def find_local_person
|
18
26
|
initialize_person.find do |person|
|
19
27
|
person.remote_id == remote_id
|
20
28
|
end
|
@@ -18,27 +18,27 @@
|
|
18
18
|
= label_tag 'birth_date', 'Datum narození'
|
19
19
|
= date_field_tag :birth_date, {}, class: 'form-control'
|
20
20
|
= link_to 'Vyhledat', {}, class: 'btn btn-primary'
|
21
|
-
.legal_person
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
21
|
+
-# .legal_person
|
22
|
+
-# .row
|
23
|
+
-# = form.fields_for(:legal_person, person.legal_person || EgovUtils::LegalPerson.new) do |fields|
|
24
|
+
-# .col-12= fields.text_field(:name)
|
25
|
+
-# .col-12.col-sm-6= fields.text_field(:ico)
|
26
|
+
-# .col-12.col-sm-6= fields.select2 :legal_form, list_values_for_select(azahara_attribute_for(EgovUtils::LegalPerson, 'legal_form'))
|
27
|
+
-# .row
|
28
|
+
-# .col-12
|
29
|
+
-# = form.fields_for(:residence, person.residence || EgovUtils::Address.new) do |fields|
|
30
|
+
-# = render 'egov_utils/addresses/form', form: fields, address: fields.object
|
31
|
+
|
32
|
+
.legal-person-row.identification-form.legal_person.row
|
33
|
+
.col-12
|
34
|
+
.card
|
35
|
+
.card-header Ztotožnění právnické osoby
|
36
|
+
.card-body
|
37
|
+
.form
|
38
|
+
.form-group
|
39
|
+
= label_tag 'ico', 'IČO'
|
40
|
+
= text_field_tag :ico, {}, class: 'form-control'
|
41
|
+
= link_to 'Vyhledat', nil, class: 'btn btn-primary'
|
42
42
|
= form.hidden_field :remote_id
|
43
43
|
|
44
44
|
:javascript
|
data/lib/egov_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: egov_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.0.
|
4
|
+
version: 1.5.0.alpha11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondřej Ezr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -674,7 +674,9 @@ files:
|
|
674
674
|
- app/services/egov_utils/iszr/addresses/fetch_for_natural_person/from_sample_data.rb
|
675
675
|
- app/services/egov_utils/iszr/client.rb
|
676
676
|
- app/services/egov_utils/iszr/find_address_by_aifo.rb
|
677
|
+
- app/services/egov_utils/iszr/find_address_by_ico.rb
|
677
678
|
- app/services/egov_utils/iszr/find_person_by_aifo.rb
|
679
|
+
- app/services/egov_utils/iszr/find_person_by_ico.rb
|
678
680
|
- app/services/egov_utils/iszr/legal_people/create_request.rb
|
679
681
|
- app/services/egov_utils/iszr/legal_people/dev_search.rb
|
680
682
|
- app/services/egov_utils/iszr/legal_people/prod_search.rb
|