ach 0.5.11 → 0.5.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/ach/ach_file.rb +5 -6
- data/lib/ach/batch.rb +11 -1
- data/lib/ach/field_identifiers.rb +1 -1
- data/lib/ach/next_federal_reserve_effective_date.rb +7 -1
- data/lib/ach/records/entry_detail.rb +11 -1
- data/lib/ach/version.rb +1 -1
- metadata +7 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a6f2cdcb923998c4fc08e11bd9efeb320e349187e657ab7b29ff79c325447510
|
4
|
+
data.tar.gz: 951a8528fb40feebb2ed689649b86cce1b25623a51fab780c0c6f994bfa8ffee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bbc5ff04f7a5ee0196495e00c8a31077dc0a2ad1439953ff6c5c7971d2bb256ad03321261c187a8364c96ddfe6db0983104b07f10266ada86ad24699c09dab2
|
7
|
+
data.tar.gz: 6d8158a6e81466d7d6017e4d017a948a898dfed6ed96880ff5b6be19cc4496890bd585da757d800dd921287e4334889d942d67390f7d020ebbefda9e2c69cbc8
|
data/lib/ach/ach_file.rb
CHANGED
@@ -14,7 +14,7 @@ module ACH
|
|
14
14
|
@control = Records::FileControl.new
|
15
15
|
|
16
16
|
if data
|
17
|
-
if (data.encode(Encoding.find('ASCII'),ENCODING_OPTIONS) =~ /\n|\r\n/).nil?
|
17
|
+
if (data.encode(Encoding.find('ASCII'), **ENCODING_OPTIONS) =~ /\n|\r\n/).nil?
|
18
18
|
parse_fixed(data)
|
19
19
|
else
|
20
20
|
parse(data)
|
@@ -22,6 +22,7 @@ module ACH
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
|
25
26
|
# @param eol [String] Line ending, default to CRLF
|
26
27
|
def to_s eol = "\r\n"
|
27
28
|
records = []
|
@@ -33,16 +34,14 @@ module ACH
|
|
33
34
|
end
|
34
35
|
records << @control
|
35
36
|
|
36
|
-
records_count = records.
|
37
|
-
sum + record.records_count
|
38
|
-
end
|
39
|
-
|
37
|
+
records_count = records.map(&:records_count).reduce(:+)
|
40
38
|
nines_needed = (10 - records_count) % 10
|
41
39
|
nines_needed = nines_needed % 10
|
42
40
|
nines_needed.times { records << Records::Nines.new() }
|
43
41
|
|
42
|
+
records_count = records.map(&:records_count).reduce(:+)
|
44
43
|
@control.batch_count = @batches.length
|
45
|
-
@control.block_count = (
|
44
|
+
@control.block_count = (records_count / 10).ceil
|
46
45
|
|
47
46
|
@control.entry_count = 0
|
48
47
|
@control.debit_total = 0
|
data/lib/ach/batch.rb
CHANGED
@@ -14,7 +14,7 @@ module ACH
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def to_ach
|
17
|
-
@control.entry_count = @entries.
|
17
|
+
@control.entry_count = @entries.map(&:records_count).reduce(:+).to_i
|
18
18
|
@control.debit_total = 0
|
19
19
|
@control.credit_total = 0
|
20
20
|
@control.entry_hash = 0
|
@@ -51,8 +51,18 @@ module ACH
|
|
51
51
|
@control.company_identification = @header.company_identification
|
52
52
|
@control.originating_dfi_identification = @header.originating_dfi_identification
|
53
53
|
@control.batch_number = @header.batch_number
|
54
|
+
if last_entry.is_a? ACH::BalancingEntryDetail
|
55
|
+
@control.credit_total = last_entry.amount
|
56
|
+
@control.debit_total = last_entry.amount
|
57
|
+
end
|
54
58
|
|
55
59
|
[@header] + @entries + @addendas + [@control]
|
56
60
|
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def last_entry
|
65
|
+
@last_entry ||= @entries.last
|
66
|
+
end
|
57
67
|
end
|
58
68
|
end
|
@@ -2,6 +2,12 @@ require 'holidays'
|
|
2
2
|
|
3
3
|
module ACH
|
4
4
|
class NextFederalReserveEffectiveDate
|
5
|
+
FEDERAL_RESERVE_SYMBOL =
|
6
|
+
if Gem.loaded_specs['holidays'].version < Gem::Version.new('7.0.0')
|
7
|
+
:federal_reserve
|
8
|
+
else
|
9
|
+
:federalreserve
|
10
|
+
end
|
5
11
|
def initialize(submission_date)
|
6
12
|
@submission_date = submission_date
|
7
13
|
end
|
@@ -30,7 +36,7 @@ module ACH
|
|
30
36
|
end
|
31
37
|
|
32
38
|
def holiday?(date)
|
33
|
-
Holidays.on(date,
|
39
|
+
Holidays.on(date, FEDERAL_RESERVE_SYMBOL, :observed).any?
|
34
40
|
end
|
35
41
|
|
36
42
|
def holiday_or_weekend?(date)
|
@@ -16,7 +16,7 @@ module ACH::Records
|
|
16
16
|
field :account_number, String, lambda { |f| left_justify(f, 17)}
|
17
17
|
field :amount, Integer, lambda { |f| sprintf('%010d', f)}
|
18
18
|
field :individual_id_number, String, lambda { |f| left_justify(f, 15)}
|
19
|
-
field :individual_name, String, lambda { |f| left_justify(f, 22)}
|
19
|
+
field :individual_name, String, lambda { |f| left_justify(f.gsub(/[\n\r]/, ''), 22)}
|
20
20
|
field :discretionary_data, String, lambda { |f| left_justify(f, 2)}, ' '
|
21
21
|
field :addenda_record_indicator, Integer,
|
22
22
|
lambda { |f| sprintf('%01d', f)}, 0
|
@@ -85,4 +85,14 @@ module ACH::Records
|
|
85
85
|
nil, nil, /\A\d{8}\z/
|
86
86
|
field :trace_number, Integer, lambda { |f| sprintf('%07d', f)}
|
87
87
|
end
|
88
|
+
|
89
|
+
class BalancingEntryDetail < EntryDetail
|
90
|
+
@fields = EntryDetail.fields.slice(0, 5)
|
91
|
+
const_field :individual_id_number, (' ' * 15)
|
92
|
+
field :account_description, String, lambda { |f| left_justify(f, 22)}
|
93
|
+
field :discretionary_data, String, lambda { |f| left_justify(f, 2)}, ' '
|
94
|
+
field :addenda_record_indicator, Integer, lambda { |f| sprintf('%01d', f)}, 0
|
95
|
+
field :origin_routing_number, String, lambda { |f| sprintf('%08d', f.to_i) }
|
96
|
+
field :trace_number, Integer, lambda { |f| sprintf('%07d', f)}
|
97
|
+
end
|
88
98
|
end
|
data/lib/ach/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ach
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Morgan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-11-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: appraisal
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 12.3.3
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 12.3.3
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rspec
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,20 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 1
|
77
|
-
- - "<"
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: 5.4.0
|
76
|
+
version: '3.1'
|
80
77
|
type: :runtime
|
81
78
|
prerelease: false
|
82
79
|
version_requirements: !ruby/object:Gem::Requirement
|
83
80
|
requirements:
|
84
81
|
- - ">="
|
85
82
|
- !ruby/object:Gem::Version
|
86
|
-
version: 1
|
87
|
-
- - "<"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 5.4.0
|
83
|
+
version: '3.1'
|
90
84
|
description: ach is a Ruby helper for building and parsing ACH files. In particular,
|
91
85
|
it helps with field order and alignment, and adds padding lines to end of file.
|
92
86
|
email: jmorgan@morgancreative.net
|
@@ -131,8 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
125
|
- !ruby/object:Gem::Version
|
132
126
|
version: '0'
|
133
127
|
requirements: []
|
134
|
-
|
135
|
-
rubygems_version: 2.5.2.3
|
128
|
+
rubygems_version: 3.0.3
|
136
129
|
signing_key:
|
137
130
|
specification_version: 4
|
138
131
|
summary: Helper for building ACH files
|