Class: DeltavistaCrifDvaInterface::CollectionCheck
- Inherits:
-
SoapConverter
- Object
- SoapConverter
- DeltavistaCrifDvaInterface::CollectionCheck
- Defined in:
- lib/deltavista_crif_dva_interface/collection_check.rb
Instance Attribute Summary
Attributes inherited from SoapConverter
#action, #attributes, #client, #envelope, #logger, #options, #response, #result
Instance Method Summary collapse
-
#address_id(result) ⇒ String?
Gets address id of matched address.
-
#address_matched?(result) ⇒ true, false
Checks if requested address is matched.
-
#business_collection_check(address, collection) ⇒ Hash
Executes collection check for business.
-
#global_decision(result) ⇒ Hash<Symbol, String>
Gets global decision of collection check.
-
#initialize(options) ⇒ CollectionCheck
constructor
A new instance of CollectionCheck.
-
#private_collection_check(address, collection) ⇒ Hash
Executes collection check for private person.
-
#score(result) ⇒ String?
Gets score of collection check.
Methods inherited from SoapConverter
#additional_input, #commit, #convert_country, #format_date, #insert_company_address, #insert_control, #insert_identity, #insert_private_address, #insert_reference_number, #map_attribute, #parse_location
Constructor Details
#initialize(options) ⇒ CollectionCheck
Returns a new instance of CollectionCheck.
4 5 6 7 8 |
# File 'lib/deltavista_crif_dva_interface/collection_check.rb', line 4 def initialize() .action = :get_report .response = :get_report_response super() end |
Instance Method Details
#address_id(result) ⇒ String?
Gets address id of matched address
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/deltavista_crif_dva_interface/collection_check.rb', line 56 def address_id(result) address_id = nil if address_matched?(result) if result.has_key?(:address_match_result) address_match_result = result[:address_match_result] if address_match_result.has_key?(:found_address) found_address = address_match_result[:found_address] if found_address.has_key?(:identifiers) if found_address[:identifiers].has_key?(:identifier_type) && found_address[:identifiers][:identifier_type] == 'ADDRESS_ID' address_id = found_address[:identifiers][:identifier_text] end end end end end address_id end |
#address_matched?(result) ⇒ true, false
Checks if requested address is matched
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/deltavista_crif_dva_interface/collection_check.rb', line 41 def address_matched?(result) address_matched = false if result.has_key?(:address_match_result) address_match_result = result[:address_match_result] if address_match_result.has_key?(:address_match_result_type) result_type = address_match_result[:address_match_result_type] address_matched = result_type == 'MATCH' end end address_matched end |
#business_collection_check(address, collection) ⇒ Hash
Executes collection check for business
28 29 30 31 32 33 34 35 36 |
# File 'lib/deltavista_crif_dva_interface/collection_check.rb', line 28 def business_collection_check(address, collection) insert_reference_number address[:id] insert_company_address address envelope[:report_type] = 'COLLECTION_CHECK_BUSINESS' envelope[:target_report_format] = 'NONE' insert_collection collection commit result[:data] end |
#global_decision(result) ⇒ Hash<Symbol, String>
Gets global decision of collection check
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/deltavista_crif_dva_interface/collection_check.rb', line 77 def global_decision(result) global_decision = { } if address_matched?(result) if result.has_key?(:decision_matrix) decision_matrix = result[:decision_matrix] global_decision[:decision] = decision_matrix[:decision] if decision_matrix.has_key?(:decision) global_decision[:decision_text] = decision_matrix[:decision_text] if decision_matrix.has_key?(:decision_text) end end global_decision end |
#private_collection_check(address, collection) ⇒ Hash
Executes collection check for private person
14 15 16 17 18 19 20 21 22 |
# File 'lib/deltavista_crif_dva_interface/collection_check.rb', line 14 def private_collection_check(address, collection) insert_reference_number address[:id] insert_private_address address envelope[:report_type] = 'COLLECTION_CHECK_CONSUMER' envelope[:target_report_format] = 'NONE' insert_collection collection commit result[:data] end |
#score(result) ⇒ String?
Gets score of collection check
92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/deltavista_crif_dva_interface/collection_check.rb', line 92 def score(result) score = nil if address_matched?(result) if result.has_key?(:decision_matrix) decision_matrix = result[:decision_matrix] if decision_matrix.has_key?(:subdecisions) decision_matrix[:subdecisions].each do |sub_decision| score = sub_decision[:value] if sub_decision.has_key?(:type) && sub_decision[:type] == 'SCORE' end end end end score end |