class BankPayments::SwedbankExport::ReconciliationRecord
Constants
- DIGIT_MAP
Public Class Methods
new()
click to toggle source
Calls superclass method
BankPayments::SpisuRecord::new
# File lib/bank_payments/swedbank_export/reconciliation_record.rb, line 24 def initialize super self.type = '9' end
Public Instance Methods
sum_amount_foreign=(amount)
click to toggle source
Calls superclass method
# File lib/bank_payments/swedbank_export/reconciliation_record.rb, line 33 def sum_amount_foreign=(amount) super reformat_sums(amount) end
sum_amount_sek=(amount)
click to toggle source
Calls superclass method
# File lib/bank_payments/swedbank_export/reconciliation_record.rb, line 29 def sum_amount_sek=(amount) super reformat_sums(amount) 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/reconciliation_record.rb, line 49 def change_last_digit(digits) digits[0..-2] + DIGIT_MAP[digits[-1]] end
reformat_sums(amount)
click to toggle source
# File lib/bank_payments/swedbank_export/reconciliation_record.rb, line 39 def reformat_sums(amount) if amount >= 0 amount.spisu_format else change_last_digit(amount.abs.spisu_format) end end