Class: AchClient::ICheckGateway::AchStatusChecker
- Inherits:
-
Abstract::AchStatusChecker
- Object
- Abstract::AchStatusChecker
- AchClient::ICheckGateway::AchStatusChecker
- 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" ]
Class Method Summary collapse
-
.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.
-
.in_range(start_date:, end_date:) ⇒ Hash{String => [AchClient::AchResponse]}
Wrapper for the range response endpoint confirmation number as the key, lists of AchResponse objects as values.
-
.most_recent ⇒ Object
ICheckGateway does not support this.
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.
29 30 31 32 33 34 35 |
# File 'lib/ach_client/providers/soap/i_check_gateway/ach_status_checker.rb', line 29 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:) ⇒ Hash{String => [AchClient::AchResponse]}
Wrapper for the range response endpoint confirmation number as the key, lists of AchResponse objects as values
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ach_client/providers/soap/i_check_gateway/ach_status_checker.rb', line 40 def self.in_range(start_date:, end_date:) Helpers::Utils.hashlist_merge( AchClient::ICheckGateway.wrap_request( method: :pull_transaction_report, message: AchClient::ICheckGateway::CompanyInfo.build.to_hash.merge({ startDate: start_date, endDate: end_date }) ).split("\n").select do |record| check_for_errors(record) # Ignore credit card swipes if there are any record.start_with?('ICHECK') end.map do |record| { record.split('|')[3] => [ AchClient::ICheckGateway::ResponseRecordProcessor .process_response_record(record) ] } end ) end |
.most_recent ⇒ Object
ICheckGateway does not support this
19 20 21 22 |
# File 'lib/ach_client/providers/soap/i_check_gateway/ach_status_checker.rb', line 19 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 |