ach_client 5.0.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,16 +14,19 @@ module AchClient
14
14
 
15
15
  attr_accessor :code,
16
16
  :description,
17
- :reason
17
+ :reason,
18
+ :risk_and_enforcement_category
18
19
 
19
20
  # Constructs a Ach return code
20
21
  # @param code [String] the 3 char code identifier (ie 'R01')
21
22
  # @param description [String] full explanation of the return
22
23
  # @param reason [String] shorter explanation of the return
23
- def initialize(code:, description:, reason: nil)
24
+ def initialize(code:, description:, reason: nil, risk_and_enforcement_category: nil)
24
25
  @code = code
25
26
  @description = description
26
27
  @reason = reason
28
+ # See https://www.nacha.org/rules/ach-network-risk-and-enforcement-topics
29
+ @risk_and_enforcement_category = risk_and_enforcement_category
27
30
  end
28
31
 
29
32
  # @return Whether or not this return is a correction/notice of change
@@ -37,5 +40,13 @@ module AchClient
37
40
  def internal?
38
41
  @code.start_with?(INTERNAL_START_CHARACTER)
39
42
  end
43
+
44
+ def administrative_return?
45
+ @risk_and_enforcement_category == "administrative"
46
+ end
47
+
48
+ def unauthorized_return?
49
+ @risk_and_enforcement_category == "unauthorized"
50
+ end
40
51
  end
41
52
  end
@@ -15,11 +15,20 @@ module AchClient
15
15
  ReturnCode.new(
16
16
  code: code['code'],
17
17
  description: code['description'],
18
- reason: code['reason']
18
+ reason: code['reason'],
19
+ risk_and_enforcement_category: code['risk_and_enforcement_category']
19
20
  )
20
21
  end
21
22
  end
22
23
 
24
+ def self.unauthorized
25
+ self.all.select(&:unauthorized_return?)
26
+ end
27
+
28
+ def self.administrative
29
+ self.all.select(&:administrative_return?)
30
+ end
31
+
23
32
  # Finds the first ReturnCode with the given code, or raises an exception.
24
33
  # @param [String] 3 char code identifier for a return code
25
34
  # @param [AchClient::ReturnCode] The ReturnCode object with that code
@@ -1,4 +1,4 @@
1
1
  module AchClient
2
2
  # Increment this when changes are published
3
- VERSION = '5.0.0'
3
+ VERSION = '5.2.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ach_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Cotter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-17 00:00:00.000000000 Z
11
+ date: 2023-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ach