class UOB::Payroll::TXTFile::Footer
Attributes
header[R]
number_of_records[R]
rows[R]
total_amount[R]
Public Class Methods
new(total_amount:, header:, rows:)
click to toggle source
@param [BigDecimal] total_amount
The total amount to be transferred @param [TXTFile::Header] header The header details used for the hash computation @param [Array<TXTFile::Row>] rows The row details used for the has computation
# File lib/uob/payroll/txt_file/footer.rb, line 22 def initialize(total_amount:, header:, rows:) @total_amount = total_amount @number_of_records = rows.count @header = header @rows = rows raise Errors::Invalid, errors.full_messages.to_sentence unless valid? end
Public Instance Methods
formatted_number_of_records()
click to toggle source
# File lib/uob/payroll/txt_file/footer.rb, line 34 def formatted_number_of_records format '%06d', number_of_records end
formatted_total_amount()
click to toggle source
# File lib/uob/payroll/txt_file/footer.rb, line 38 def formatted_total_amount (format '%015.2f', total_amount).gsub('.','') end
hash_total()
click to toggle source
# File lib/uob/payroll/txt_file/footer.rb, line 30 def hash_total HashCalculator.calculate(header: header, rows: rows) end