Class: UOB::Payroll::TXTFile::Header

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TxtData::TxtDataRowDSL

#to_s

Constructor Details

#initialize(company_name:, account_number:, branch_code:, creation_date:, value_date:) ⇒ Header

Returns a new instance of Header.

Parameters:

  • company_name (String)
  • account_number (String)

    The originating 10 digit UOB bank account number

  • branch_code (String)

    The originating UOB branch code

  • creation_date (Date)

    Date when the bank file was created

  • value_date (Date)

    Date when the amounts will be credited to the receiving party

Raises:



34
35
36
37
38
39
40
41
42
# File 'lib/uob/payroll/txt_file/header.rb', line 34

def initialize(company_name:, account_number:, branch_code:, creation_date:, value_date:)
  @company_name = company_name
  @account_number = 
  @branch_code = branch_code
  @creation_date = creation_date
  @value_date = value_date

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

Instance Attribute Details

#account_numberObject (readonly)

Returns the value of attribute account_number.



27
28
29
# File 'lib/uob/payroll/txt_file/header.rb', line 27

def 
  @account_number
end

#branch_codeObject (readonly)

Returns the value of attribute branch_code.



27
28
29
# File 'lib/uob/payroll/txt_file/header.rb', line 27

def branch_code
  @branch_code
end

#company_nameObject (readonly)

Returns the value of attribute company_name.



27
28
29
# File 'lib/uob/payroll/txt_file/header.rb', line 27

def company_name
  @company_name
end

#creation_dateObject (readonly)

Returns the value of attribute creation_date.



27
28
29
# File 'lib/uob/payroll/txt_file/header.rb', line 27

def creation_date
  @creation_date
end

#value_dateObject (readonly)

Returns the value of attribute value_date.



27
28
29
# File 'lib/uob/payroll/txt_file/header.rb', line 27

def value_date
  @value_date
end

Instance Method Details

#bulk_customer_referenceObject



68
69
70
# File 'lib/uob/payroll/txt_file/header.rb', line 68

def bulk_customer_reference
  "PAYROLL#{creation_date.strftime('%d%m')}"
end

#filenameObject



44
45
46
# File 'lib/uob/payroll/txt_file/header.rb', line 44

def filename
  "UGBI#{creation_date.strftime('%d%m')}01"
end

#formatted_creation_dateObject



60
61
62
# File 'lib/uob/payroll/txt_file/header.rb', line 60

def formatted_creation_date
  creation_date.strftime '%Y%m%d'
end

#formatted_value_dateObject



64
65
66
# File 'lib/uob/payroll/txt_file/header.rb', line 64

def formatted_value_date
  value_date.strftime '%Y%m%d'
end

#originating_account_nameObject



56
57
58
# File 'lib/uob/payroll/txt_file/header.rb', line 56

def 
  String(company_name).upcase.ljust 140
end

#originating_account_numberObject



52
53
54
# File 'lib/uob/payroll/txt_file/header.rb', line 52

def 
  
end

#originating_bic_codeObject



48
49
50
# File 'lib/uob/payroll/txt_file/header.rb', line 48

def originating_bic_code
  "UOVBSGSG#{branch_code}"
end