Sha256: 3112ab04e99c8b9fd4b52e86f5ecda96a6794475fe776b8a864a40077ee388ff

Contents?: true

Size: 687 Bytes

Versions: 1

Compression:

Stored size: 687 Bytes

Contents

module MT940Structured::Parsers::Triodos
  class TransactionParser
    include MT940Structured::Parsers::DateParser
    include MT940Structured::Parsers::DefaultLine61Parser

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

    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.contra_account = $1.rjust(9, '000000000')
          transaction.description = $2.strip
        else
          transaction.description = temp_description
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zilverline-mt940-2.0 lib/mt940_structured/parsers/tridios/transaction_parser.rb