deltavista_crif_dva_interface 0.1.27 → 0.2.00
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/deltavista_crif_dva_interface/collection_check.rb +5 -0
- data/lib/deltavista_crif_dva_interface/delta_vista_service.rb +1 -1
- data/lib/deltavista_crif_dva_interface/soap_config.rb +4 -2
- data/lib/deltavista_crif_dva_interface/soap_converter.rb +32 -16
- data/lib/deltavista_crif_dva_interface/version.rb +1 -1
- data/wsdl/crif-soap-service_v1.0.wsdl +1 -1
- metadata +2 -2
@@ -3,21 +3,26 @@ module DeltavistaCrifDvaInterface
|
|
3
3
|
|
4
4
|
def initialize(options)
|
5
5
|
options.action = :get_report
|
6
|
+
options.response = :get_report_response
|
6
7
|
super(options)
|
7
8
|
end
|
8
9
|
|
9
10
|
def private_collection_check(address, collection)
|
10
11
|
insert_private_address address
|
11
12
|
envelope[:report_type] = 'COLLECTION_CHECK_CONSUMER'
|
13
|
+
envelope[:target_report_format] = 'NONE'
|
12
14
|
insert_collection collection
|
13
15
|
commit
|
16
|
+
result[:data]
|
14
17
|
end
|
15
18
|
|
16
19
|
def business_collection_check(address, collection)
|
17
20
|
insert_company_address address
|
18
21
|
envelope[:report_type] = 'COLLECTION_CHECK_BUSINESS'
|
22
|
+
envelope[:target_report_format] = 'NONE'
|
19
23
|
insert_collection collection
|
20
24
|
commit
|
25
|
+
result[:data]
|
21
26
|
end
|
22
27
|
|
23
28
|
private
|
@@ -1,15 +1,17 @@
|
|
1
1
|
module DeltavistaCrifDvaInterface
|
2
2
|
class SoapConfig
|
3
|
-
attr_accessor :endpoint, :wsdl, :user_name, :password, :action, :logger
|
3
|
+
attr_accessor :endpoint, :wsdl, :user_name, :password, :action, :response, :logger
|
4
4
|
|
5
5
|
def initialize(options)
|
6
6
|
default_endpoint = 'https://preprodservices.crif-online.ch/CrifSS/CrifSoapServiceV1'
|
7
7
|
default_wsdl = File.expand_path('../../wsdl/crif-soap-service_v1.0.wsdl', File.dirname(__FILE__))
|
8
|
+
|
8
9
|
@endpoint = options[:endpoint] ? options[:endpoint] : default_endpoint
|
9
10
|
@wsdl = options[:wsdl] ? options[:wsdl] : default_wsdl
|
10
11
|
@user_name = options[:user_name]
|
11
12
|
@password = options[:password]
|
12
|
-
@action = options[:action] ? options[:action] :
|
13
|
+
@action = options[:action] ? options[:action] : nil
|
14
|
+
@response = options[:response] ? options[:response] : nil
|
13
15
|
@logger = options[:logger] ? options[:logger] : Logger.new(STDOUT)
|
14
16
|
end
|
15
17
|
|
@@ -3,27 +3,33 @@ require 'savon'
|
|
3
3
|
module DeltavistaCrifDvaInterface
|
4
4
|
class SoapConverter
|
5
5
|
|
6
|
-
attr_reader :options, :client, :action, :envelope, :result, :logger
|
6
|
+
attr_reader :options, :client, :action, :response, :attributes, :envelope, :result, :logger
|
7
7
|
|
8
8
|
def initialize(options)
|
9
9
|
@options = options
|
10
10
|
@logger = options.logger ? options.logger : Logger.new(STDOUT)
|
11
|
-
@envelope =
|
11
|
+
@envelope = {
|
12
|
+
:attributes! => Hash.new
|
13
|
+
}
|
14
|
+
@attributes = Hash.new
|
12
15
|
@client = Savon.client(
|
13
16
|
:wsdl => options.wsdl,
|
14
17
|
:endpoint => options.endpoint,
|
15
|
-
:pretty_print_xml => true,
|
16
18
|
:soap_version => 2,
|
17
19
|
:env_namespace => 'soapenv',
|
20
|
+
:pretty_print_xml => true,
|
18
21
|
:namespace_identifier => 'ns1',
|
22
|
+
:element_form_default => :qualified,
|
19
23
|
:logger => logger
|
20
24
|
)
|
21
25
|
@result = {
|
22
26
|
:committed => false,
|
23
27
|
:success => false,
|
28
|
+
:response => nil,
|
24
29
|
:data => Hash.new
|
25
30
|
}
|
26
31
|
@action = options.action
|
32
|
+
@response = options.response
|
27
33
|
insert_control
|
28
34
|
insert_identity
|
29
35
|
insert_reference_number
|
@@ -31,14 +37,14 @@ module DeltavistaCrifDvaInterface
|
|
31
37
|
|
32
38
|
def commit
|
33
39
|
begin
|
34
|
-
result[:
|
40
|
+
result[:response] = @client.call(action, :message => envelope, :attributes => attributes)
|
41
|
+
result[:data] = result[:response].body[options.response]
|
35
42
|
result[:success] = true
|
36
43
|
rescue StandardError => e
|
37
44
|
logger.error e.message
|
38
45
|
logger.error e.backtrace.join('\n') if e.backtrace
|
39
46
|
raise e
|
40
47
|
end
|
41
|
-
result
|
42
48
|
end
|
43
49
|
|
44
50
|
def insert_reference_number
|
@@ -66,27 +72,26 @@ module DeltavistaCrifDvaInterface
|
|
66
72
|
:last_name => address[:last_name],
|
67
73
|
:maiden_name => address[:maiden_name],
|
68
74
|
:sex => address[:sex],
|
69
|
-
:birth_date => format_date(address[:birth_date])
|
70
|
-
:attributes! => {
|
71
|
-
'xsi:type' => 'PersonAddressDescription'
|
72
|
-
}
|
75
|
+
:birth_date => format_date(address[:birth_date])
|
73
76
|
}
|
77
|
+
map_attribute({
|
78
|
+
'xsi:type' => 'ns1:PersonAddressDescription'
|
79
|
+
}, :searched_address)
|
74
80
|
end
|
75
81
|
|
76
82
|
def insert_company_address(address)
|
77
83
|
envelope[:searched_address] = {
|
78
84
|
:location => parse_location(address),
|
79
|
-
:company_name => address[:company_name]
|
80
|
-
:attributes! => {
|
81
|
-
'xsi:type' => 'CompanyAddressDescription'
|
82
|
-
}
|
85
|
+
:company_name => address[:company_name]
|
83
86
|
}
|
87
|
+
map_attribute({
|
88
|
+
'xsi:type' => 'ns1:CompanyAddressDescription'
|
89
|
+
}, :searched_address)
|
84
90
|
end
|
85
91
|
|
86
92
|
def additional_input(key, value)
|
87
|
-
envelope[:
|
88
|
-
envelope[:
|
89
|
-
envelope[:additional_inputs][:additional_input] << {
|
93
|
+
envelope[:additional_input] = Array.new unless envelope[:additional_input]
|
94
|
+
envelope[:additional_input] << {
|
90
95
|
:key => key,
|
91
96
|
:value => value
|
92
97
|
}
|
@@ -117,5 +122,16 @@ module DeltavistaCrifDvaInterface
|
|
117
122
|
}
|
118
123
|
end
|
119
124
|
|
125
|
+
def map_attribute(hash, *path)
|
126
|
+
target = envelope
|
127
|
+
last_child = path.slice!(-1)
|
128
|
+
path.each do |children|
|
129
|
+
target[children] = Hash.new unless target[children]
|
130
|
+
target = target[children]
|
131
|
+
end
|
132
|
+
target[:attributes!] = Hash.new unless target[:attributes!]
|
133
|
+
target[:attributes!][last_child] = hash
|
134
|
+
end
|
135
|
+
|
120
136
|
end
|
121
137
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.crif-online.ch/webservices/crifsoapservice/
|
2
|
+
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.crif-online.ch/webservices/crifsoapservice/v1.00" xmlns:crifss10="http://www.crif-online.ch/webservices/crifsoapservice/v1.00" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="CrifSoapServiceV1_0" targetNamespace="http://www.crif-online.ch/webservices/crifsoapservice/v1.00">
|
3
3
|
<documentation>Crif Soap Service V1.0</documentation>
|
4
4
|
<types>
|
5
5
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deltavista_crif_dva_interface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.00
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-05-
|
14
|
+
date: 2013-05-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|