Class: AchClient::ReturnCode
- Inherits:
-
Object
- Object
- AchClient::ReturnCode
- Defined in:
- lib/ach_client/objects/return_code.rb
Overview
Represents an Ach Return code. Consult NACHA documentation for a full list See config/return_codes.yml for our list.
Constant Summary collapse
- CORRECTION_START_CHARACTER =
The first character in a correction code
'C'
- INTERNAL_START_CHARACTER =
The first character in an internal return code
'X'
- INTERNAL_CORRECTION_STRING =
Returns that are both internal and corrections start with this string
'XZ'
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#description ⇒ Object
Returns the value of attribute description.
-
#reason ⇒ Object
Returns the value of attribute reason.
Instance Method Summary collapse
-
#correction? ⇒ Boolean
Whether or not this return is a correction/notice of change.
-
#initialize(code:, description:, reason: nil) ⇒ ReturnCode
constructor
Constructs a Ach return code.
-
#internal? ⇒ Boolean
An “internal” return means that the ACH provider knew that the ACH would fail and didn't bother to send it to their upstream provider.
Constructor Details
#initialize(code:, description:, reason: nil) ⇒ ReturnCode
Constructs a Ach return code
23 24 25 26 27 |
# File 'lib/ach_client/objects/return_code.rb', line 23 def initialize(code:, description:, reason: nil) @code = code @description = description @reason = reason end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
15 16 17 |
# File 'lib/ach_client/objects/return_code.rb', line 15 def code @code end |
#description ⇒ Object
Returns the value of attribute description.
15 16 17 |
# File 'lib/ach_client/objects/return_code.rb', line 15 def description @description end |
#reason ⇒ Object
Returns the value of attribute reason.
15 16 17 |
# File 'lib/ach_client/objects/return_code.rb', line 15 def reason @reason end |
Instance Method Details
#correction? ⇒ Boolean
Returns Whether or not this return is a correction/notice of change.
30 31 32 |
# File 'lib/ach_client/objects/return_code.rb', line 30 def correction? @code.start_with?(CORRECTION_START_CHARACTER) || @code.start_with?(INTERNAL_CORRECTION_STRING) end |
#internal? ⇒ Boolean
An “internal” return means that the ACH provider knew that the ACH
would fail and didn't bother to send it to their upstream provider
37 38 39 |
# File 'lib/ach_client/objects/return_code.rb', line 37 def internal? @code.start_with?(INTERNAL_START_CHARACTER) end |