ach 0.6.0 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -5
- data/lib/ach/ach_file.rb +16 -2
- data/lib/ach/string_formatting_helper.rb +9 -3
- data/lib/ach/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65fd0878533e4206c6c2566280f155579cc008b152e4bf86257ae9baebc7baf1
|
4
|
+
data.tar.gz: 8f211cfc213df900371276dd7eb02f1e6b545cab03228049f89e92fb1c6cc9d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80718cd30ce3987ee85e21f48d8620189c236cb01cebe84dcc33ef01bcdcd38473358e1b3ca662fbf8a2a1475150acd747c33f141ffba392c2c366941d5ea938
|
7
|
+
data.tar.gz: 1c6c4ce7b58723471288f1b89838309bfbfba61cb7d58012d92e4aaf83965b63e2fa9de7a2f25c7c0a3e20648e5c7bbd303a99cd45d07c858d7764adc37109a3
|
data/README.md
CHANGED
@@ -1,18 +1,20 @@
|
|
1
|
-
#ACH
|
1
|
+
# ACH
|
2
|
+
|
3
|
+
Note: I'm no longer actively maintaining this gem, and would be happy to turn it over to someone else. Let me know if you'd like to take over.
|
2
4
|
|
3
5
|
[![Build Status](https://travis-ci.org/jm81/ach.svg?branch=master)](https://travis-ci.org/jm81/ach)
|
4
6
|
|
5
7
|
ach is a Ruby helper for builder ACH files. In particular, it helps with field
|
6
8
|
order and alignment, and adds padding lines to end of file.
|
7
9
|
|
8
|
-
**This library has only been used in
|
10
|
+
**This library has only been used in two production applications and for very
|
9
11
|
limited purposes. Please test thoroughly before using in a production
|
10
12
|
environment.**
|
11
13
|
|
12
14
|
See [ACH::Builder](http://search.cpan.org/~tkeefer/ACH-Builder-0.03/lib/ACH/Builder.pm)
|
13
15
|
for a similar Perl library
|
14
16
|
|
15
|
-
##Example
|
17
|
+
## Example
|
16
18
|
|
17
19
|
You should consult a copy of the [ACH Rules](http://www.nacha.org) for details
|
18
20
|
on individual fields. You can probably obtain a copy from your bank.
|
@@ -30,6 +32,11 @@ fh.immediate_destination = '000000000'
|
|
30
32
|
fh.immediate_destination_name = 'BANK NAME'
|
31
33
|
fh.immediate_origin = '000000000'
|
32
34
|
fh.immediate_origin_name = 'BANK NAME'
|
35
|
+
# Optional - This value is used in the File Creation Date/Time attributes - if excluded will default to Time.now
|
36
|
+
# Note that you may wish to modify the time zone here if your environment has a different time zone than the banks
|
37
|
+
# For example if your server is in UTC and the bank's is in US/Eastern, any files sent after 8pm Eastern/Midnight UTC
|
38
|
+
# would have a File Creation Date of the next day from the bank's perspective
|
39
|
+
fh.transmission_datetime = Time.now
|
33
40
|
|
34
41
|
# Batch
|
35
42
|
batch = ACH::Batch.new
|
@@ -38,7 +45,7 @@ bh.company_name = 'Company Name'
|
|
38
45
|
bh.company_identification = '123456789' # Use 10 characters if you're not using an EIN
|
39
46
|
bh.standard_entry_class_code = 'PPD'
|
40
47
|
bh.company_entry_description = 'DESCRIPTION'
|
41
|
-
bh.company_descriptive_date = Date.today
|
48
|
+
bh.company_descriptive_date = Date.today # Or string with 'SDHHMM' for same day ACH
|
42
49
|
bh.effective_entry_date = ACH::NextFederalReserveEffectiveDate.new(Date.today).result
|
43
50
|
bh.originating_dfi_identification = '00000000'
|
44
51
|
ach.batches << batch
|
@@ -73,6 +80,6 @@ ach.batches.first.entries.first.addenda.first.payment_data
|
|
73
80
|
|
74
81
|
**Note:** When adding an amount to your ach file, it needs to be in cents. So you'll want to multiply any dollar amounts by 100
|
75
82
|
|
76
|
-
##Copyright
|
83
|
+
## Copyright
|
77
84
|
|
78
85
|
Copyright (c) 2008-2009 Jared E Morgan, released under the MIT license
|
data/lib/ach/ach_file.rb
CHANGED
@@ -79,7 +79,7 @@ module ACH
|
|
79
79
|
|
80
80
|
def parse_fixed data
|
81
81
|
# replace with a space to preserve the record-lengths
|
82
|
-
encoded_data = data.encode(Encoding.find('ASCII'),{:invalid => :replace, :undef => :replace, :replace => ' '})
|
82
|
+
encoded_data = data.encode(Encoding.find('ASCII'), **{:invalid => :replace, :undef => :replace, :replace => ' '})
|
83
83
|
parse encoded_data.scan(/.{94}/).join("\n")
|
84
84
|
end
|
85
85
|
|
@@ -114,7 +114,7 @@ module ACH
|
|
114
114
|
bh.full_company_identification = line[40..49]
|
115
115
|
bh.standard_entry_class_code = line[50..52].strip
|
116
116
|
bh.company_entry_description = line[53..62].strip
|
117
|
-
bh.company_descriptive_date =
|
117
|
+
bh.company_descriptive_date = parse_descriptive_date(line[63..68].strip)
|
118
118
|
bh.effective_entry_date = Date.parse(line[69..74])
|
119
119
|
bh.originating_dfi_identification = line[79..86].strip
|
120
120
|
when '6'
|
@@ -156,5 +156,19 @@ module ACH
|
|
156
156
|
self.batches << batch unless batch.nil?
|
157
157
|
to_s
|
158
158
|
end
|
159
|
+
|
160
|
+
def parse_descriptive_date(date_string)
|
161
|
+
return if date_string.empty?
|
162
|
+
|
163
|
+
date_time = date_string.match(/^SD(\d{2})(\d{2})$/) do
|
164
|
+
same_day_hour, same_day_minute = _1.captures.map(&:to_f)
|
165
|
+
|
166
|
+
Date.today.to_datetime + (same_day_hour + same_day_minute/60) / 24
|
167
|
+
end
|
168
|
+
|
169
|
+
date_time || ACH::Data.parse(date_string)
|
170
|
+
rescue
|
171
|
+
date_string
|
172
|
+
end
|
159
173
|
end
|
160
174
|
end
|
@@ -1,9 +1,15 @@
|
|
1
1
|
module ACH
|
2
2
|
module StringFormattingHelper
|
3
|
-
# Passing in SD to the date signifies same-day to banks. This is used for
|
3
|
+
# Passing in SD to the date signifies same-day to banks. This is used for
|
4
|
+
# the company_descriptive_date
|
4
5
|
def self.stringify_with_same_day(f)
|
5
6
|
return f.upcase if f.to_s.upcase.match(/^SD\d+$/)
|
6
|
-
|
7
|
+
|
8
|
+
if f.respond_to?(:strftime)
|
9
|
+
f = f.strftime('%y%m%d')
|
10
|
+
end
|
11
|
+
|
12
|
+
f[0..5].rjust(6)
|
7
13
|
end
|
8
14
|
end
|
9
|
-
end
|
15
|
+
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.6.
|
4
|
+
version: 0.6.3
|
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: 2023-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: appraisal
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.3.25
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: Helper for building ACH files
|