class BankPayments::SwedbankExport::CreditMemoRecord

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

Constants

DIGIT_MAP

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/bank_payments/swedbank_export/credit_memo_record.rb, line 26
def initialize
  super
  self.type = '5'
end

Public Instance Methods

amount_foreign=(amount) click to toggle source
Calls superclass method
# 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) click to toggle source
Calls superclass method
# 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

Private Instance Methods

change_last_digit(digits) click to toggle source

Set a special value in positions 44 and 78 (the last digit). This is how the bank determines that this is a credit memo

# File lib/bank_payments/swedbank_export/credit_memo_record.rb, line 43
def change_last_digit(digits)
  digits[0..-2] + DIGIT_MAP[digits[-1]]
end