class UOB::Payroll::TXTFile::Row

Attributes

account_name[R]
account_number[R]
amount[R]
bic_code[R]

Public Class Methods

new(bic_code:, account_number:, account_name:, amount:) click to toggle source

@param [String] bic_code The Bank Identifier Code or SWIFT code @param [String] account_number The receiving bank account number @param [String] account_name The receiving name of the account @param [BigDecimal] amount The amount to be received

# File lib/uob/payroll/txt_file/row.rb, line 29
def initialize(bic_code:, account_number:, account_name:, amount:)
  @bic_code = bic_code
  @account_number = account_number
  @account_name = account_name
  @amount = amount.is_a?(String) ? BigDecimal(amount) : amount

  raise Errors::Invalid, errors.full_messages.to_sentence unless valid?
end

Public Instance Methods

end_to_end_id() click to toggle source
# File lib/uob/payroll/txt_file/row.rb, line 54
def end_to_end_id
  'SALARY'
end
formatted_amount() click to toggle source
# File lib/uob/payroll/txt_file/row.rb, line 38
def formatted_amount
  (format '%014.2f', amount.round(2)).gsub('.','')
end
receiving_account_name() click to toggle source
# File lib/uob/payroll/txt_file/row.rb, line 50
def receiving_account_name
  String(account_name).ljust 140
end
receiving_account_number() click to toggle source
# File lib/uob/payroll/txt_file/row.rb, line 46
def receiving_account_number
  account_number
end
receiving_bic_code() click to toggle source
# File lib/uob/payroll/txt_file/row.rb, line 42
def receiving_bic_code
  String(bic_code).upcase
end