Class: AchClient::AchWorks::CorrectionDetailsProcessor
- Inherits:
-
Object
- Object
- AchClient::AchWorks::CorrectionDetailsProcessor
- Defined in:
- lib/ach_client/providers/soap/ach_works/correction_details_processor.rb
Overview
Turns the gibberish string that AchWorks gives us for correction returns when possible into meaningful data
Class Method Summary collapse
-
.decipher_C03(gibberish) ⇒ Object
CO3: The routing number and the account number were wrong.
-
.decipher_C06(gibberish) ⇒ Object
Discrepency between AchWorks and standard correction codes: AchWorks: The account number and transaction code were wrong.
-
.decipher_C07(gibberish) ⇒ Object
C07: The account number, routing number, and account type were all incorrect.
-
.decipher_correction_details(gibberish) ⇒ Hash
Turns the gibberish string that AchWorks gives us for correction returns when possible into meaningful data.
-
.decipher_unknown(gibberish) ⇒ Object
The rest of the cases are undocumented.
-
.method_missing(method, *args, &block) ⇒ Object
If it looks like we tried to call a function for an unknown correction code, then return the unhanlded correction data hash.
Class Method Details
.decipher_C03(gibberish) ⇒ Object
CO3: The routing number and the account number were wrong.
34 35 36 37 38 39 |
# File 'lib/ach_client/providers/soap/ach_works/correction_details_processor.rb', line 34 def self.decipher_C03(gibberish) { routing_number: gibberish[3..11], account_number: gibberish[15..31] } end |
.decipher_C06(gibberish) ⇒ Object
Discrepency between AchWorks and standard correction codes: AchWorks: The account number and transaction code were wrong. Everyone else: The account number and account type (checking/saving)
were wrong.
However, AchWorks indicates that the “transaction code” is only 1
character long within their gibberish string. Their transaction
codes are usually 3 characters, while their account types are one
character. So I will assume that "transaction code" means
"account type".
C06: The account number and account type were wrong
51 52 53 54 55 56 57 58 59 |
# File 'lib/ach_client/providers/soap/ach_works/correction_details_processor.rb', line 51 def self.decipher_C06(gibberish) { account_number: gibberish[3..19], account_type: AchClient::AchWorks::AccountTypeTransformer.deserialize_provider_value( gibberish[23] ) } end |
.decipher_C07(gibberish) ⇒ Object
C07: The account number, routing number, and account type were all
incorrect. You really messed this one up.
Same issue as above with Transaction Code => Account Type At least they were consistently discrepent.
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/ach_client/providers/soap/ach_works/correction_details_processor.rb', line 65 def self.decipher_C07(gibberish) { routing_number: gibberish[3..11], account_number: gibberish[12..28], account_type: AchClient::AchWorks::AccountTypeTransformer.deserialize_provider_value( gibberish[29] ) } end |
.decipher_correction_details(gibberish) ⇒ Hash
Turns the gibberish string that AchWorks gives us for correction returns when possible into meaningful data
12 13 14 15 16 17 18 |
# File 'lib/ach_client/providers/soap/ach_works/correction_details_processor.rb', line 12 def self.decipher_correction_details(gibberish) # The correction code is the first 3 chars of the gibberish. # The meaning of the rest of the giberish depends on the correction # code. These meanings are sometimes enumerated in the AchWorks # documentation. self.send(('decipher_' + gibberish[0..2]).to_sym, gibberish) end |
.decipher_unknown(gibberish) ⇒ Object
The rest of the cases are undocumented. We will expose the raw data
given to us, along with a nice note that explains the situation
while shaming AchWorks.
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/ach_client/providers/soap/ach_works/correction_details_processor.rb', line 79 def self.decipher_unknown(gibberish) { unhandled_correction_data: gibberish[3..-1], note: 'AchWorks failed to document this correction code, so we ' + 'can\'t tell you what this data means. You might be able to find ' + 'out by contacting them. Alternatively, you could check the ' + 'AchWorks web console, and match your records against theirs to ' + 'see what changed. Enjoy! Let us know what you find, and maybe we' + ' can handle this case in the future.' } end |
.method_missing(method, *args, &block) ⇒ Object
If it looks like we tried to call a function for an unknown correction code, then return the unhanlded correction data hash
23 24 25 26 27 28 29 30 31 |
# File 'lib/ach_client/providers/soap/ach_works/correction_details_processor.rb', line 23 def self.method_missing(method, *args, &block) if method.to_s.start_with?('decipher_') if (gibberish = args[0]) && gibberish.is_a?(String) self.decipher_unknown(gibberish) end else super end end |