Class: MT940Structured::Parsers::Triodos::TransactionParser

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

Instance Method Summary collapse

Methods included from DefaultLine61Parser

#parse_transaction

Methods included from DateParser

#parse_date

Instance Method Details

#enrich_transaction(transaction, line_86) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mt940_structured/parsers/tridios/transaction_parser.rb', line 10

def enrich_transaction(transaction, line_86)
  if line_86.match(/^:86:\s?(.*)\Z/m)
    temp_description = $1.gsub(/\n/, ' ').gsub(/>\d{2}/, '').strip
    if temp_description.match(/^\d+(\d{9})(.*)$/)
      transaction. = $1.rjust(9, '000000000')
      transaction.description = $2.strip
    else
      transaction.description = temp_description
    end
  end

end

#get_regex_for_line_61Object



6
7
8
# File 'lib/mt940_structured/parsers/tridios/transaction_parser.rb', line 6

def get_regex_for_line_61
  /^:61:(\d{6})(C|D)(\d+),(\d{0,2})/
end