Class: BankPayments::SwedbankImport::MoneyRecord

Inherits:
BankPayments::SpisuRecord show all
Defined in:
lib/bank_payments/swedbank_import/money_record.rb

Instance Method Summary collapse

Methods inherited from BankPayments::SpisuRecord

define_field, defined_fields, definition_for, #extract_date, #extract_field_value, #extract_raw_value, inherited, #method_missing, #serialize_value, #set_numeric_value, #set_text_value, #set_value, #to_s, #type, #type=

Constructor Details

#initialize(raw_record) ⇒ MoneyRecord



13
14
15
16
# File 'lib/bank_payments/swedbank_import/money_record.rb', line 13

def initialize(raw_record)
  super
  self.type = '5'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BankPayments::SpisuRecord

Instance Method Details

#amount_foreignObject



30
31
32
# File 'lib/bank_payments/swedbank_import/money_record.rb', line 30

def amount_foreign
  AmountConverter.value_to_decimal(extract_raw_value __callee__)
end

#amount_sekObject



22
23
24
# File 'lib/bank_payments/swedbank_import/money_record.rb', line 22

def amount_sek
  AmountConverter.value_to_decimal(extract_raw_value __callee__)
end

#bank_amount_sekObject



26
27
28
# File 'lib/bank_payments/swedbank_import/money_record.rb', line 26

def bank_amount_sek
  AmountConverter.value_to_decimal(extract_raw_value __callee__)
end

#corrected_by_bank?Boolean



18
19
20
# File 'lib/bank_payments/swedbank_import/money_record.rb', line 18

def corrected_by_bank?
  error_code == '1'
end

#error_codeObject

Enum with ‘0’ = OK ‘1’ = Payment corrected by the bank



44
45
46
# File 'lib/bank_payments/swedbank_import/money_record.rb', line 44

def error_code
  extract_raw_value __callee__
end

#recalculation_codeObject

Enum with ‘0’ => The bank has calculated it’s value from the foreign amount’ ‘9’ => The bank has calculated it’s value form the SEK amount



37
38
39
# File 'lib/bank_payments/swedbank_import/money_record.rb', line 37

def recalculation_code
  extract_raw_value __callee__
end