nacha 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.gitlab-ci.yml +13 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +42 -0
  6. data/.ruby-gemset +1 -0
  7. data/.ruby-version +1 -0
  8. data/.travis.yml +5 -0
  9. data/Gemfile +9 -0
  10. data/Guardfile +20 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +75 -0
  13. data/ROADMAP.md +56 -0
  14. data/Rakefile +6 -0
  15. data/bin/console +14 -0
  16. data/bin/setup +8 -0
  17. data/lib/nacha/aba_number.rb +44 -0
  18. data/lib/nacha/ach_date.rb +24 -0
  19. data/lib/nacha/field.rb +139 -0
  20. data/lib/nacha/numeric.rb +68 -0
  21. data/lib/nacha/parser.rb +67 -0
  22. data/lib/nacha/record/addenda_record_type.rb +29 -0
  23. data/lib/nacha/record/adv_batch_control.rb +21 -0
  24. data/lib/nacha/record/adv_entry_detail.rb +27 -0
  25. data/lib/nacha/record/adv_file_control.rb +24 -0
  26. data/lib/nacha/record/adv_file_header.rb +26 -0
  27. data/lib/nacha/record/arc_entry_detail.rb +24 -0
  28. data/lib/nacha/record/base.rb +170 -0
  29. data/lib/nacha/record/batch_control.rb +24 -0
  30. data/lib/nacha/record/batch_control_record_type.rb +21 -0
  31. data/lib/nacha/record/batch_header.rb +26 -0
  32. data/lib/nacha/record/batch_header_record_type.rb +25 -0
  33. data/lib/nacha/record/boc_entry_detail.rb +23 -0
  34. data/lib/nacha/record/ccd_addenda.rb +19 -0
  35. data/lib/nacha/record/ccd_entry_detail.rb +23 -0
  36. data/lib/nacha/record/cie_addenda.rb +19 -0
  37. data/lib/nacha/record/cie_entry_detail.rb +23 -0
  38. data/lib/nacha/record/ctx_addenda.rb +17 -0
  39. data/lib/nacha/record/ctx_corporate_entry_detail.rb +26 -0
  40. data/lib/nacha/record/detail_record_type.rb +29 -0
  41. data/lib/nacha/record/dne_addenda.rb +19 -0
  42. data/lib/nacha/record/dne_entry_detail.rb +24 -0
  43. data/lib/nacha/record/enr_addenda.rb +19 -0
  44. data/lib/nacha/record/enr_entry_detail.rb +26 -0
  45. data/lib/nacha/record/fifth_iat_addenda.rb +19 -0
  46. data/lib/nacha/record/file_control.rb +21 -0
  47. data/lib/nacha/record/file_control_record_type.rb +21 -0
  48. data/lib/nacha/record/file_header.rb +26 -0
  49. data/lib/nacha/record/file_header_record_type.rb +31 -0
  50. data/lib/nacha/record/filler.rb +13 -0
  51. data/lib/nacha/record/filler_record_type.rb +21 -0
  52. data/lib/nacha/record/first_iat_addenda.rb +22 -0
  53. data/lib/nacha/record/fourth_iat_addenda.rb +22 -0
  54. data/lib/nacha/record/iat_batch_header.rb +30 -0
  55. data/lib/nacha/record/iat_entry_detail.rb +26 -0
  56. data/lib/nacha/record/iat_foreign_coorespondent_bank_information_addenda.rb +23 -0
  57. data/lib/nacha/record/iat_remittance_information_addenda.rb +19 -0
  58. data/lib/nacha/record/mte_addenda.rb +26 -0
  59. data/lib/nacha/record/mte_entry_detail.rb +24 -0
  60. data/lib/nacha/record/pop_entry_detail.rb +26 -0
  61. data/lib/nacha/record/pos_addenda.rb +25 -0
  62. data/lib/nacha/record/pos_entry_detail.rb +24 -0
  63. data/lib/nacha/record/ppd_addenda.rb +19 -0
  64. data/lib/nacha/record/ppd_entry_detail.rb +24 -0
  65. data/lib/nacha/record/rck_entry_detail.rb +24 -0
  66. data/lib/nacha/record/second_iat_addenda.rb +20 -0
  67. data/lib/nacha/record/seventh_iat_addenda.rb +20 -0
  68. data/lib/nacha/record/shr_addenda.rb +26 -0
  69. data/lib/nacha/record/shr_entry_detail.rb +25 -0
  70. data/lib/nacha/record/sixth_iat_addenda.rb +20 -0
  71. data/lib/nacha/record/tel_entry_detail.rb +24 -0
  72. data/lib/nacha/record/third_iat_addenda.rb +20 -0
  73. data/lib/nacha/record/trc_entry_detail.rb +25 -0
  74. data/lib/nacha/record/trx_addenda.rb +19 -0
  75. data/lib/nacha/record/trx_entry_detail.rb +26 -0
  76. data/lib/nacha/record/validations/field_validations.rb +33 -0
  77. data/lib/nacha/record/validations/record_validations.rb +15 -0
  78. data/lib/nacha/record/web_addenda.rb +19 -0
  79. data/lib/nacha/record/web_entry_detail.rb +24 -0
  80. data/lib/nacha/record/xck_entry_detail.rb +25 -0
  81. data/lib/nacha/version.rb +5 -0
  82. data/lib/nacha.rb +45 -0
  83. data/nacha.gemspec +38 -0
  84. metadata +304 -0
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/batch_control_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class AdvBatchControl < Nacha::Record::Base
10
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C8', position: 1..1
11
+ nacha_field :service_class_code, inclusion: 'M', contents: 'Numeric', position: 2..4
12
+ nacha_field :entry_addenda_count, inclusion: 'M', contents: 'Numeric', position: 5..10
13
+ nacha_field :entry_hash, inclusion: 'M', contents: 'Numeric', position: 11..20
14
+ nacha_field :total_debit_entry_dollar_amount, inclusion: 'M', contents: '$$$$$$$$$$$$$$$$$$¢¢', position: 21..40
15
+ nacha_field :total_credit_entry_dollar_amount, inclusion: 'M', contents: '$$$$$$$$$$$$$$$$$$¢¢', position: 41..60
16
+ nacha_field :ach_operator_data, inclusion: 'O', contents: 'Alphameric', position: 61..79
17
+ nacha_field :originating_dfi_identification, inclusion: 'M', contents: 'TTTAAAA', position: 80..87
18
+ nacha_field :batch_number, inclusion: 'M', contents: 'Numeric', position: 88..94
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/detail_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class AdvEntryDetail < Nacha::Record::Base
10
+ include DetailRecordType
11
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C6', position: 1..1
12
+ nacha_field :transaction_code, inclusion: 'M', contents: 'Numeric', position: 2..3
13
+ nacha_field :receiving_dfi_identification, inclusion: 'M', contents: 'TTTTAAAAC', position: 4..12
14
+ nacha_field :dfi_account_number, inclusion: 'R', contents: 'Alphameric', position: 13..29
15
+ nacha_field :amount, inclusion: 'M', contents: '$$$$$$$$¢¢', position: 30..39
16
+ nacha_field :advice_routing_number, inclusion: 'M', contents: 'Numeric', position: 40..48
17
+ nacha_field :file_identification, inclusion: 'O', contents: 'Alphameric', position: 49..53
18
+ nacha_field :ach_operator_data, inclusion: 'O', contents: 'Alphameric', position: 54..54
19
+ nacha_field :individual_name, inclusion: 'R', contents: 'Alphameric', position: 55..76
20
+ nacha_field :discretionary_data, inclusion: 'O', contents: 'Alphameric', position: 77..78
21
+ nacha_field :addenda_record_indicator, inclusion: 'M', contents: 'Numeric', position: 79..79
22
+ nacha_field :routing_number_of_ach_operator, inclusion: 'M', contents: 'TTTTAAAA', position: 80..87
23
+ nacha_field :julian_date_created, inclusion: 'M', contents: 'Numeric', position: 88..90
24
+ nacha_field :sequence_number, inclusion: 'M', contents: 'Numeric', position: 91..94
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/file_control_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class AdvFileControl < Nacha::Record::Base
10
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C9', position: 1..1
11
+ nacha_field :batch_count, inclusion: 'M', contents: 'Numeric', position: 2..7
12
+ nacha_field :block_count, inclusion: 'M', contents: 'Numeric', position: 8..13
13
+ nacha_field :entry_addenda_count, inclusion: 'M', contents: 'Numeric', position: 14..21
14
+ nacha_field :entry_hash, inclusion: 'M', contents: 'Numeric', position: 22..31
15
+ nacha_field :total_debit_entry_dollar_amount_in_file, inclusion: 'M', contents: '$$$$$$$$$$¢¢', position: 32..51
16
+ nacha_field :total_credit_entry_dollar_amount_in_file, inclusion: 'M', contents: '$$$$$$$$$$¢¢', position: 52..71
17
+ nacha_field :reserved, inclusion: 'M', contents: 'C', position: 72..94
18
+
19
+ def initialize
20
+ create_fields_from_definition
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/file_header_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class AdvFileHeader < Nacha::Record::Base
10
+ include FileHeaderRecordType
11
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C1', position: 1..1
12
+ nacha_field :priority_code, inclusion: 'R', contents: 'Numeric', position: 2..3
13
+ nacha_field :immediate_destination, inclusion: 'M', contents: 'bTTTTAAAAC', position: 4..13
14
+ nacha_field :immediate_origin, inclusion: 'M', contents: 'bTTTTAAAAC', position: 14..23
15
+ nacha_field :file_creation_date, inclusion: 'M', contents: 'YYMMDD', position: 24..29
16
+ nacha_field :file_creation_time, inclusion: 'M', contents: 'HHMM', position: 30..33
17
+ nacha_field :file_id_modifier, inclusion: 'M', contents: 'A-Z0-9', position: 34..34
18
+ nacha_field :record_size, inclusion: 'M', contents: 'C094', position: 35..37
19
+ nacha_field :blocking_factor, inclusion: 'M', contents: 'C10', position: 38..39
20
+ nacha_field :format_code, inclusion: 'M', contents: 'C1', position: 40..40
21
+ nacha_field :immediate_destination_name, inclusion: 'M', contents: 'Alphameric', position: 41..63
22
+ nacha_field :immediate_origin_name, inclusion: 'M', contents: 'Alphameric', position: 64..86
23
+ nacha_field :reference_code, inclusion: 'M', contents: 'Alphameric', position: 87..94
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/detail_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class ArcEntryDetail < Nacha::Record::Base
10
+ include DetailRecordType
11
+
12
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C6', position: 1..1
13
+ nacha_field :transaction_code, inclusion: 'M', contents: 'Numeric', position: 2..3
14
+ nacha_field :receiving_dfi_identification, inclusion: 'M', contents: 'TTTTAAAAC', position: 4..12
15
+ nacha_field :dfi_account_number, inclusion: 'R', contents: 'Alphameric', position: 13..29
16
+ nacha_field :amount, inclusion: 'M', contents: '$$$$$$$$¢¢', position: 30..39
17
+ nacha_field :check_serial_number, inclusion: 'M', contents: 'Alphameric', position: 40..54
18
+ nacha_field :individual_name, inclusion: 'O', contents: 'Alphameric', position: 55..76
19
+ nacha_field :discretionary_data, inclusion: 'O', contents: 'Alphameric', position: 77..78
20
+ nacha_field :addenda_record_indicator, inclusion: 'M', contents: 'Numeric', position: 79..79
21
+ nacha_field :trace_number, inclusion: 'M', contents: 'Numeric', position: 80..94
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,170 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'nacha/field'
5
+ require 'nacha/record/validations/field_validations'
6
+
7
+ module Nacha
8
+ module Record
9
+ class Base
10
+ include FieldValidations
11
+
12
+ attr_accessor :children, :parent, :fields
13
+ attr_reader :definition, :name
14
+ attr_reader :validations
15
+
16
+ @@unpack_str = nil
17
+ # @@matcher = nil
18
+
19
+ def initialize(opts = {})
20
+ @children = []
21
+ create_fields_from_definition
22
+ opts.each do |k, v|
23
+ setter = "#{k}="
24
+ if respond_to?(setter)
25
+ send(setter, v) unless v.nil?
26
+ end
27
+ end
28
+ end
29
+
30
+ def create_fields_from_definition
31
+ @fields ||= {}
32
+ definition.each_pair do |field_name, field_def|
33
+ @fields[field_name.to_sym] = Nacha::Field.new(field_def)
34
+ end
35
+ end
36
+
37
+ def record_type
38
+ Nacha.record_name(self.class)
39
+ end
40
+
41
+ def to_h
42
+ { nacha_record_type: record_type }.merge(
43
+ @fields.keys.map do |key|
44
+ [key, @fields[key].to_json_output]
45
+ end.to_h)
46
+ end
47
+
48
+ def to_json(*_args)
49
+ JSON.pretty_generate(to_h)
50
+ end
51
+
52
+ def to_ach
53
+ @fields.keys.collect do |key|
54
+ @fields[key].to_ach
55
+ end.join
56
+ end
57
+
58
+ def inspect
59
+ "#<#{self.class.name}> #{to_h}"
60
+ end
61
+
62
+ def self.nacha_field(name, inclusion:, contents:, position:)
63
+ definition[name] = { inclusion: inclusion,
64
+ contents: contents,
65
+ position: position,
66
+ name: name }
67
+ validation_method = "valid_#{name}".to_sym
68
+ if respond_to?(validation_method)
69
+ validations[name] ||= []
70
+ validations[name] << validation_method
71
+ end
72
+ end
73
+
74
+ def self.definition
75
+ @definition ||= {}
76
+ end
77
+
78
+ def self.validations
79
+ @validations ||= {}
80
+ end
81
+
82
+ def self.nacha_record_name(record_name)
83
+ @nacha_record_name = record_name
84
+ end
85
+
86
+ def definition
87
+ self.class.definition
88
+ end
89
+
90
+ def validate
91
+ self.class.definition.keys.map do |field|
92
+ if self.class.validations[field]
93
+ field_data = send(field)
94
+ send(self.class.validations[:field], field_data)
95
+ end
96
+ end
97
+ end
98
+
99
+ # look for invalid fields, if none, then return true
100
+ def valid?
101
+ !self.class.definition.keys.map do |field_sym|
102
+ field = send(field_sym)
103
+ next unless field.mandatory?
104
+
105
+ ## TODO: levels of validity with 'R' and 'O' fields
106
+
107
+ field.valid?
108
+ end.detect { |valid| valid == false }
109
+ end
110
+
111
+ def debit?
112
+ transaction_code &&
113
+ DEBIT_TRANSACTION_CODES.include?(transaction_code.to_s)
114
+ end
115
+
116
+ def credit?
117
+ transaction_code &&
118
+ CREDIT_TRANSACTION_CODES.include?(transaction_code.to_s)
119
+ end
120
+
121
+ def self.unpack_str
122
+ @unpack_str ||= definition.values.collect do |d|
123
+ Nacha::Field.unpack_str(d)
124
+ end.join.freeze
125
+ end
126
+
127
+ def self.matcher
128
+ # puts definition.keys.join(', ')
129
+ definition['matcher'] ||
130
+ Regexp.new('\A' + definition.values.collect do |d|
131
+ if d[:contents] =~ /\AC(.+)\z/ || d['contents'] =~ /\AC(.+)\z/
132
+ Regexp.last_match(1)
133
+ else
134
+ '.' * (d[:position] || d['position']).size
135
+ end
136
+ end.join + '\z')
137
+ end
138
+
139
+ def self.parse(ach_str)
140
+ rec = new
141
+ ach_str.unpack(unpack_str).zip(rec.fields.values) do |input_data, field|
142
+ field.data = input_data
143
+ end
144
+ rec
145
+ end
146
+
147
+ def respond_to?(method_name, include_private = false)
148
+ field_name = method_name.to_s.gsub(/=$/, '').to_sym
149
+ definition[field_name] || super
150
+ end
151
+
152
+ def method_missing(method_name, *args, &block)
153
+ field_name = method_name.to_s.gsub(/=$/, '').to_sym
154
+ is_assignment = (/[^=]*=$/o =~ method_name.to_s)
155
+ if @fields[field_name]
156
+ if is_assignment
157
+ # @fields[field_name].send(:data=,*args)
158
+ @fields[field_name].send(:data=, *args)
159
+ @dirty = true
160
+ else
161
+ # @fields[field_name].data
162
+ @fields[field_name]
163
+ end
164
+ else
165
+ super
166
+ end
167
+ end
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/batch_control_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class BatchControl < Nacha::Record::Base
10
+ include BatchControlRecordType
11
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C8', position: 1..1
12
+ nacha_field :service_class_code, inclusion: 'M', contents: 'Numeric', position: 2..4
13
+ nacha_field :entry_addenda_count, inclusion: 'M', contents: 'Numeric', position: 5..10
14
+ nacha_field :entry_hash, inclusion: 'M', contents: 'Numeric', position: 11..20
15
+ nacha_field :total_debit_entry_dollar_amount, inclusion: 'M', contents: '$$$$$$$$$$¢¢', position: 21..32
16
+ nacha_field :total_credit_entry_dollar_amount, inclusion: 'M', contents: '$$$$$$$$$$¢¢', position: 33..44
17
+ nacha_field :company_identification, inclusion: 'R', contents: 'Alphameric', position: 45..54
18
+ nacha_field :message_authentication_code, inclusion: 'O', contents: 'Alphameric', position: 55..73
19
+ nacha_field :reserved, inclusion: 'M', contents: 'C ', position: 74..79
20
+ nacha_field :originating_dfi_identification, inclusion: 'M', contents: 'TTTTAAAA', position: 80..87
21
+ nacha_field :batch_number, inclusion: 'M', contents: 'Numeric', position: 88..94
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nacha
4
+ module Record
5
+ module BatchControlRecordType
6
+ def self.included(base)
7
+ base.extend ClassMethods
8
+ end
9
+
10
+ module ClassMethods
11
+ def child_record_types
12
+ []
13
+ end
14
+ end
15
+
16
+ def child_record_types
17
+ self.class.child_record_types
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'nacha/record/base.rb'
4
+ require 'nacha/record/batch_header_record_type.rb'
5
+
6
+ module Nacha
7
+ module Record
8
+ class BatchHeader < Nacha::Record::Base
9
+ include BatchHeaderRecordType
10
+
11
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C5', position: 1..1
12
+ nacha_field :service_class_code, inclusion: 'M', contents: 'Numeric', position: 2..4
13
+ nacha_field :company_name, inclusion: 'M', contents: 'Alphameric', position: 5..20
14
+ nacha_field :company_discretionary_data, inclusion: 'O', contents: 'Alphameric', position: 21..40
15
+ nacha_field :company_identification, inclusion: 'M', contents: 'Alphameric', position: 41..50
16
+ nacha_field :standard_entry_class_code, inclusion: 'M', contents: 'Alphameric', position: 51..53
17
+ nacha_field :company_entry_description, inclusion: 'M', contents: 'Alphameric', position: 54..63
18
+ nacha_field :company_descriptive_date, inclusion: 'O', contents: 'Alphameric', position: 64..69
19
+ nacha_field :effective_entry_date, inclusion: 'R', contents: 'YYMMDD', position: 70..75
20
+ nacha_field :settlement_date_julian, inclusion: 'M', contents: 'Numeric', position: 76..78
21
+ nacha_field :originator_status_code, inclusion: 'M', contents: 'Alphameric', position: 79..79
22
+ nacha_field :originating_dfi_identification, inclusion: 'M', contents: 'TTTTAAAA', position: 80..87
23
+ nacha_field :batch_number, inclusion: 'M', contents: 'Numeric', position: 88..94
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nacha
4
+ module Record
5
+ module BatchHeaderRecordType
6
+ def self.included(base)
7
+ base.extend ClassMethods
8
+ end
9
+
10
+ module ClassMethods
11
+ def child_record_types
12
+ []
13
+ end
14
+ end
15
+
16
+ def child_record_types
17
+ sec = standard_entry_class_code.to_s.capitalize
18
+ [
19
+ 'Nacha::Record::' + sec + 'EntryDetail',
20
+ 'Nacha::Record::BatchControl'
21
+ ]
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/detail_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class BocEntryDetail < Nacha::Record::Base
10
+ include DetailRecordType
11
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C6', position: 1..1
12
+ nacha_field :transaction_code, inclusion: 'M', contents: 'Numeric', position: 2..3
13
+ nacha_field :receiving_dfi_identification, inclusion: 'M', contents: 'TTTTAAAAC', position: 4..12
14
+ nacha_field :dfi_account_number, inclusion: 'R', contents: 'Alphameric', position: 13..29
15
+ nacha_field :amount, inclusion: 'M', contents: '$$$$$$$$¢¢', position: 30..39
16
+ nacha_field :check_serial_number, inclusion: 'M', contents: 'Alphameric', position: 40..54
17
+ nacha_field :individual_name, inclusion: 'O', contents: 'Alphameric', position: 55..76
18
+ nacha_field :discretionary_data, inclusion: 'O', contents: 'Alphameric', position: 77..78
19
+ nacha_field :addenda_record_indicator, inclusion: 'M', contents: 'Numeric', position: 79..79
20
+ nacha_field :trace_number, inclusion: 'M', contents: 'Numeric', position: 80..94
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/addenda_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class CcdAddenda < Nacha::Record::Base
10
+ include AddendaRecordType
11
+
12
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C7', position: 1..1
13
+ nacha_field :addenda_type_code, inclusion: 'M', contents: 'C05', position: 2..3
14
+ nacha_field :payment_related_information, inclusion: 'O', contents: 'Alphameric', position: 4..83
15
+ nacha_field :addenda_sequence_number, inclusion: 'M', contents: 'Numeric', position: 84..87
16
+ nacha_field :entry_detail_sequence_number, inclusion: 'M', contents: 'Numeric', position: 88..94
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/detail_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class CcdEntryDetail < Nacha::Record::Base
10
+ include DetailRecordType
11
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C6', position: 1..1
12
+ nacha_field :transaction_code, inclusion: 'M', contents: 'Numeric', position: 2..3
13
+ nacha_field :receiving_dfi_identification, inclusion: 'M', contents: 'TTTTAAAAC', position: 4..12
14
+ nacha_field :dfi_account_number, inclusion: 'R', contents: 'Alphameric', position: 13..29
15
+ nacha_field :amount, inclusion: 'M', contents: '$$$$$$$$¢¢', position: 30..39
16
+ nacha_field :identification_number, inclusion: 'O', contents: 'Alphameric', position: 40..54
17
+ nacha_field :receiving_company_name, inclusion: 'R', contents: 'Alphameric', position: 55..76
18
+ nacha_field :discretionary_data, inclusion: 'O', contents: 'Alphameric', position: 77..78
19
+ nacha_field :addenda_record_indicator, inclusion: 'M', contents: 'Numeric', position: 79..79
20
+ nacha_field :trace_number, inclusion: 'M', contents: 'Numeric', position: 80..94
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/addenda_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class CieAddenda < Nacha::Record::Base
10
+ include AddendaRecordType
11
+
12
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C7', position: 1..1
13
+ nacha_field :addenda_type_code, inclusion: 'M', contents: 'C05', position: 2..3
14
+ nacha_field :payment_related_information, inclusion: 'O', contents: 'Alphameric', position: 4..83
15
+ nacha_field :addenda_sequence_number, inclusion: 'M', contents: 'Numeric', position: 84..87
16
+ nacha_field :entry_detail_sequence_number, inclusion: 'M', contents: 'Numeric', position: 88..94
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/detail_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class CieEntryDetail < Nacha::Record::Base
10
+ include DetailRecordType
11
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C6', position: 1..1
12
+ nacha_field :transaction_code, inclusion: 'M', contents: 'Numeric', position: 2..3
13
+ nacha_field :receiving_dfi_identification, inclusion: 'M', contents: 'TTTTAAAAC', position: 4..12
14
+ nacha_field :dfi_account_number, inclusion: 'R', contents: 'Alphameric', position: 13..29
15
+ nacha_field :amount, inclusion: 'M', contents: '$$$$$$$$¢¢', position: 30..39
16
+ nacha_field :individual_name, inclusion: 'R', contents: 'Alphameric', position: 40..54
17
+ nacha_field :individual_identification_number, inclusion: 'M', contents: 'Alphameric', position: 55..76
18
+ nacha_field :discretionary_data, inclusion: 'O', contents: 'Alphameric', position: 77..78
19
+ nacha_field :addenda_record_indicator, inclusion: 'M', contents: 'Numeric', position: 79..79
20
+ nacha_field :trace_number, inclusion: 'M', contents: 'Numeric', position: 80..94
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'nacha/record/base.rb'
4
+ require 'nacha/record/addenda_record_type.rb'
5
+ module Nacha
6
+ module Record
7
+ class CtxAddenda < Nacha::Record::Base
8
+ include AddendaRecordType
9
+
10
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C7', position: 1..1
11
+ nacha_field :addenda_type_code, inclusion: 'M', contents: 'C05', position: 2..3
12
+ nacha_field :payment_related_information, inclusion: 'O', contents: 'Alphameric', position: 4..83
13
+ nacha_field :addenda_sequence_number, inclusion: 'M', contents: 'Numeric', position: 84..87
14
+ nacha_field :entry_detail_sequence_number, inclusion: 'M', contents: 'Numeric', position: 88..94
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/detail_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class CtxCorporateEntryDetail < Nacha::Record::Base
10
+ include DetailRecordType
11
+
12
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C6', position: 1..1
13
+ nacha_field :transaction_code, inclusion: 'M', contents: 'Numeric', position: 2..3
14
+ nacha_field :receiving_dfi_identification, inclusion: 'M', contents: 'TTTTAAAAC', position: 4..12
15
+ nacha_field :dfi_account_number, inclusion: 'R', contents: 'Alphameric', position: 13..29
16
+ nacha_field :total_amount, inclusion: 'M', contents: '$$$$$$$$¢¢', position: 30..39
17
+ nacha_field :identification_number, inclusion: 'O', contents: 'Alphameric', position: 40..54
18
+ nacha_field :number_of_addenda_records, inclusion: 'M', contents: 'Alphameric', position: 55..58
19
+ nacha_field :receiving_company_name, inclusion: 'R', contents: 'Alphameric', position: 59..74
20
+ nacha_field :reserved, inclusion: 'M', contents: 'Alphameric', position: 75..76
21
+ nacha_field :discretionary_data, inclusion: 'O', contents: 'Alphameric', position: 77..78
22
+ nacha_field :addenda_record_indicator, inclusion: 'M', contents: 'Numeric', position: 79..79
23
+ nacha_field :trace_number, inclusion: 'M', contents: 'Numeric', position: 80..94
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nacha
4
+ module Record
5
+ module DetailRecordType
6
+ def self.included(base)
7
+ base.extend ClassMethods
8
+ end
9
+
10
+ module ClassMethods
11
+ def child_record_types
12
+ []
13
+ end
14
+
15
+ def next_record_types
16
+ []
17
+ end
18
+ end
19
+
20
+ def child_record_types
21
+ self.class.child_record_types
22
+ end
23
+
24
+ def next_record_types
25
+ self.class.next_record_types
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,19 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/addenda_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class DneAddenda < Nacha::Record::Base
10
+ include AddendaRecordType
11
+
12
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C7', position: 1..1
13
+ nacha_field :addenda_type_code, inclusion: 'M', contents: 'C05', position: 2..3
14
+ nacha_field :payment_related_information, inclusion: 'O', contents: 'Alphameric', position: 4..83
15
+ nacha_field :addenda_sequence_number, inclusion: 'M', contents: 'Numeric', position: 84..87
16
+ nacha_field :entry_detail_sequence_number, inclusion: 'M', contents: 'Numeric', position: 88..94
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/detail_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class DneEntryDetail < Nacha::Record::Base
10
+ include DetailRecordType
11
+
12
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C6', position: 1..1
13
+ nacha_field :transaction_code, inclusion: 'M', contents: 'Numeric', position: 2..3
14
+ nacha_field :receiving_dfi_identification, inclusion: 'M', contents: 'TTTTAAAAC', position: 4..12
15
+ nacha_field :receiving_dfi_identification, inclusion: 'M', contents: 'Alphameric', position: 13..29
16
+ nacha_field :amount, inclusion: 'M', contents: '$$$$$$$$¢¢', position: 30..39
17
+ nacha_field :individual_identification_number, inclusion: 'O', contents: 'Alphameric', position: 40..54
18
+ nacha_field :individual_name, inclusion: 'R', contents: 'Alphameric', position: 55..76
19
+ nacha_field :discretionary_data, inclusion: 'O', contents: 'Alphameric', position: 77..78
20
+ nacha_field :addenda_record_indicator, inclusion: 'M', contents: 'Numeric', position: 79..79
21
+ nacha_field :trace_number, inclusion: 'M', contents: 'Numeric', position: 80..94
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,19 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require 'nacha/record/base.rb'
5
+ require 'nacha/record/addenda_record_type.rb'
6
+
7
+ module Nacha
8
+ module Record
9
+ class EnrAddenda < Nacha::Record::Base
10
+ include AddendaRecordType
11
+
12
+ nacha_field :record_type_code, inclusion: 'M', contents: 'C7', position: 1..1
13
+ nacha_field :addenda_type_code, inclusion: 'M', contents: 'C05', position: 2..3
14
+ nacha_field :payment_related_information, inclusion: 'R', contents: 'Alphameric', position: 4..83
15
+ nacha_field :addenda_sequence_number, inclusion: 'M', contents: 'Numeric', position: 84..87
16
+ nacha_field :entry_detail_sequence_number, inclusion: 'M', contents: 'Numeric', position: 88..94
17
+ end
18
+ end
19
+ end