Class: Ach::BatchControlRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/ach/parser.rb,
lib/ach/creator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ BatchControlRecord

Returns a new instance of BatchControlRecord.



374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/ach/creator.rb', line 374

def initialize(options={})
  @record_type = '8'
  @service_class_code = options[:service_class_code]
  @addenda_count = options[:addenda_count]
  @entry_hash=options[:entry_hash]
  @total_debits = options[:total_debits]
  @total_credits = options[:total_credits]
  @company_id = options[:company_id]
  @routing_num = options[:routing_num]
  @batch_number = options[:batch_number]
  @write_to_file = options[:write_to_file]
  encode
end

Instance Attribute Details

#addenda_countObject

Returns the value of attribute addenda_count.



372
373
374
# File 'lib/ach/creator.rb', line 372

def addenda_count
  @addenda_count
end

#batch_numberObject

Returns the value of attribute batch_number.



373
374
375
# File 'lib/ach/creator.rb', line 373

def batch_number
  @batch_number
end

#company_idObject

Returns the value of attribute company_id.



372
373
374
# File 'lib/ach/creator.rb', line 372

def company_id
  @company_id
end

#entry_hashObject

Returns the value of attribute entry_hash.



372
373
374
# File 'lib/ach/creator.rb', line 372

def entry_hash
  @entry_hash
end

#msg_authentication_codeObject

Returns the value of attribute msg_authentication_code.



373
374
375
# File 'lib/ach/creator.rb', line 373

def msg_authentication_code
  @msg_authentication_code
end

#record_typeObject

Returns the value of attribute record_type.



372
373
374
# File 'lib/ach/creator.rb', line 372

def record_type
  @record_type
end

#routing_numObject

Returns the value of attribute routing_num.



373
374
375
# File 'lib/ach/creator.rb', line 373

def routing_num
  @routing_num
end

#service_class_codeObject

Returns the value of attribute service_class_code.



372
373
374
# File 'lib/ach/creator.rb', line 372

def service_class_code
  @service_class_code
end

#total_creditsObject

Returns the value of attribute total_credits.



373
374
375
# File 'lib/ach/creator.rb', line 373

def total_credits
  @total_credits
end

#total_debitsObject

Returns the value of attribute total_debits.



373
374
375
# File 'lib/ach/creator.rb', line 373

def total_debits
  @total_debits
end

Class Method Details

.decode(record, processor) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/ach/parser.rb', line 88

def self.decode(record)
  bcr = {}
  bcr[:record_type] = record[0].chr
  bcr[:service_class_code] = record[1,3]
  bcr[:entry_addenda_count] = record[4,6]
  bcr[:entry_hash] = record[10,10]
  bcr[:total_batch_debit_entry_dollar_amount] = record[20,12]
  bcr[:total_batch_credit_entry_dollar_amount] = record[32,12]
  bcr[:company_id] = record[44,10]
  bcr[:message_authentication_code] = record[54,19]
  bcr[:blank] = record[73,6]
  bcr[:wellsfargo_routing_number] = record[79,8]
  bcr[:batch_number] = record[87,7]
  return bcr
end