Skip to content

Commit

Permalink
[PMNTSS-2873] Fix response parsing (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
hris27 authored Feb 22, 2024
1 parent 5eaa4d3 commit c5dd8ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions lib/iban_utils/iban_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ def parse(response_xml)
@details = {}

if found?
@details[:bank] = response_xml.find_first('bank').content
@details[:bank_address] = response_xml.find_first('bank_address').content
@details[:bank] = response_xml.find_first('bank')&.content
@details[:bank_address] = response_xml.find_first('bank_address')&.content

xml_iban = response_xml.find_first('iban')

# What if we get more than one iban?
# o_iban = [*xml_iban].length > 1 ? nil : (xml_iban.content.empty? ? nil : xml_iban.content)
@details[:iban] = xml_iban.content.empty? ? nil : xml_iban.content
@details[:iban] = xml_iban&.content&.empty? ? nil : xml_iban.content

xml_account_number = response_xml.find_first('account_number')
@details[:account_number] = xml_account_number.content.empty? ? nil : xml_account_number.content
@details[:account_number] = xml_account_number&.content&.empty? ? nil : xml_account_number.content

xml_bank_code = response_xml.find_first('bank_code')
@details[:bank_code] = xml_bank_code.content.empty? ? nil : xml_bank_code.content
@details[:bank_code] = xml_bank_code&.content&.empty? ? nil : xml_bank_code.content

swift_candidates = response_xml.find_first('bic_candidates-list')
@details[:possible_bics] = swift_candidates ?
Expand Down
2 changes: 1 addition & 1 deletion lib/iban_utils/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module IbanUtils
VERSION = '0.8.0'
VERSION = '0.8.1'
end

0 comments on commit c5dd8ad

Please sign in to comment.