Class: MT940Structured::Parsers::Abnamro::TransactionParser

Inherits:
Object
  • Object
show all
Includes:
DateParser, DefaultLine61Parser, IbanSupport, StructuredDescriptionParser
Defined in:
lib/mt940_structured/parsers/abnamro/transaction_parser.rb

Constant Summary

Constants included from IbanSupport

IbanSupport::IBAN_R

Instance Method Summary collapse

Methods included from DefaultLine61Parser

#parse_transaction

Methods included from StructuredDescriptionParser

#parse_description_after_tag

Methods included from IbanSupport

#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. = "NONREF" #default
  line_86 = line_86.gsub(/:86:/, '')
  case line_86
    when /^(GIRO)\s+(\d+)(.+)/
      transaction. = $2.rjust(9, '000000000')
      transaction.description = $3.strip
    when /^(\d{2}.\d{2}.\d{2}.\d{3})(.+)/
      transaction.description = $2.strip
      transaction. = $1.gsub('.', '')
    when /\/TRTP\/SEPA OVERBOEKING/
      description_parts = line_86[4..-1].split('/')
      transaction. = parse_description_after_tag description_parts, "IBAN"
      transaction. =  transaction.
      transaction. = 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. = $1.strip
        transaction. =  transaction.
      end
      if line_86.match /NAAM\:(.+)?OMSCHRIJVING\:/
        transaction. = $1.strip
      end
    when /SEPA ACCEPTGIROBETALING/
      if line_86.match /(BETALINGSKENM\.\:.+)/
        transaction.description = $1.strip
      end
      if line_86.match /IBAN\:(.+)?BIC\:/
        transaction. = $1.strip
        transaction. =  transaction.
      end
      if line_86.match /NAAM\:(.+)?BETALINGSKENM\.\:/
        transaction. = $1.strip
      end
    else
      transaction.description = line_86
  end
end

#get_regex_for_line_61Object



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