ach_client 0.7.0 → 1.0.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.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/.tool-versions +1 -1
- data/.tool-versions-e +1 -0
- data/README.md +3 -1
- data/lib/ach_client/helpers/utils.rb +17 -0
- data/lib/ach_client/providers/abstract/ach_status_checker.rb +4 -4
- data/lib/ach_client/providers/sftp/ach_status_checker.rb +16 -12
- data/lib/ach_client/providers/soap/ach_works/ach_status_checker.rb +19 -15
- data/lib/ach_client/providers/soap/i_check_gateway/ach_status_checker.rb +23 -19
- data/lib/ach_client/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1592b86e14d743c487591e1a205a85ac072cf23a43e27a8dc8e6a7d8dd860acc
|
4
|
+
data.tar.gz: e4ad0a3ae01d345b4dbd8e224fd4d336737d297d82669af08a58d1b858c04dfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a6cbf086b1b6424fcdd034a4131403c00d5e04bf74a01a86176b6c9ff0d24cc8e40020005b3bb06c194b9dd890999c08d82d2c79cd271e510d73cfe9975f910
|
7
|
+
data.tar.gz: 7130cdd271cecff3efd4297284ccca59d36985eca2868b1df9c3dc2ce1eed6d986b1b633127e025b8bea175387be9a25d5b4eaa1f925be27f847e5c6ff90bf96
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.0
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 2.
|
1
|
+
ruby 2.5.0
|
data/.tool-versions-e
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.5.0
|
data/README.md
CHANGED
@@ -163,7 +163,9 @@ To check statuses:
|
|
163
163
|
```
|
164
164
|
|
165
165
|
Both of these methods return a `Hash` with the `external_ach_id` for ach_transaction as the keys and
|
166
|
-
instances of AchClient::AchResponse as values.
|
166
|
+
a list of instances of AchClient::AchResponse as values. A polling response may contain
|
167
|
+
more than one response record for each `external_ach_id` if that ACH has changed
|
168
|
+
statuses more than once within the polling range.
|
167
169
|
|
168
170
|
### Responses
|
169
171
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module AchClient
|
2
|
+
class Helpers
|
3
|
+
class Utils
|
4
|
+
# Given a list of hashes where the hashes values are lists, merge the
|
5
|
+
# list of hashes by appending the two lists when there is a key
|
6
|
+
# collision
|
7
|
+
# @param hashlist [Array(Hash{String => Array})]
|
8
|
+
def self.hashlist_merge(hashlist)
|
9
|
+
hashlist.reduce do |map, record|
|
10
|
+
map.merge(record) do |_key, left_value, right_value|
|
11
|
+
left_value + right_value
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -4,15 +4,15 @@ module AchClient
|
|
4
4
|
# Interface for polling provider for ACH status responses
|
5
5
|
class AchStatusChecker
|
6
6
|
# Wrapper for a provider's "most recent bucket"
|
7
|
-
# @return [Hash{String => AchClient::AchResponse}] Hash with provider's
|
8
|
-
# external ACH id as the key, AchResponse objects as values
|
7
|
+
# @return [Hash{String => [AchClient::AchResponse]}] Hash with provider's
|
8
|
+
# external ACH id as the key, list of AchResponse objects as values
|
9
9
|
def self.most_recent
|
10
10
|
raise AbstractMethodError
|
11
11
|
end
|
12
12
|
|
13
13
|
# Wrapper for a providers range response endpoint
|
14
|
-
# @return [Hash{String => AchClient::AchResponse}] Hash with provider's
|
15
|
-
# external ACH id as the key, AchResponse objects as values
|
14
|
+
# @return [Hash{String => [AchClient::AchResponse]}] Hash with provider's
|
15
|
+
# external ACH id as the key, list of AchResponse objects as values
|
16
16
|
def self.in_range(*)
|
17
17
|
raise AbstractMethodError
|
18
18
|
end
|
@@ -6,8 +6,9 @@ module AchClient
|
|
6
6
|
##
|
7
7
|
# Gets the status of ach transactions since the last time we ran this
|
8
8
|
# method
|
9
|
-
# @return [Hash{String => AchClient::AchResponse}] Hash with
|
10
|
-
# individual_id_number values as keys, AchResponse objects
|
9
|
+
# @return [Hash{String => [AchClient::AchResponse]}] Hash with
|
10
|
+
# individual_id_number values as keys, list of AchResponse objects
|
11
|
+
# as values
|
11
12
|
def self.most_recent
|
12
13
|
process_files(most_recent_files)
|
13
14
|
end
|
@@ -16,8 +17,9 @@ module AchClient
|
|
16
17
|
# Gets the status of ach transactions between the given dates
|
17
18
|
# @param start_date [String] lower bound of date ranged status query
|
18
19
|
# @param end_date [String] upper bound of date ranged status query
|
19
|
-
# @return [Hash{String => AchClient::AchResponse}] Hash with
|
20
|
-
# individual_id_number values as keys, AchResponse objects as
|
20
|
+
# @return [Hash{String => [AchClient::AchResponse]}] Hash with
|
21
|
+
# individual_id_number values as keys, list of AchResponse objects as
|
22
|
+
# values
|
21
23
|
def self.in_range(start_date:, end_date:)
|
22
24
|
in_range = {}
|
23
25
|
self.parent.with_sftp_connection do |connection|
|
@@ -33,14 +35,16 @@ module AchClient
|
|
33
35
|
end
|
34
36
|
|
35
37
|
private_class_method def self.process_files(files)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
Helpers::Utils.hashlist_merge(
|
39
|
+
(files || []).reduce([]) do |acc, entry|
|
40
|
+
ACH::ACHFile.new(entry.last).batches.map do |batch|
|
41
|
+
batch.entries.map do |ach|
|
42
|
+
# return trace ==> response
|
43
|
+
{ ach.individual_id_number => [process_ach(batch, ach)] }
|
44
|
+
end
|
45
|
+
end.reduce([], &:+) + acc
|
46
|
+
end
|
47
|
+
)
|
44
48
|
end
|
45
49
|
|
46
50
|
private_class_method def self.process_ach(batch, ach)
|
@@ -49,21 +49,25 @@ module AchClient
|
|
49
49
|
if response[:total_num_records] == '0'
|
50
50
|
[]
|
51
51
|
else
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
52
|
+
Helpers::Utils.hashlist_merge(
|
53
|
+
response[:ach_return_records][:ach_return_record].select do |record|
|
54
|
+
# Exclude records with no front end trace
|
55
|
+
# They are probably 9BNK response codes, not actual transactions
|
56
|
+
# 9BNK is when AchWorks gives us an aggregate record, containing
|
57
|
+
# the total debit/credit to your actual bank account.
|
58
|
+
# We don't care about those here.
|
59
|
+
record[:front_end_trace].present?
|
60
|
+
end.map do |record|
|
61
|
+
{
|
62
|
+
# Strips the first characther because it is always the added Z
|
63
|
+
record[:front_end_trace][1..-1] =>
|
64
|
+
[
|
65
|
+
AchClient::AchWorks::ResponseRecordProcessor
|
66
|
+
.process_response_record(record)
|
67
|
+
]
|
68
|
+
}
|
69
|
+
end
|
70
|
+
)
|
67
71
|
end
|
68
72
|
end
|
69
73
|
|
@@ -35,26 +35,30 @@ module AchClient
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# Wrapper for the range response endpoint
|
38
|
-
# @return [Hash{String => AchClient::AchResponse}] Hash with
|
39
|
-
# number as the key, AchResponse objects as values
|
38
|
+
# @return [Hash{String => [AchClient::AchResponse]}] Hash with
|
39
|
+
# confirmation number as the key, lists of AchResponse objects as values
|
40
40
|
def self.in_range(start_date:, end_date:)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
41
|
+
Helpers::Utils.hashlist_merge(
|
42
|
+
AchClient::ICheckGateway.wrap_request(
|
43
|
+
method: :pull_transaction_report,
|
44
|
+
message: AchClient::ICheckGateway::CompanyInfo.build.to_hash.merge({
|
45
|
+
startDate: start_date,
|
46
|
+
endDate: end_date
|
47
|
+
})
|
48
|
+
).split("\n").select do |record|
|
49
|
+
check_for_errors(record)
|
50
|
+
# Ignore credit card swipes if there are any
|
51
|
+
record.start_with?('ICHECK')
|
52
|
+
end.map do |record|
|
53
|
+
{
|
54
|
+
record.split('|')[3] =>
|
55
|
+
[
|
56
|
+
AchClient::ICheckGateway::ResponseRecordProcessor
|
57
|
+
.process_response_record(record)
|
58
|
+
]
|
59
|
+
}
|
60
|
+
end
|
61
|
+
)
|
58
62
|
end
|
59
63
|
end
|
60
64
|
end
|
data/lib/ach_client/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ach_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Cotter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ach
|
@@ -274,6 +274,7 @@ files:
|
|
274
274
|
- ".rubocop.yml"
|
275
275
|
- ".ruby-version"
|
276
276
|
- ".tool-versions"
|
277
|
+
- ".tool-versions-e"
|
277
278
|
- ".travis.yml"
|
278
279
|
- Gemfile
|
279
280
|
- README.md
|
@@ -286,6 +287,7 @@ files:
|
|
286
287
|
- lib/ach_client/abstract/abstract_method_error.rb
|
287
288
|
- lib/ach_client/abstract/invalid_ach_transaction_error.rb
|
288
289
|
- lib/ach_client/helpers/dollars_to_cents.rb
|
290
|
+
- lib/ach_client/helpers/utils.rb
|
289
291
|
- lib/ach_client/logging/log_provider_job.rb
|
290
292
|
- lib/ach_client/logging/log_providers/log_provider.rb
|
291
293
|
- lib/ach_client/logging/log_providers/null_log_provider.rb
|
@@ -355,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
355
357
|
version: '0'
|
356
358
|
requirements: []
|
357
359
|
rubyforge_project:
|
358
|
-
rubygems_version: 2.
|
360
|
+
rubygems_version: 2.7.3
|
359
361
|
signing_key:
|
360
362
|
specification_version: 4
|
361
363
|
summary: Adapter to interact with various ACH service providers
|