Class: BankPayments::SwedbankExport::CreditMemoRecord

Inherits:
MoneyRecord show all
Defined in:
lib/bank_payments/swedbank_export/credit_memo_record.rb

Overview

Describes a credit to be made. See the parent class for additional information. The only special thing about this class is how to interpret the date.

When you set the date it is to interpreted as a soft “expiry date” for the credit itself. When the date passes the bank will still use it, if possible, but it will appear of a special list at the bank: ‘Utestående kreditfakturor’

Author:

  • Michael Litton

Constant Summary collapse

DIGIT_MAP =
{
  '0' => '-',
  '1' => 'J',
  '2' => 'K',
  '3' => 'L',
  '4' => 'M',
  '5' => 'N',
  '6' => 'O',
  '7' => 'P',
  '8' => 'Q',
  '9' => 'R'
}.freeze

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

#initializeCreditMemoRecord

Returns a new instance of CreditMemoRecord.



26
27
28
29
# File 'lib/bank_payments/swedbank_export/credit_memo_record.rb', line 26

def initialize
  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_foreign=(amount) ⇒ Object



35
36
37
# File 'lib/bank_payments/swedbank_export/credit_memo_record.rb', line 35

def amount_foreign=(amount)
  super change_last_digit(amount.abs.spisu_format)
end

#amount_sek=(amount) ⇒ Object



31
32
33
# File 'lib/bank_payments/swedbank_export/credit_memo_record.rb', line 31

def amount_sek=(amount)
  super change_last_digit(amount.abs.spisu_format)
end