Browse files

Add company identification code designator

* A new field, company_identification_code_designator, was added to
the batch header and batch control. In order to preserve backwards
compatibility the field defaults to 1. Optionally a user can set the
code designator to 3.

* I rolled back the test changes that were made in the initial
commit.
  • Loading branch information...
1 parent ad3e0d3 commit 3078e0f200bfa6d8a71297b1c525e331ff616ebc @pwiesner pwiesner committed Dec 10, 2012
View
3 README.md
@@ -31,7 +31,8 @@ fh.immediate_origin_name = "BANK NAME"
batch = ACH::Batch.new
bh = batch.header
bh.company_name = "Company Name"
-bh.company_identification = "1234567890"
+bh.company_identification_code_designator = "1"
+bh.company_identification = "123456789"
bh.standard_entry_class_code = 'PPD'
bh.company_entry_description = "DESCRIPTION"
bh.company_descriptive_date = Date.today
View
2 examples/ach/batch_example.rb
@@ -21,7 +21,7 @@ def new_batch
batch = ACH::Batch.new
bh = batch.header
bh.company_name = "Company Name"
- bh.company_identification = "1234567890"
+ bh.company_identification = "123456789"
bh.standard_entry_class_code = 'PPD'
bh.company_entry_description = "DESCRIPTION"
bh.company_descriptive_date = Date.today
View
2 examples/ach/parse_example.rb
@@ -22,7 +22,7 @@
batch.entries.size.should == 1
bh = batch.header
bh.company_name.should == "COMPANY INC"
- bh.company_identification.should == "1412345678"
+ bh.company_identification.should == "412345678"
bh.standard_entry_class_code.should == 'COR'
bh.company_entry_description.should == "DESCRIPT"
bh.company_descriptive_date.should == Date.parse('121015')
View
4 examples/ach/records/batch_control_example.rb
@@ -8,7 +8,7 @@
@record.entry_hash = 2
@record.debit_total = 3
@record.credit_total = 4
- @record.company_identification = '1234567890'
+ @record.company_identification = '123456789'
@record.message_authentication_code = '22345678'
@record.originating_dfi_identification = '32345678'
@record.batch_number = 5
@@ -25,7 +25,7 @@
'0000000002',
'000000000003',
'000000000004',
- '1234567890',
+ '1123456789',
'22345678 ',
' ',
'32345678',
View
2 examples/ach/records/ctx_entry_detail_example.rb
@@ -5,7 +5,7 @@
@entry = ACH::CtxEntryDetail.new
@entry.transaction_code = ACH::CHECKING_DEBIT
@entry.routing_number = '023456789'
- @entry.account_number = '1234567890'
+ @entry.account_number = '123456789'
@entry.amount = 10000
@entry.individual_name = "Bob Roberts"
@entry.originating_dfi_identification = '02345678'
View
2 examples/ach/records/ctx_entry_detail_test.rb
@@ -8,7 +8,7 @@ def setup
@entry = ACH::CtxEntryDetail.new
@entry.transaction_code = ACH::CHECKING_DEBIT
@entry.routing_number = '023456789'
- @entry.account_number = '1234567890'
+ @entry.account_number = '123456789'
@entry.amount = 10000
@entry.individual_name = "Bob Roberts"
@entry.originating_dfi_identification = '02345678'
View
2 lib/ach/ach_file.rb
@@ -89,7 +89,7 @@ def parse data
batch = ACH::Batch.new
bh = batch.header
bh.company_name = line[4..19].strip
- bh.company_identification = line[40..49].strip
+ bh.company_identification = line[41..49].strip
bh.standard_entry_class_code = line[50..52].strip
bh.company_entry_description = line[53..62].strip
bh.company_descriptive_date = Date.parse(line[63..68]) rescue nil # this can be various formats
View
5 lib/ach/records/batch_control.rb
@@ -12,9 +12,10 @@ class BatchControl < Record
field :entry_hash, Integer, lambda { |f| sprintf('%010d', f % (10 ** 10))}
field :debit_total, Integer, lambda { |f| sprintf('%012d', f)}
field :credit_total, Integer, lambda { |f| sprintf('%012d', f)}
-
+ field :company_identification_code_designator, String, lambda {|f| f}, '1',
+ /\A(1|3){1}\Z/
field :company_identification, String,
- lambda {|f| f}, nil, /\A\d{10}\Z/,
+ lambda {|f| f}, nil, /\A\d{9}\Z/,
'Company Tax ID'
field :message_authentication_code, String,
View
4 lib/ach/records/batch_header.rb
@@ -11,8 +11,10 @@ class BatchHeader < Record
field :company_name, String, lambda { |f| left_justify(f, 16)}
field :company_discretionary_data, String,
lambda { |f| left_justify(f, 20)}, ''
+ field :company_identification_code_designator, String, lambda {|f| f}, '1',
+ /\A(1|3){1}\Z/
field :company_identification, String,
- lambda {|f| f}, nil, /\A\d{10}\Z/,
+ lambda {|f| f}, nil, /\A\d{9}\Z/,
'Company Tax ID'
# TODO This should be used to determine whether other records are valid for
# for this code. Should there be a Class for each code?

0 comments on commit 3078e0f

Please sign in to comment.