egov_utils 1.4.3 → 1.5.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/egov_utils/iszr_controller.rb +37 -0
- data/app/models/concerns/types.rb +3 -0
- data/app/models/egov_utils/abstract_person.rb +0 -2
- data/app/models/egov_utils/natural_person.rb +1 -1
- data/app/models/egov_utils/person.rb +46 -1
- data/app/models/egov_utils/services/iszr/legal_people.rb +11 -0
- data/app/models/egov_utils/services/iszr/natural_people.rb +13 -0
- data/app/modules/envelope.rb +22 -0
- data/app/services/egov_utils/iszr/addresses/fetch.rb +27 -0
- data/app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb +31 -0
- data/app/services/egov_utils/iszr/addresses/fetch_for_legal_person.rb +23 -0
- data/app/services/egov_utils/iszr/addresses/fetch_for_natural_person/from_sample_data.rb +31 -0
- data/app/services/egov_utils/iszr/addresses/fetch_for_natural_person.rb +23 -0
- data/app/services/egov_utils/iszr/legal_people/create_request.rb +48 -0
- data/app/services/egov_utils/iszr/legal_people/dev_search.rb +39 -0
- data/app/services/egov_utils/iszr/legal_people/prod_search.rb +47 -0
- data/app/services/egov_utils/iszr/legal_people/search.rb +30 -0
- data/app/services/egov_utils/iszr/legal_people/search_by_remote_id.rb +39 -0
- data/app/services/egov_utils/iszr/natural_people/create_request.rb +97 -0
- data/app/services/egov_utils/iszr/natural_people/dev_search.rb +87 -0
- data/app/services/egov_utils/iszr/natural_people/prod_search.rb +91 -0
- data/app/services/egov_utils/iszr/natural_people/search.rb +31 -0
- data/app/services/egov_utils/iszr/natural_people/search_by_remote_id.rb +39 -0
- data/app/services/egov_utils/iszr/request.rb +36 -0
- data/app/services/egov_utils/registration_requests/check_auto_accept.rb +1 -1
- data/app/views/egov_utils/people/_new_form.html.haml +127 -0
- data/config/locales/cs.yml +8 -0
- data/config/locales/en.yml +7 -0
- data/config/routes.rb +1 -1
- data/lib/egov_utils/engine.rb +3 -0
- data/lib/egov_utils/iszr/e05_osoby_response.xml +87 -0
- data/lib/egov_utils/iszr/e20_ico_response.xml +70 -0
- data/lib/egov_utils/iszr/lp_addresses.json +112 -0
- data/lib/egov_utils/iszr/lp_results.json +52 -0
- data/lib/egov_utils/iszr/np_addresses.json +90 -0
- data/lib/egov_utils/iszr/np_results.json +58 -0
- data/lib/egov_utils/version.rb +1 -1
- metadata +102 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d41aad5c6d41d126b0bf8c535c3ee7b93ae029fb941aaf56a2fa50122e81c86f
|
4
|
+
data.tar.gz: 85b31bd2904bf438a71671b591bd163c15fc5c40901f32760b3631aa138d77ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce7a35bd5dce15d5b01e16ba0c9c55af05885572339881fed1c81cb170c8e0af73d3c368f9fd78ae20ef8f743f22bf7cfb8ed28a0436681cb82d2e02a85a7f91
|
7
|
+
data.tar.gz: b6e660e7e2fca843d0e06887b18c8659cdb0c316d59982b75cf5f0637fee5dd30a140c605664e054163392e850f20d4a3fea19d3c5a9aa7c29b5ac0db7a677c5
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
class IszrController < ApplicationController
|
3
|
+
|
4
|
+
def search
|
5
|
+
if params.dig(:search, :ico).present?
|
6
|
+
@legal_person = EgovUtils::Iszr::LegalPeople::Search.run(search_params)
|
7
|
+
|
8
|
+
if @legal_person.valid?
|
9
|
+
render json: @legal_person.result
|
10
|
+
else
|
11
|
+
render json: @legal_person.errors.details, status: :unprocessable_entity
|
12
|
+
end
|
13
|
+
else
|
14
|
+
@natural_person = EgovUtils::Iszr::NaturalPeople::Search.run(
|
15
|
+
search_params
|
16
|
+
)
|
17
|
+
if @natural_person.valid?
|
18
|
+
render json: @natural_person.result
|
19
|
+
else
|
20
|
+
render json: @natural_person.errors.details, status: :unprocessable_entity
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def search_params
|
28
|
+
params.require(:search).permit(
|
29
|
+
:ico,
|
30
|
+
:firstname,
|
31
|
+
:lastname,
|
32
|
+
:birth_date,
|
33
|
+
:birth_place
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -4,7 +4,7 @@ module EgovUtils
|
|
4
4
|
belongs_to :person, class_name: 'EgovUtils::Person'
|
5
5
|
|
6
6
|
validates :firstname, :lastname, :birth_date, presence: true
|
7
|
-
validates :birth_date,
|
7
|
+
validates :birth_date, birthday: true
|
8
8
|
|
9
9
|
def fullname
|
10
10
|
firstname.to_s + ' ' + lastname.to_s
|
@@ -11,11 +11,22 @@ module EgovUtils
|
|
11
11
|
enum person_type: { natural: 1, legal: 16 }
|
12
12
|
|
13
13
|
validates :person_entity, presence: true
|
14
|
+
before_validation :set_residence_from_remote_id
|
14
15
|
|
15
16
|
accepts_nested_attributes_for :residence, :natural_person, :legal_person
|
16
17
|
|
17
18
|
delegate :fullname, :fullname=, to: :person_entity
|
18
19
|
|
20
|
+
attr_accessor :remote_id
|
21
|
+
|
22
|
+
def initialize(attributes = {})
|
23
|
+
if attributes&.fetch(:remote_id, nil).present?
|
24
|
+
super(attributes.slice(:remote_id, :person_type))
|
25
|
+
else
|
26
|
+
super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
19
30
|
def person_entity
|
20
31
|
case person_type
|
21
32
|
when 'natural'
|
@@ -25,8 +36,19 @@ module EgovUtils
|
|
25
36
|
end
|
26
37
|
end
|
27
38
|
|
39
|
+
def person_entity=(entity)
|
40
|
+
case person_type
|
41
|
+
when 'natural'
|
42
|
+
self.natural_person = entity
|
43
|
+
self.legal_person = nil
|
44
|
+
when 'legal'
|
45
|
+
self.legal_person = entity
|
46
|
+
self.natural_person = nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
28
50
|
def residence
|
29
|
-
addresses.
|
51
|
+
addresses.last
|
30
52
|
end
|
31
53
|
|
32
54
|
def residence=(address)
|
@@ -37,5 +59,28 @@ module EgovUtils
|
|
37
59
|
person_entity.to_s
|
38
60
|
end
|
39
61
|
|
62
|
+
private
|
63
|
+
|
64
|
+
def set_residence_from_remote_id
|
65
|
+
return unless remote_id.present?
|
66
|
+
|
67
|
+
# binding.pry
|
68
|
+
attributes =
|
69
|
+
if person_type == 'natural'
|
70
|
+
Iszr::NaturalPeople::SearchByRemoteId.run!(remote_id:)
|
71
|
+
else
|
72
|
+
Iszr::LegalPeople::SearchByRemoteId.run!(remote_id:)
|
73
|
+
end.to_h
|
74
|
+
|
75
|
+
self.person_entity =
|
76
|
+
if person_type == 'natural'
|
77
|
+
NaturalPerson.find_or_initialize_by(attributes.except(:remote_id))
|
78
|
+
else
|
79
|
+
LegalPerson.find_or_initialize_by(attributes.except(:remote_id))
|
80
|
+
end
|
81
|
+
|
82
|
+
self.residence =
|
83
|
+
EgovUtils::Iszr::Addresses::Fetch.run!(remote_id:, person_type:)
|
84
|
+
end
|
40
85
|
end
|
41
86
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
module Services
|
3
|
+
module Iszr
|
4
|
+
class NaturalPeople < Dry::Struct
|
5
|
+
attribute :firstname, Types::String
|
6
|
+
attribute :lastname, Types::String
|
7
|
+
attribute :birth_date, Types::Params::Date
|
8
|
+
attribute :birth_place, Types::String.optional
|
9
|
+
attribute :remote_id, Types::String
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Envelope
|
2
|
+
def self.build_envelope(mode, service, encoded_body)
|
3
|
+
Nokogiri::XML::Builder.new do |xml|
|
4
|
+
xml.GateMessage {
|
5
|
+
xml.Version '2.0'
|
6
|
+
xml.Header {
|
7
|
+
xml.MessageDetails(type: 'request') {
|
8
|
+
xml.Class(mode: mode) {
|
9
|
+
xml.text service
|
10
|
+
}
|
11
|
+
}
|
12
|
+
xml.SenderDetails {
|
13
|
+
xml.Authentication(type: 'clear') {
|
14
|
+
xml.ISId '124'
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
xml.Body encoded_body
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EgovUtils
|
4
|
+
module Iszr
|
5
|
+
module Addresses
|
6
|
+
class Fetch < ActiveInteraction::Base
|
7
|
+
string :remote_id
|
8
|
+
string :person_type
|
9
|
+
|
10
|
+
def execute
|
11
|
+
strategy_class.run!(remote_id: remote_id)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def strategy_class
|
17
|
+
case person_type
|
18
|
+
when 'legal'
|
19
|
+
EgovUtils::Iszr::Addresses::FetchForLegalPerson
|
20
|
+
when 'natural'
|
21
|
+
EgovUtils::Iszr::Addresses::FetchForNaturalPerson
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EgovUtils
|
4
|
+
module Iszr
|
5
|
+
module Addresses
|
6
|
+
class FetchForLegalPerson
|
7
|
+
class FromSampleData < ActiveInteraction::Base
|
8
|
+
string :remote_id
|
9
|
+
|
10
|
+
def execute
|
11
|
+
attrs = sample_results.detect do |address|
|
12
|
+
address['remote_id'] == remote_id
|
13
|
+
end
|
14
|
+
|
15
|
+
EgovUtils::Address.new(attrs.except('remote_id'))
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def sample_results
|
21
|
+
results = File.read(
|
22
|
+
EgovUtils::Engine.root.join('lib/egov_utils/iszr/lp_addresses.json')
|
23
|
+
)
|
24
|
+
|
25
|
+
JSON.parse(results)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EgovUtils
|
4
|
+
module Iszr
|
5
|
+
module Addresses
|
6
|
+
class FetchForLegalPerson < ActiveInteraction::Base
|
7
|
+
string :remote_id
|
8
|
+
|
9
|
+
def execute
|
10
|
+
strategy_class.run!(remote_id:)
|
11
|
+
end
|
12
|
+
|
13
|
+
def strategy_class
|
14
|
+
if Rails.env.production?
|
15
|
+
EgovUtils::Iszr::Addresses::FetchForLegalPerson::FromRemoteReposiory
|
16
|
+
else
|
17
|
+
EgovUtils::Iszr::Addresses::FetchForLegalPerson::FromSampleData
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EgovUtils
|
4
|
+
module Iszr
|
5
|
+
module Addresses
|
6
|
+
class FetchForNaturalPerson
|
7
|
+
class FromSampleData < ActiveInteraction::Base
|
8
|
+
string :remote_id
|
9
|
+
|
10
|
+
def execute
|
11
|
+
attrs = sample_results.detect do |address|
|
12
|
+
address['remote_id'] == remote_id
|
13
|
+
end
|
14
|
+
|
15
|
+
EgovUtils::Address.new(attrs.except('remote_id'))
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def sample_results
|
21
|
+
results = File.read(
|
22
|
+
EgovUtils::Engine.root.join('lib/egov_utils/iszr/np_addresses.json')
|
23
|
+
)
|
24
|
+
|
25
|
+
JSON.parse(results)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EgovUtils
|
4
|
+
module Iszr
|
5
|
+
module Addresses
|
6
|
+
class FetchForNaturalPerson < ActiveInteraction::Base
|
7
|
+
string :remote_id
|
8
|
+
|
9
|
+
def execute
|
10
|
+
strategy_class.run!(remote_id:)
|
11
|
+
end
|
12
|
+
|
13
|
+
def strategy_class
|
14
|
+
if Rails.env.production?
|
15
|
+
EgovUtils::Iszr::Addresses::FetchForNaturalPerson::FromRemoteReposiory
|
16
|
+
else
|
17
|
+
EgovUtils::Iszr::Addresses::FetchForNaturalPerson::FromSampleData
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
module Iszr
|
3
|
+
module LegalPeople
|
4
|
+
class CreateRequest < Request
|
5
|
+
string :ico
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def body
|
10
|
+
Nokogiri::XML::Builder.new do |xml|
|
11
|
+
xml['e20'].RosCtiIco(
|
12
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
13
|
+
'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:IszrRosCtiIco:v1 IszrRosCtiIco.xsd',
|
14
|
+
'xmlns:abs' => 'urn:cz:isvs:iszr:schemas:IszrAbstract:v1',
|
15
|
+
'xmlns:e20' => 'urn:cz:isvs:iszr:schemas:IszrRosCtiIco:v1',
|
16
|
+
'xmlns:reg' => 'urn:cz:isvs:reg:schemas:RegTypy:v1',
|
17
|
+
'xmlns:ros' => 'urn:cz:isvs:ros:schemas:RosDotazyData:v2'
|
18
|
+
) {
|
19
|
+
xml['abs'].ZadostInfo {
|
20
|
+
xml['reg'].CasZadosti Time.current
|
21
|
+
xml['reg'].Agenda 'A482'
|
22
|
+
xml['reg'].AgendovaRole 'CTENAR'
|
23
|
+
xml['reg'].Ovm '00025429'
|
24
|
+
xml['reg'].Ais '124'
|
25
|
+
xml['reg'].Uzivatel 'Uzivatel156'
|
26
|
+
xml['reg'].AgendaZadostId '5a7b9af0-f759-4632-ab96-7bb06df1b98c'
|
27
|
+
}
|
28
|
+
xml['abs'].AutorizaceInfo {
|
29
|
+
xml['abs'].SeznamUdaju 'DatovaSchrankaROS ObchodniNazev PravniForma PravniStav
|
30
|
+
FyzickaOsoba AdresaSidla Provozovny StatutarniOrgany DatumVznikuOpravneni DatumZanikuOpravneni
|
31
|
+
Ico Jmeno Prijmeni AdresaPobytu AdresaUradu ROBCti ROSCti RUIANCti'
|
32
|
+
}
|
33
|
+
xml['e20'].Zadost {
|
34
|
+
xml['e20'].RosCtiIcoData {
|
35
|
+
xml['ros'].Ico ico
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def service_id
|
43
|
+
'E20'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
module Iszr
|
3
|
+
module LegalPeople
|
4
|
+
class DevSearch < ActiveInteraction::Base
|
5
|
+
string :ico
|
6
|
+
|
7
|
+
validates :ico, presence: true
|
8
|
+
|
9
|
+
MAPPING_CLASS = EgovUtils::Services::Iszr::LegalPeople
|
10
|
+
|
11
|
+
def execute
|
12
|
+
legal_person = initialize_person.detect { |person| person.ico == ico }
|
13
|
+
|
14
|
+
if legal_person.nil?
|
15
|
+
errors.add(:base, I18n.t('errors.messages.legal_person.not_found'))
|
16
|
+
else
|
17
|
+
legal_person
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def sample_results
|
24
|
+
EgovUtils::Engine.root.join('lib/egov_utils/iszr/lp_results.json')
|
25
|
+
end
|
26
|
+
|
27
|
+
def initialize_person
|
28
|
+
response = File.read(sample_results)
|
29
|
+
|
30
|
+
body = JSON.parse(response)
|
31
|
+
|
32
|
+
body.map do
|
33
|
+
MAPPING_CLASS.new(_1.deep_symbolize_keys!)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
module Iszr
|
3
|
+
module LegalPeople
|
4
|
+
class ProdSearch < ActiveInteraction::Base
|
5
|
+
string :ico
|
6
|
+
|
7
|
+
validates :ico, presence: true
|
8
|
+
|
9
|
+
MAPPING_CLASS = EgovUtils::Services::Iszr::LegalPeople
|
10
|
+
|
11
|
+
def execute
|
12
|
+
find_person
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def request
|
18
|
+
result = EgovUtils::Iszr::LegalPeople::CreateRequest.run(ico:)
|
19
|
+
# make some call to API with result
|
20
|
+
end
|
21
|
+
|
22
|
+
def find_person
|
23
|
+
# Request will contain provided ICO on which the response will be based
|
24
|
+
|
25
|
+
response = File.read(sample_results)
|
26
|
+
|
27
|
+
body = Nokogiri::XML(response)
|
28
|
+
|
29
|
+
person = MAPPING_CLASS.new(
|
30
|
+
ico: body.at('//dot:Ico').text,
|
31
|
+
name: body.at('//dot:NazevOsoby').text,
|
32
|
+
remote_id: body.at('//ros:Aifo').text
|
33
|
+
)
|
34
|
+
if person.nil?
|
35
|
+
errors.add(:base, I18n.t('errors.messages.legal_person.not_found'))
|
36
|
+
else
|
37
|
+
person
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def sample_results
|
42
|
+
'lib/egov_utils/iszr/e20_ico_response.xml'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
module Iszr
|
3
|
+
module LegalPeople
|
4
|
+
class Search < ActiveInteraction::Base
|
5
|
+
string :ico
|
6
|
+
|
7
|
+
validates :ico, presence: true
|
8
|
+
|
9
|
+
def execute
|
10
|
+
person = find_person_service.run(ico:)
|
11
|
+
if person.valid?
|
12
|
+
person.result
|
13
|
+
else
|
14
|
+
errors.merge!(person.errors)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def find_person_service
|
21
|
+
if Rails.env.production?
|
22
|
+
EgovUtils::Iszr::LegalPeople::ProdSearch
|
23
|
+
else
|
24
|
+
EgovUtils::Iszr::LegalPeople::DevSearch
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EgovUtils
|
4
|
+
module Iszr
|
5
|
+
module LegalPeople
|
6
|
+
class SearchByRemoteId < ActiveInteraction::Base
|
7
|
+
MAPPING_CLASS = EgovUtils::Services::Iszr::LegalPeople
|
8
|
+
|
9
|
+
string :remote_id
|
10
|
+
|
11
|
+
def execute
|
12
|
+
find_person
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def find_person
|
18
|
+
initialize_person.find do |person|
|
19
|
+
person.remote_id == remote_id
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def sample_results
|
24
|
+
EgovUtils::Engine.root.join('lib/egov_utils/iszr/lp_results.json')
|
25
|
+
end
|
26
|
+
|
27
|
+
def initialize_person
|
28
|
+
response = File.read(sample_results)
|
29
|
+
|
30
|
+
body = JSON.parse(response)
|
31
|
+
|
32
|
+
body.map do
|
33
|
+
MAPPING_CLASS.new(_1.deep_symbolize_keys!)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EgovUtils
|
4
|
+
module Iszr
|
5
|
+
module NaturalPeople
|
6
|
+
class CreateRequest < Request
|
7
|
+
string :firstname
|
8
|
+
string :lastname
|
9
|
+
string :birth_date
|
10
|
+
string :birth_place, default: nil
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def body
|
15
|
+
if birth_place.present?
|
16
|
+
search_stage_two
|
17
|
+
else
|
18
|
+
search_stage_one
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def search_stage_one
|
23
|
+
Nokogiri::XML::Builder.new do |xml|
|
24
|
+
xml['e05'].RobCtiPodleUdaju(
|
25
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
26
|
+
'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiPodleUdaju:v1 IszrRobCtiPodleUdaju.xsd',
|
27
|
+
'xmlns:abs' => 'urn:cz:isvs:iszr:schemas:IszrAbstract:v1',
|
28
|
+
'xmlns:e05' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiPodleUdaju:v1',
|
29
|
+
'xmlns:reg' => 'urn:cz:isvs:reg:schemas:RegTypy:v1',
|
30
|
+
'xmlns:rod' => 'urn:cz:isvs:rob:schemas:RobDotazyData:v1',
|
31
|
+
'xmlns:rob' => 'urn:cz:isvs:rob:schemas:RobTypy:v1'
|
32
|
+
) {
|
33
|
+
xml['abs'].ZadostInfo {
|
34
|
+
xml['reg'].CasZadosti Time.current
|
35
|
+
xml['reg'].Agenda 'A482'
|
36
|
+
xml['reg'].AgendovaRole 'CTENAR'
|
37
|
+
xml['reg'].Ovm '00025429'
|
38
|
+
xml['reg'].Ais '124'
|
39
|
+
xml['reg'].Uzivatel 'Uzivatel156'
|
40
|
+
xml['reg'].AgendaZadostId '5a7b9af0-f759-4632-ab96-7bb06df1b98c'
|
41
|
+
}
|
42
|
+
xml['abs'].AutorizaceInfo {
|
43
|
+
xml['abs'].SeznamUdaju 'Aifo Prijmeni Jmeno AdresaPobytu DorucovaciAdresa DatumNarozeni MistoNarozeni DatumUmrti DatumPravniMociUmrti MistoUmrti DatovaSchrankaROB Doklad Obcanstvi'
|
44
|
+
}
|
45
|
+
xml['e05'].Zadost {
|
46
|
+
xml['e05'].RobCtiPodleUdajuData {
|
47
|
+
xml['rod'].DatumNarozeni birth_date
|
48
|
+
xml['rod'].Jmeno firstname
|
49
|
+
xml['rod'].Prijmeni lastname
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def search_stage_two
|
57
|
+
Nokogiri::XML::Builder.new do |xml|
|
58
|
+
xml['e05'].RobCtiPodleUdaju(
|
59
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
60
|
+
'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiPodleUdaju:v1 IszrRobCtiPodleUdaju.xsd',
|
61
|
+
'xmlns:abs' => 'urn:cz:isvs:iszr:schemas:IszrAbstract:v1',
|
62
|
+
'xmlns:e05' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiPodleUdaju:v1',
|
63
|
+
'xmlns:reg' => 'urn:cz:isvs:reg:schemas:RegTypy:v1',
|
64
|
+
'xmlns:rod' => 'urn:cz:isvs:rob:schemas:RobDotazyData:v1',
|
65
|
+
'xmlns:rob' => 'urn:cz:isvs:rob:schemas:RobTypy:v1'
|
66
|
+
) {
|
67
|
+
xml['abs'].ZadostInfo {
|
68
|
+
xml['reg'].CasZadosti Time.current
|
69
|
+
xml['reg'].Agenda 'A482'
|
70
|
+
xml['reg'].AgendovaRole 'CTENAR'
|
71
|
+
xml['reg'].Ovm '00025429'
|
72
|
+
xml['reg'].Ais '124'
|
73
|
+
xml['reg'].Uzivatel 'Uzivatel156'
|
74
|
+
xml['reg'].AgendaZadostId '5a7b9af0-f759-4632-ab96-7bb06df1b98c'
|
75
|
+
}
|
76
|
+
xml['abs'].AutorizaceInfo {
|
77
|
+
xml['abs'].SeznamUdaju 'Aifo Prijmeni Jmeno AdresaPobytu DorucovaciAdresa DatumNarozeni MistoNarozeni DatumUmrti DatumPravniMociUmrti MistoUmrti DatovaSchrankaROB Doklad Obcanstvi'
|
78
|
+
}
|
79
|
+
xml['e05'].Zadost {
|
80
|
+
xml['e05'].RobCtiPodleUdajuData {
|
81
|
+
xml['rod'].MistoNarozeni birth_place
|
82
|
+
xml['rod'].DatumNarozeni birth_date
|
83
|
+
xml['rod'].Jmeno firstname
|
84
|
+
xml['rod'].Prijmeni lastname
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def service_id
|
92
|
+
'E05'
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|