ach_client 3.0.0 → 4.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db2454a8ff3bb7662637a5cee010020ed14a3515d6eb47efe369ccbdc9bc4be4
4
- data.tar.gz: 57751a71e4e2b8875da5d045d21f2c75c9261ff909bb20a765b1dc6eeb7faf00
3
+ metadata.gz: d054803f625f392d4b5638ceabf174fde8fd2847f0472c7a03e2d7672dd0c81e
4
+ data.tar.gz: 401b32b2f18c07b93583807844ec14e2ae1f41143393fa6797db72c8b7ce8c22
5
5
  SHA512:
6
- metadata.gz: 42622b2e2e29a203713131b2f0523110b52ec3e61a3f5c8c2a5166da5787f045daee6886ea1d5fb52a498b0bc9ca771cd3cb475706b5e542e4f037f265ffbea5
7
- data.tar.gz: febbaf712c3749e5417d55d9b247a7cde525a55e051be93bd44c0568392a6a5050cf42657971541869855516a66bc606d2ae16daf8da444a9b85b845816d66c2
6
+ metadata.gz: f2214c86385c3476239bc4aa01705ce63a95c8d2b1e3fffdb4d884cde3779eeb4f2b76c898548833fc0341a50909ab64d2edeba9f96c07635f25ac730e5f4a49
7
+ data.tar.gz: 6eca53351b052f89e7be43c53dbf8a33eadb7337205641c07d30e75cce455191e9f0bc2d97b57e244eb6344d7300bf809ff50df972fb7db0c223772fb1a6410e
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.8
1
+ 3.1.3
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 2.6.8
1
+ ruby 3.1.3
data/README.md CHANGED
@@ -70,7 +70,7 @@ AchClient::Provider::AchTransaction.new(
70
70
  # The merchant's account type (see account types note above)
71
71
  account_type: AchClient::AccountTypes::BusinessChecking,
72
72
  # The amount of the ACH transaction, should be positive
73
- amount: BigDecimal.new('575.45'),
73
+ amount: BigDecimal('575.45'),
74
74
  # The date on which you would like the transaction to take effect.
75
75
  # Beware that some providers may use this field to charge you extra for
76
76
  # same-day ACH ( a recent feature for ACH providers )
@@ -337,6 +337,7 @@ these new classes using the same interface described above for the API providers
337
337
  | `outgoing_path` | Path on the remote server where bank has asked you to dump your NACHAs |
338
338
  | `incoming_path` | Path on the remote server where the bank leaves confirmation/return files |
339
339
  | `file_naming_strategy` | Function to define filenames for the NACHA files |
340
+ | `transmission_datetime_calculator` | (optional) Function to define File Creation Date header value - defaults to `-> { Time.now }` - note that you may wish to override this to use a non-UTC zone |
340
341
 
341
342
  #### File Naming Strategy
342
343
 
data/ach_client.gemspec CHANGED
@@ -28,20 +28,22 @@ Gem::Specification.new do |spec|
28
28
  'config'
29
29
  ]
30
30
 
31
+ #spec.required_ruby_version = '>= 2.7.0'
32
+
31
33
  # NACHA library
32
34
  spec.add_dependency 'ach', '~> 0'
33
35
 
34
36
  # Handy ruby behavior from rails
35
- spec.add_dependency 'activesupport', '< 6' # Need to rename .parent to .module_parent before upgrade
37
+ spec.add_dependency 'activesupport', '>= 6.0'
36
38
 
37
39
  # SFTP client (for Bank providers)
38
40
  spec.add_dependency 'net-sftp'
39
41
 
40
42
  # SOAP client (for AchWorks and ICheckGateway clients)
41
- spec.add_dependency 'savon', '~> 2'
43
+ spec.add_dependency 'savon', '~> 2.12.0'
42
44
 
43
45
  # Asynchronocity w/out extra infrastucture dependency (database/redis)
44
- spec.add_dependency 'sucker_punch', '~> 2'
46
+ spec.add_dependency 'sucker_punch', '~> 3'
45
47
 
46
48
  spec.add_development_dependency 'codeclimate-test-reporter'
47
49
  spec.add_development_dependency 'minitest-reporters'
@@ -17,11 +17,10 @@ module AchClient
17
17
  end
18
18
 
19
19
  private_class_method def self.build_from_config(args)
20
- self.new(
21
- args.map do |arg|
20
+ args_hash = args.map do |arg|
22
21
  {arg => self.to_s.deconstantize.constantize.send(arg)}
23
22
  end.reduce(&:merge)
24
- )
23
+ self.new(**args_hash)
25
24
  end
26
25
  end
27
26
  end
@@ -12,15 +12,15 @@ module AchClient
12
12
  # The filename used for the batch
13
13
  # @return [String] filename to use
14
14
  def batch_file_name
15
- self.class.parent.file_naming_strategy.(@batch_number)
15
+ self.class.module_parent.file_naming_strategy.(@batch_number)
16
16
  end
17
17
 
18
18
  # Sends the batch to SFTP provider
19
19
  # @return [Array<String>]
20
20
  def do_send_batch
21
- self.class.parent.write_remote_file(
21
+ self.class.module_parent.write_remote_file(
22
22
  file_path: File.join(
23
- self.class.parent.outgoing_path,
23
+ self.class.module_parent.outgoing_path,
24
24
  batch_file_name
25
25
  ),
26
26
  file_body: cook_some_nachas.to_s
@@ -62,9 +62,10 @@ module AchClient
62
62
  :immediate_destination,
63
63
  :immediate_destination_name,
64
64
  :immediate_origin,
65
- :immediate_origin_name
65
+ :immediate_origin_name,
66
+ :transmission_datetime
66
67
  ].each do |attribute|
67
- file_header.send("#{attribute}=", self.class.parent.send(attribute))
68
+ file_header.send("#{attribute}=", self.class.module_parent.send(attribute))
68
69
  end
69
70
  file_header
70
71
  end
@@ -79,14 +80,14 @@ module AchClient
79
80
  batch_header = batch.header
80
81
  batch_header.company_name = originator_name
81
82
  batch_header.company_identification =
82
- self.class.parent.company_identification
83
+ self.class.module_parent.company_identification
83
84
  batch_header.standard_entry_class_code = sec_code
84
85
  batch_header.company_entry_description =
85
- self.class.parent.company_entry_description
86
+ self.class.module_parent.company_entry_description
86
87
  batch_header.company_descriptive_date = effective_entry_date
87
88
  batch_header.effective_entry_date = effective_entry_date
88
89
  batch_header.originating_dfi_identification =
89
- self.class.parent.originating_dfi_identification
90
+ self.class.module_parent.originating_dfi_identification
90
91
  transactions.each do |transaction|
91
92
  batch.entries << transaction.to_entry_detail
92
93
  end
@@ -22,7 +22,7 @@ module AchClient
22
22
  # values
23
23
  def self.in_range(start_date:, end_date:)
24
24
  in_range = {}
25
- self.parent.with_sftp_connection do |connection|
25
+ self.module_parent.with_sftp_connection do |connection|
26
26
  in_range = process_files(
27
27
  files_in_range(
28
28
  connection: connection,
@@ -92,7 +92,7 @@ module AchClient
92
92
  end
93
93
 
94
94
  private_class_method def self.inbox_path_to(filename)
95
- "#{self.parent.incoming_path}/#{filename}"
95
+ "#{self.module_parent.incoming_path}/#{filename}"
96
96
  end
97
97
 
98
98
  private_class_method def self.files_in_range(
@@ -101,7 +101,7 @@ module AchClient
101
101
  end_date: nil
102
102
  )
103
103
  # Get info on all files - equivalent to `ls`
104
- connection.dir.entries(self.parent.incoming_path)
104
+ connection.dir.entries(self.module_parent.incoming_path)
105
105
  .select do |file|
106
106
  last_modified_time = Time.at(file.attributes.mtime) - 1.minute
107
107
  # Filter to files modified in date range
@@ -148,7 +148,7 @@ module AchClient
148
148
 
149
149
  private_class_method def self.most_recent_files
150
150
  files = []
151
- self.parent.with_sftp_connection do |connection|
151
+ self.module_parent.with_sftp_connection do |connection|
152
152
  files = files_in_range(
153
153
  connection: connection,
154
154
  start_date: last_most_recent_check_date(connection: connection)
@@ -20,7 +20,7 @@ module AchClient
20
20
  entry.individual_id_number = remove_newlines(external_ach_id) # Doesn't need to be a number
21
21
  entry.individual_name = remove_newlines(merchant_name)
22
22
  entry.originating_dfi_identification = remove_newlines(
23
- self.class.parent.originating_dfi_identification
23
+ self.class.module_parent.originating_dfi_identification
24
24
  )
25
25
  entry.trace_number = remove_non_digits(external_ach_id).to_i # Must be number
26
26
  entry
@@ -25,6 +25,13 @@ module AchClient
25
25
  # @return [String] originating_dfi_identification refers to your bank?
26
26
  # originating_dfi => "Originating Depository Financial Institution"
27
27
  class_attribute :originating_dfi_identification
28
+
29
+ # @return [Proc<Time>] method to calculate the File Creation Date for NACHA header
30
+ class_attribute :transmission_datetime_calculator, default: -> { Time.now }
31
+
32
+ def self.transmission_datetime
33
+ transmission_datetime_calculator.call
34
+ end
28
35
  end
29
36
  end
30
37
  end
@@ -30,7 +30,7 @@ module AchClient
30
30
  # @return [AchClient::ProcessingAchResponse] processing response
31
31
  def self.process_1SNT(record)
32
32
  AchClient::ProcessingAchResponse.new(
33
- amount: BigDecimal.new(record[:trans_amount]),
33
+ amount: BigDecimal(record[:trans_amount]),
34
34
  date: record[:action_date]
35
35
  )
36
36
  end
@@ -40,7 +40,7 @@ module AchClient
40
40
  # @return [AchClient::SettledAchResponse] settled response
41
41
  def self.process_2STL(record)
42
42
  AchClient::SettledAchResponse.new(
43
- amount: BigDecimal.new(record[:trans_amount]),
43
+ amount: BigDecimal(record[:trans_amount]),
44
44
  date: record[:action_date]
45
45
  )
46
46
  end
@@ -51,7 +51,7 @@ module AchClient
51
51
  # @return [AchClient::ReturnedAchResponse] returned response
52
52
  def self.process_3RET(record)
53
53
  AchClient::ReturnedAchResponse.new(
54
- amount: BigDecimal.new(record[:trans_amount]),
54
+ amount: BigDecimal(record[:trans_amount]),
55
55
  date: record[:action_date],
56
56
  return_code: AchClient::ReturnCodes.find_by(
57
57
  code: record[:action_detail][0..2]
@@ -75,7 +75,7 @@ module AchClient
75
75
  # @return [AchClient::CorrectedAchResponse] corrected response
76
76
  def self.process_5COR(record)
77
77
  AchClient::CorrectedAchResponse.new(
78
- amount: BigDecimal.new(record[:trans_amount]),
78
+ amount: BigDecimal(record[:trans_amount]),
79
79
  date: record[:action_date],
80
80
  return_code: AchClient::ReturnCodes.find_by(
81
81
  code: record[:action_detail][0..2]
@@ -1,4 +1,4 @@
1
1
  module AchClient
2
2
  # Increment this when changes are published
3
- VERSION = '3.0.0'
3
+ VERSION = '4.0.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: 3.0.0
4
+ version: 4.0.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: 2022-11-14 00:00:00.000000000 Z
11
+ date: 2023-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ach
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "<"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '6'
33
+ version: '6.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "<"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '6'
40
+ version: '6.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: net-sftp
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2'
61
+ version: 2.12.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2'
68
+ version: 2.12.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sucker_punch
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '2'
75
+ version: '3'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '2'
82
+ version: '3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: codeclimate-test-reporter
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -258,7 +258,6 @@ files:
258
258
  - ".codeclimate.yml"
259
259
  - ".github/CODEOWNERS"
260
260
  - ".gitignore"
261
- - ".rubocop.yml"
262
261
  - ".ruby-version"
263
262
  - ".tool-versions"
264
263
  - ".tool-versions-e"
@@ -349,7 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
348
  - !ruby/object:Gem::Version
350
349
  version: '0'
351
350
  requirements: []
352
- rubygems_version: 3.0.3.1
351
+ rubygems_version: 3.3.26
353
352
  signing_key:
354
353
  specification_version: 4
355
354
  summary: Adapter to interact with various ACH service providers