Class: AchClient::AchWorks::ResponseRecordProcessor
- Inherits:
-
AchClient::Abstract::ResponseRecordProcessor
- Object
- AchClient::Abstract::ResponseRecordProcessor
- AchClient::AchWorks::ResponseRecordProcessor
- Defined in:
- lib/ach_client/providers/soap/ach_works/response_record_processor.rb
Overview
Processes individual response records from AchWorks
Class Method Summary collapse
-
.method_missing(method, *args, &block) ⇒ Object
If it looks like we tried to call a function for an unknown response code, then raise an exception so we know what kind of crazy response codes they are sending us.
-
.process_1SNT(record) ⇒ AchClient::ProcessingAchResponse
1SNT: The transaction has been sent, but not yet processed.
-
.process_2STL(record) ⇒ AchClient::SettledAchResponse
2STL: The transaction is settled.
-
.process_3RET(record) ⇒ AchClient::ReturnedAchResponse
3RET: The transaction was returned for some reason (insufficient funds, invalid account, etc).
-
.process_4INT(record) ⇒ AchClient::ReturnedAchResponse
4INT: AchWorks already knows the transaction would result in a return, so they didn’t bother sending it to the bank.
-
.process_5COR(record) ⇒ AchClient::CorrectedAchResponse
5COR: Corrected account details (new account number, bank buys another bank, etc).
-
.process_response_record(record) ⇒ AchClient::AchResponse
Find the response code in the response record and delegate to the appropriate handler method.
Class Method Details
.method_missing(method, *args, &block) ⇒ Object
If it looks like we tried to call a function for an unknown response code, then raise an exception so we know what kind of crazy response codes they are sending us
18 19 20 21 22 23 24 25 26 |
# File 'lib/ach_client/providers/soap/ach_works/response_record_processor.rb', line 18 def self.method_missing(method, *args, &block) if method.to_s.start_with?('process_') if (record = args[0]) && record.is_a?(Hash) raise "Unknown response code #{record[:response_code]}" end else super end end |
.process_1SNT(record) ⇒ AchClient::ProcessingAchResponse
1SNT: The transaction has been sent, but not yet processed
31 32 33 34 35 36 |
# File 'lib/ach_client/providers/soap/ach_works/response_record_processor.rb', line 31 def self.process_1SNT(record) AchClient::ProcessingAchResponse.new( amount: BigDecimal(record[:trans_amount]), date: record[:action_date] ) end |
.process_2STL(record) ⇒ AchClient::SettledAchResponse
2STL: The transaction is settled. Huzzah!
41 42 43 44 45 46 |
# File 'lib/ach_client/providers/soap/ach_works/response_record_processor.rb', line 41 def self.process_2STL(record) AchClient::SettledAchResponse.new( amount: BigDecimal(record[:trans_amount]), date: record[:action_date] ) end |
.process_3RET(record) ⇒ AchClient::ReturnedAchResponse
3RET: The transaction was returned for some reason (insufficient
funds, invalid account, etc)
52 53 54 55 56 57 58 59 60 |
# File 'lib/ach_client/providers/soap/ach_works/response_record_processor.rb', line 52 def self.process_3RET(record) AchClient::ReturnedAchResponse.new( amount: BigDecimal(record[:trans_amount]), date: record[:action_date], return_code: AchClient::ReturnCodes.find_by( code: record[:action_detail][0..2] ) ) end |
.process_4INT(record) ⇒ AchClient::ReturnedAchResponse
4INT: AchWorks already knows the transaction would result in a
return, so they didn't bother sending it to the bank.
66 67 68 |
# File 'lib/ach_client/providers/soap/ach_works/response_record_processor.rb', line 66 def self.process_4INT(record) self.process_3RET(record) end |
.process_5COR(record) ⇒ AchClient::CorrectedAchResponse
5COR: Corrected account details (new account number, bank buys
another bank, etc). You are responsible for updating your records,
and making the request with the new info, lest AchWorks will be
most displeased.
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/ach_client/providers/soap/ach_works/response_record_processor.rb', line 76 def self.process_5COR(record) AchClient::CorrectedAchResponse.new( amount: BigDecimal(record[:trans_amount]), date: record[:action_date], return_code: AchClient::ReturnCodes.find_by( code: record[:action_detail][0..2] ), corrections: AchClient::AchWorks::CorrectionDetailsProcessor .decipher_correction_details(record[:action_detail]) ) end |
.process_response_record(record) ⇒ AchClient::AchResponse
Find the response code in the response record and delegate to the appropriate handler method
10 11 12 |
# File 'lib/ach_client/providers/soap/ach_works/response_record_processor.rb', line 10 def self.process_response_record(record) self.send(('process_' + record[:response_code]).to_sym, record) end |