Class: Hotfile::Record::BKP84

Inherits:
Hotfile::Record show all
Defined in:
lib/hotfile/record/BKP84.rb

Overview

Form of Payment Record

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ BKP84

Returns a new instance of BKP84.



7
8
9
10
11
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
# File 'lib/hotfile/record/BKP84.rb', line 7

def initialize(line)
  super

  date_of_issue, transaction_number, payment_type, amount, , expiry, extend_code, approval_code,
      invoice_number, invoice_date, remittance_amount, verification, reserved, currency =
    line.scan(/
      (\d{6})
      (\d{6})
      ([A-Z0-9 ]{10})
      (\d{10}.)
      ([A-Z0-9 ]{19})
      ([A-Z0-9 ]{4})
      ([A-Z0-9 ]{2})
      ([A-Z0-9 ]{6})
      ([A-Z0-9 ]{14})
      ([\d ]{6})
      (\d{10}.)
      (.)
      (.{23})
      ([A-Z0-9]{4})
    /x).flatten

  @data = {
    currency: currency.strip,
    date_of_issue: Hotfile::Date.new(date_of_issue).to_date,
    transaction_number: Hotfile::Integer.new(transaction_number).to_i,
    payment_type: payment_type.strip,
    amount: Hotfile::Integer.new(amount).to_i,
    account: .strip,
    expiry: expiry.strip,
    extend_code: extend_code.strip,
    approval_code: approval_code.strip,
    invoice_number: invoice_number.strip,
    invoice_date: Hotfile::Date.new(invoice_date).to_date,
    remittance_amount: Hotfile::Integer.new(remittance_amount).to_i,
    verification: verification.strip,
    reserved: reserved.strip
  }
end