Exception: AchClient::ICheckGateway::InstantRejectionError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/ach_client/providers/soap/i_check_gateway/instant_rejection_error.rb

Overview

ICheckGateway sometimes returns an API error when a valid ACH transaction is sent in a handful of

rejection scenarios. This is unusual because most providers will accept the transaction, return an
external_ach_id, and then supply the rejection info when you poll for responses at a later date.

So far we have observed this happening in the following scenarios:

- When an invalid routing number is supplied (X13 - Invalid ACH Routing Number - Entry contains a Receiving DFI
    Identification or Gateway Identification that is not a valid ACH routing number.)
- When there is a Notice of Change for the  number (C01 - ACH Change Code. Incorrect  Number)
- When there is a Notice of Change for the routing number (C02 - ACH Change Code. Incorrect Transit Route)

This exception can be caught to handle the API error in the appropriate manner. The NACHA return code inferred from the error message is retrievable from the exception instance as well as any

addendum information provided by the API error (ie the correct new /routing number)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, nacha_return_code:, addendum: nil, transaction:) ⇒ InstantRejectionError

Returns a new instance of InstantRejectionError.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ach_client/providers/soap/i_check_gateway/instant_rejection_error.rb', line 17

def initialize(message = nil, nacha_return_code:, addendum: nil, transaction:)
  super(message)
  return_code = ReturnCodes.find_by(code: nacha_return_code)
  response_args = {
    amount: transaction.amount,
    date: transaction.,
    return_code: return_code,
  }
  @ach_response = if return_code.correction?
    CorrectedAchResponse.new(**response_args, corrections: addendum)
  else
    ReturnedAchResponse.new(**response_args)
  end
end

Instance Attribute Details

#ach_responseObject (readonly)

Returns the value of attribute ach_response.



15
16
17
# File 'lib/ach_client/providers/soap/i_check_gateway/instant_rejection_error.rb', line 15

def ach_response
  @ach_response
end