Class: UOB::Payroll::TXTFile::Row

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, TxtData::TxtDataRowDSL
Defined in:
lib/uob/payroll/txt_file/row.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TxtData::TxtDataRowDSL

#to_s

Constructor Details

#initialize(bic_code:, account_number:, account_name:, amount:) ⇒ Row

Returns a new instance of Row.

Parameters:

  • bic_code (String)

    The Bank Identifier Code or SWIFT code

  • account_number (String)

    The receiving bank account number

  • account_name (String)

    The receiving name of the account

  • amount (BigDecimal)

    The amount to be received

Raises:



29
30
31
32
33
34
35
36
# 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_name = 
  @amount = amount.is_a?(String) ? BigDecimal(amount) : amount

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

Instance Attribute Details

#account_nameObject (readonly)

Returns the value of attribute account_name.



21
22
23
# File 'lib/uob/payroll/txt_file/row.rb', line 21

def 
  @account_name
end

#account_numberObject (readonly)

Returns the value of attribute account_number.



21
22
23
# File 'lib/uob/payroll/txt_file/row.rb', line 21

def 
  @account_number
end

#amountObject (readonly)

Returns the value of attribute amount.



21
22
23
# File 'lib/uob/payroll/txt_file/row.rb', line 21

def amount
  @amount
end

#bic_codeObject (readonly)

Returns the value of attribute bic_code.



21
22
23
# File 'lib/uob/payroll/txt_file/row.rb', line 21

def bic_code
  @bic_code
end

Instance Method Details

#end_to_end_idObject



54
55
56
# File 'lib/uob/payroll/txt_file/row.rb', line 54

def end_to_end_id
  'SALARY'
end

#formatted_amountObject



38
39
40
# File 'lib/uob/payroll/txt_file/row.rb', line 38

def formatted_amount
  (format '%014.2f', amount.round(2)).gsub('.','')
end

#receiving_account_nameObject



50
51
52
# File 'lib/uob/payroll/txt_file/row.rb', line 50

def 
  String().ljust 140
end

#receiving_account_numberObject



46
47
48
# File 'lib/uob/payroll/txt_file/row.rb', line 46

def 
  
end

#receiving_bic_codeObject



42
43
44
# File 'lib/uob/payroll/txt_file/row.rb', line 42

def receiving_bic_code
  String(bic_code).upcase
end