Class: AchClient::ICheckGateway::AchStatusChecker

Inherits:
Abstract::AchStatusChecker show all
Defined in:
lib/ach_client/providers/soap/i_check_gateway/ach_status_checker.rb

Overview

Poll ICheckGateway for status of processed or processing Ach transactions.

Constant Summary collapse

KNOWN_ERROR_STRINGS =

These responses aren’t documented anywhere, so we have to add them as

they are discovered
[
  # ICheckGateway has a rate limit of 20 requests per calendar day
  "ACCESS DENIED: Report Call Limit Exceeded",
  # The date range can't be wider than 15 days
  "ACCESS DENIED: Date Range Exceeds 15 Days",
  # Because so far they all contain ACCESS_DENIED:
  "ACCESS DENIED"
]
EMPTY_RETURNS_RESPONSE =
'NO RETURNS REPORTED'.freeze

Class Method Summary collapse

Class Method Details

.check_for_errors(record) ⇒ Object

If there are any strings we know are errors in the response, raise an

error

Unfortunately the API doesn’t really use HTTP status codes, so we have

to resort to this string/pattern matching to find out if something
went wrong.


31
32
33
34
35
36
37
# File 'lib/ach_client/providers/soap/i_check_gateway/ach_status_checker.rb', line 31

def self.check_for_errors(record)
  KNOWN_ERROR_STRINGS.each do |error_string|
    if record.include?(error_string)
      raise "Couldnt process ICheckGateway Response: #{record}"
    end
  end
end

.in_range(start_date:, end_date:) ⇒ Object

confirmation number as the key, lists of AchResponse objects as values



41
42
43
44
45
46
# File 'lib/ach_client/providers/soap/i_check_gateway/ach_status_checker.rb', line 41

def self.in_range(start_date:, end_date:)
  Helpers::Utils.hashlist_merge(
    check_for_late_returns(start_date: start_date, end_date: end_date) +
      pull_transaction_report(start_date: start_date, end_date: end_date)
  )
end

.most_recentObject

ICheckGateway does not support this



21
22
23
24
# File 'lib/ach_client/providers/soap/i_check_gateway/ach_status_checker.rb', line 21

def self.most_recent
  # In the future, this might just return the last 24 hours or something
  raise 'ICheckGateway does not have a most_recent bucket'
end