Class: MT940Structured::Parsers::Abnamro::TransactionParser
Constant Summary
Constants included
from IbanSupport
IbanSupport::IBAN_R
Instance Method Summary
collapse
#parse_transaction
#parse_description_after_tag
#iban?, #iban_to_account
Methods included from DateParser
#parse_date
Instance Method Details
#enrich_transaction(transaction, line_86) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/mt940_structured/parsers/abnamro/transaction_parser.rb', line 12
def enrich_transaction(transaction, line_86)
transaction.contra_account = "NONREF" line_86 = line_86.gsub(/:86:/, '')
case line_86
when /^(GIRO)\s+(\d+)(.+)/
transaction.contra_account = $2.rjust(9, '000000000')
transaction.description = $3.strip
when /^(\d{2}.\d{2}.\d{2}.\d{3})(.+)/
transaction.description = $2.strip
transaction.contra_account = $1.gsub('.', '')
when /\/TRTP\/SEPA OVERBOEKING/
description_parts = line_86[4..-1].split('/')
transaction.contra_account_iban = parse_description_after_tag description_parts, "IBAN"
transaction.contra_account = iban_to_account transaction.contra_account_iban
transaction.contra_account_owner = parse_description_after_tag description_parts, "NAME"
transaction.description = parse_description_after_tag description_parts, "REMI"
when /SEPA IDEAL/
if line_86.match /OMSCHRIJVING\:(.+)?/
transaction.description = $1.strip
end
if line_86.match /IBAN\:(.+)?BIC\:/
transaction.contra_account_iban = $1.strip
transaction.contra_account = iban_to_account transaction.contra_account_iban
end
if line_86.match /NAAM\:(.+)?OMSCHRIJVING\:/
transaction.contra_account_owner = $1.strip
end
when /SEPA ACCEPTGIROBETALING/
if line_86.match /(BETALINGSKENM\.\:.+)/
transaction.description = $1.strip
end
if line_86.match /IBAN\:(.+)?BIC\:/
transaction.contra_account_iban = $1.strip
transaction.contra_account = iban_to_account transaction.contra_account_iban
end
if line_86.match /NAAM\:(.+)?BETALINGSKENM\.\:/
transaction.contra_account_owner = $1.strip
end
else
transaction.description = line_86
end
end
|
#get_regex_for_line_61 ⇒ Object
8
9
10
|
# File 'lib/mt940_structured/parsers/abnamro/transaction_parser.rb', line 8
def get_regex_for_line_61
/^:61:(\d{6})\d{4}(C|D)(\d+),(\d{0,2})/
end
|