ach_client 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e99eb77a0a779d02b0da3013a14f078d6b15dc9
4
- data.tar.gz: e4e39ed8598a66b952e02f219ebc99914fe681e7
3
+ metadata.gz: 26f14e345c784fd2a558e5b6ee679341732a96cb
4
+ data.tar.gz: f8c85acfa9ac9135bcc6f5d7d6f1cf92c84d01e0
5
5
  SHA512:
6
- metadata.gz: 5b7cf5a41f59d15eaa8741454ed7da06a42780dc216cafd66b689b7d758dd0927514d0445b65cb7fbabc28ac8ac9850ecfab0dc3176a4976830928a401e8447c
7
- data.tar.gz: c998fced93c712373c0523c575d44d97c3f1daa1f1fb1a927cc8f7f2b2d8c8c32a150ff41a98d7f0ac0b035fe47273ba3a390bb3f8c2048345679547e9ae8d80
6
+ metadata.gz: 87476c5fb0d58e70c3e1743d9208d28e472093c1d618958f981ed3126c08fff3eb44f514e16a490e68e3edc6be972ab5b98597f895eb363e94458b13a664180e
7
+ data.tar.gz: 0c23bcb7667c90adb97736fdc7fbd7f780707bf16a41b2cb240faef2517b054d6ad8f4554c6d74b25a67c221538d6806cfc7599abbf6a199c8aaacdb61ad3640
@@ -2,6 +2,14 @@ module AchClient
2
2
  class ICheckGateway
3
3
  # Poll ICheckGateway for status of processed or processing Ach transactions.
4
4
  class AchStatusChecker < Abstract::AchStatusChecker
5
+
6
+ # These responses aren't documented anywhere, so we have to add them as
7
+ # they are discovered
8
+ KNOWN_ERROR_STRINGS = [
9
+ # ICheckGateway has a rate limit of 20 requests per calendar day
10
+ "ACCESS DENIED: Report Call Limit Exceeded"
11
+ ]
12
+
5
13
  ##
6
14
  # ICheckGateway does not support this
7
15
  def self.most_recent
@@ -9,6 +17,19 @@ module AchClient
9
17
  raise 'ICheckGateway does not have a most_recent bucket'
10
18
  end
11
19
 
20
+ # If there are any strings we know are errors in the response, raise an
21
+ # error
22
+ # Unfortunately the API doesn't really use HTTP status codes, so we have
23
+ # to resort to this string/pattern matching to find out if something
24
+ # went wrong.
25
+ def self.check_for_errors(record)
26
+ KNOWN_ERROR_STRINGS.each do |error_string|
27
+ if record.include?(error_string)
28
+ raise "Couldnt process ICheckGateway Response: #{error_string}"
29
+ end
30
+ end
31
+ end
32
+
12
33
  # Wrapper for the range response endpoint
13
34
  # @return [Hash{String => AchClient::AchResponse}] Hash with confirmation
14
35
  # number as the key, AchResponse objects as values
@@ -20,6 +41,7 @@ module AchClient
20
41
  endDate: end_date
21
42
  })
22
43
  ).split("\n").select do |record|
44
+ check_for_errors(record)
23
45
  # Ignore credit card swipes if there are any
24
46
  record.start_with?('ICHECK')
25
47
  end.map do |record|
@@ -1,4 +1,4 @@
1
1
  module AchClient
2
2
  # Increment this when changes are published
3
- VERSION = '0.6.4'
3
+ VERSION = '0.6.5'
4
4
  end
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.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Cotter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-13 00:00:00.000000000 Z
11
+ date: 2017-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ach