Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PMNTSS-2873] Fix response parsing #11

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Loading