Commit 5100bdbc authored by phil's avatar phil

be more defensive

parent 0710237e
#!/usr/bin/env ruby
require 'active_support/core_ext/hash/conversions'
#require 'pp'
require 'pp'
# Referenznummer (kann mehrfach auftauchen)
# BkToCstmrDbtCdtNtfctn.Ntfctn.Ntry.NtryDtls
......@@ -32,7 +32,13 @@ module CamtToV11
#puts edetail
tp = detail['Refs']['Prtry']['Tp']
ref = detail['RmtInf']['Strd']['CdtrRefInf']['Ref']
iban = detail['RltdPties']['DbtrAcct']['Id']['IBAN'] if opts[:iban]
puts '-'*80
pp detail
if opts[:iban]
related_parties = detail['RltdPties']
debitor_account = related_parties && related_parties['DbtrAcct']
iban = debitor_account && debitor_account['Id']['IBAN']
end
amount = (detail['Amt'].to_f * 100).to_i
tmp = detail['Refs']['Prtry']['Ref']
dat1 = tmp.slice(2,6)
......@@ -90,5 +96,5 @@ end
if $0 == __FILE__
file = ARGV.first
xml = open(file).read
puts CamtToV11.convert(xml)
puts CamtToV11.convert(xml, iban: true)
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment