ach_client 4.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,14 @@ module AchClient
11
11
  # @param globals [Savon::GlobalOptions] Savon's global options
12
12
  # @param locals [Savon::LocalOptions] Savon's global options
13
13
  # @return [NilClass] returns nothing so the request is not mutated
14
- def notify(operation_name, builder, _globals, _locals)
14
+ def notify(operation_name, builder, globals, _locals)
15
+ # Since Savon only lets us register observers globally this method is called by any other Savon clients outside
16
+ # this library. We don't want to log for those other clients so we check to see that the request came from
17
+ # AchClient by comparing the wsdl to our known wsdls
18
+ return unless [
19
+ AchClient::ICheckGateway.wsdl,
20
+ AchClient::AchWorks.wsdl
21
+ ].include?(globals.instance_variable_get(:@options)[:wsdl])
15
22
  # Send the xml body to the logger job
16
23
  AchClient::Logging::LogProviderJob.perform_async(
17
24
  body: builder.to_s,
@@ -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,7 +15,8 @@ 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
@@ -1,4 +1,4 @@
1
1
  module AchClient
2
2
  # Increment this when changes are published
3
- VERSION = '4.0.0'
3
+ VERSION = '5.1.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: 4.0.0
4
+ version: 5.1.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-02-03 00:00:00.000000000 Z
11
+ date: 2023-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ach