deltavista_crif_dva_interface 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,10 @@ module DeltavistaCrifDvaInterface
|
|
7
7
|
super(options)
|
8
8
|
end
|
9
9
|
|
10
|
+
# Executes collection check for private person
|
11
|
+
# @param address [Hash<Symbol, String>] address data
|
12
|
+
# @param collection [Hash<Symbol, String>] collection data
|
13
|
+
# @return [Hash] check result
|
10
14
|
def private_collection_check(address, collection)
|
11
15
|
insert_private_address address
|
12
16
|
envelope[:report_type] = 'COLLECTION_CHECK_CONSUMER'
|
@@ -16,6 +20,10 @@ module DeltavistaCrifDvaInterface
|
|
16
20
|
result[:data]
|
17
21
|
end
|
18
22
|
|
23
|
+
# Executes collection check for business
|
24
|
+
# @param address [Hash<Symbol, String>] address data
|
25
|
+
# @param collection [Hash<Symbol, String>] collection data
|
26
|
+
# @return [Hash] check result
|
19
27
|
def business_collection_check(address, collection)
|
20
28
|
insert_company_address address
|
21
29
|
envelope[:report_type] = 'COLLECTION_CHECK_BUSINESS'
|
@@ -25,13 +33,68 @@ module DeltavistaCrifDvaInterface
|
|
25
33
|
result[:data]
|
26
34
|
end
|
27
35
|
|
36
|
+
# Checks if requested address is matched
|
37
|
+
# @param [Hash] check result
|
38
|
+
# @return [true, false] if matched true, otherwise false
|
39
|
+
def address_matched?(result)
|
40
|
+
address_matched = false
|
41
|
+
if result.has_key?(:address_match_result)
|
42
|
+
address_match_result = result[:address_match_result]
|
43
|
+
if address_match_result.has_key?(:address_match_result_type)
|
44
|
+
result_type = address_match_result[:address_match_result_type]
|
45
|
+
address_matched = result_type == 'MATCH'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
address_matched
|
49
|
+
end
|
50
|
+
|
51
|
+
# Gets global decision of collection check
|
52
|
+
# @param [Hash] check result
|
53
|
+
# @return [Hash<Symbol, String>] hash with decision and decision text
|
54
|
+
def global_decision(result)
|
55
|
+
global_decision = { }
|
56
|
+
if address_matched?(result)
|
57
|
+
if result.has_key?(:decision_matrix)
|
58
|
+
decision_matrix = result[:decision_matrix]
|
59
|
+
global_decision[:decision] = decision_matrix[:decision] if decision_matrix.has_key?(:decision)
|
60
|
+
global_decision[:decision_text] = decision_matrix[:decision_text] if decision_matrix.has_key?(:decision_text)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
global_decision
|
64
|
+
end
|
65
|
+
|
66
|
+
# Gets score of collection check
|
67
|
+
# @param [Hash] check result
|
68
|
+
# @return [String,nil] score value if available, otherwise nil
|
69
|
+
def score(result)
|
70
|
+
score = nil
|
71
|
+
if address_matched?(result)
|
72
|
+
if result.has_key?(:decision_matrix)
|
73
|
+
decision_matrix = result[:decision_matrix]
|
74
|
+
if decision_matrix.has_key?(:subdecisions)
|
75
|
+
decision_matrix[:subdecisions].each do |sub_decision|
|
76
|
+
score = sub_decision[:value] if sub_decision.has_key?(:type) && sub_decision[:type] == 'SCORE'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
score
|
82
|
+
end
|
83
|
+
|
84
|
+
protected
|
85
|
+
# Overrides default minor version in super class
|
86
|
+
# @return [Integer] minor version number
|
87
|
+
def minor_version
|
88
|
+
6
|
89
|
+
end
|
90
|
+
|
28
91
|
private
|
29
92
|
def insert_collection(collection)
|
30
93
|
additional_input('openAmount', collection[:open_amount])
|
31
|
-
additional_input('totalAmount', collection[:total_amount])
|
94
|
+
additional_input('totalAmount', collection[:total_amount])
|
32
95
|
additional_input('collectionCaseStatus', collection[:case_status])
|
33
96
|
additional_input('dateOpen', format_date(collection[:date_open]))
|
34
|
-
additional_input('invoiceDate', collection[:date_invoice])
|
97
|
+
additional_input('invoiceDate', format_date(collection[:date_invoice]))
|
35
98
|
end
|
36
99
|
|
37
100
|
end
|
@@ -60,8 +60,8 @@ module DeltavistaCrifDvaInterface
|
|
60
60
|
|
61
61
|
def insert_control
|
62
62
|
envelope[:control] = {
|
63
|
-
:major_version =>
|
64
|
-
:minor_version =>
|
63
|
+
:major_version => major_version,
|
64
|
+
:minor_version => minor_version
|
65
65
|
}
|
66
66
|
end
|
67
67
|
|
@@ -133,5 +133,17 @@ module DeltavistaCrifDvaInterface
|
|
133
133
|
target[:attributes!][last_child] = hash
|
134
134
|
end
|
135
135
|
|
136
|
+
protected
|
137
|
+
# major version used in interface
|
138
|
+
# @return [Integer] major version number
|
139
|
+
def major_version
|
140
|
+
1
|
141
|
+
end
|
142
|
+
|
143
|
+
# minor version used in interface
|
144
|
+
# @return [Integer] minor version number
|
145
|
+
def minor_version
|
146
|
+
0
|
147
|
+
end
|
136
148
|
end
|
137
149
|
end
|
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: 1.0.
|
4
|
+
version: 1.0.4
|
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:
|
14
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|
@@ -45,6 +45,22 @@ dependencies:
|
|
45
45
|
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: jruby-openssl
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.9.4
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ~>
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 0.9.4
|
48
64
|
- !ruby/object:Gem::Dependency
|
49
65
|
name: nokogiri
|
50
66
|
requirement: !ruby/object:Gem::Requirement
|