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.
-
#risk_and_enforcement_category ⇒ Object
Returns the value of attribute risk_and_enforcement_category.
Instance Method Summary collapse
- #administrative_return? ⇒ Boolean
-
#correction? ⇒ Boolean
Whether or not this return is a correction/notice of change.
-
#initialize(code:, description:, reason: nil, risk_and_enforcement_category: 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.
- #unauthorized_return? ⇒ Boolean
Constructor Details
#initialize(code:, description:, reason: nil, risk_and_enforcement_category: nil) ⇒ ReturnCode
Constructs a Ach return code
24 25 26 27 28 29 30 |
# File 'lib/ach_client/objects/return_code.rb', line 24 def initialize(code:, description:, reason: nil, risk_and_enforcement_category: nil) @code = code @description = description @reason = reason # See https://www.nacha.org/rules/ach-network-risk-and-enforcement-topics @risk_and_enforcement_category = risk_and_enforcement_category 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 |
#risk_and_enforcement_category ⇒ Object
Returns the value of attribute risk_and_enforcement_category.
15 16 17 |
# File 'lib/ach_client/objects/return_code.rb', line 15 def risk_and_enforcement_category @risk_and_enforcement_category end |
Instance Method Details
#administrative_return? ⇒ Boolean
44 45 46 |
# File 'lib/ach_client/objects/return_code.rb', line 44 def administrative_return? @risk_and_enforcement_category == "administrative" end |
#correction? ⇒ Boolean
Returns Whether or not this return is a correction/notice of change.
33 34 35 |
# File 'lib/ach_client/objects/return_code.rb', line 33 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
40 41 42 |
# File 'lib/ach_client/objects/return_code.rb', line 40 def internal? @code.start_with?(INTERNAL_START_CHARACTER) end |
#unauthorized_return? ⇒ Boolean
48 49 50 |
# File 'lib/ach_client/objects/return_code.rb', line 48 def @risk_and_enforcement_category == "unauthorized" end |