ach_client 0.6.8 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d11d4f11d7798de68161c055bd3813b48c8c825
4
- data.tar.gz: f16abf9d6efe1cf2b98e82645658e178a698309d
3
+ metadata.gz: a4f5db8a27b5ba348d4a2b98c3219350528ba763
4
+ data.tar.gz: e067d4721f6225444a0c9d740cabe5b7bc4c2c8f
5
5
  SHA512:
6
- metadata.gz: 36dfae94d6242fafd729fc5d0a21cf9ff23d130ceb303f14ca0b1d9181d0c72630f5cfc32af3df290b9f5c4128c47190775d016af1977d7536f4ec0a8fde1d8d
7
- data.tar.gz: d0ebf4105244973ee008d7441a10e2e74881d701afce322e6fc05e0a9685cc7393e66e01dd5a01c383533fbe172469fafa866608dc7994e9f828e69b2f859548
6
+ metadata.gz: 3936c72ff9eff2330f3b06d8ead56d03d5c858cbe7ab783d9840f9c4da79751bb7c8c94658551e22da0cfa7a53d2cee7449505c2ea7da52d022f5f046a8b288f
7
+ data.tar.gz: b207d8ac87d006dcb3c3aebc81107db555583ee88eab300e0c2277a7c8531d613a76316c22ee3d157202ec73f1a9b5155dfb9ee2cbf127f7b335b2b929566074
@@ -1 +1 @@
1
- 2.3.1
1
+ 2.4.2
@@ -0,0 +1 @@
1
+ ruby 2.4.2
@@ -55,4 +55,5 @@ Gem::Specification.new do |spec|
55
55
  spec.add_development_dependency 'vcr'
56
56
  spec.add_development_dependency 'webmock'
57
57
  spec.add_development_dependency 'yard'
58
+ spec.add_development_dependency 'bundler-audit'
58
59
  end
@@ -0,0 +1,3 @@
1
+ # To be raised when an ACH transaction can not be sent because it is invalid
2
+ class InvalidAchTransactionError < RuntimeError
3
+ end
@@ -16,6 +16,18 @@ module AchClient
16
16
  # @return [Array<String>] Identifiers to use to poll for result of batch
17
17
  # processing later on.
18
18
  def send_batch
19
+ if @ach_transactions.all?(&:sendable?)
20
+ do_send_batch
21
+ else
22
+ raise InvalidAchTransactionError
23
+ end
24
+ end
25
+
26
+ # Implementation of sending the ACH batch to the provider, to be
27
+ # implemented by the subclass
28
+ # @return [Array<String>] Identifiers to use to poll for result of batch
29
+ # processing later on.
30
+ def do_send_batch
19
31
  raise AbstractMethodError
20
32
  end
21
33
  end
@@ -62,9 +62,27 @@ module AchClient
62
62
  transaction_type == AchClient::TransactionTypes::Credit
63
63
  end
64
64
 
65
+ # Check if the transaction is sendable, and if so, send it according
66
+ # to the subclass implementation
65
67
  def send
68
+ if sendable?
69
+ do_send
70
+ else
71
+ raise InvalidAchTransactionError
72
+ end
73
+ end
74
+
75
+ # The implementation of sending the transaction, as implemented by the
76
+ # subclass
77
+ def do_send
66
78
  raise AbstractMethodError
67
79
  end
80
+
81
+ # Prevent sending of invalid transactions, such as those where the
82
+ # effective entry date is in the past
83
+ def sendable?
84
+ effective_entry_date&.future? || effective_entry_date&.today?
85
+ end
68
86
  end
69
87
  end
70
88
  end
@@ -17,7 +17,7 @@ module AchClient
17
17
 
18
18
  # Sends the batch to SFTP provider
19
19
  # @return [Array<String>]
20
- def send_batch
20
+ def do_send_batch
21
21
  self.class.parent.write_remote_file(
22
22
  file_path: File.join(
23
23
  self.class.parent.outgoing_path,
@@ -4,7 +4,7 @@ module AchClient
4
4
  class AchTransaction < Abstract::AchTransaction
5
5
 
6
6
  # Most SFTP providers only support batch transactions
7
- def send
7
+ def do_send
8
8
  raise 'NACHA/SFTP providers do not support individual transactions'
9
9
  end
10
10
 
@@ -10,7 +10,7 @@ module AchClient
10
10
  # gives us. We can use that to track the batch processing later on.
11
11
  # If it fails, an exception will be thrown.
12
12
  # @return [Array<String>] the external_ach_id's for each transaction
13
- def send_batch
13
+ def do_send_batch
14
14
  AchClient::AchWorks.wrap_request(
15
15
  method: :send_ach_trans_batch,
16
16
  message: self.to_hash,
@@ -18,7 +18,7 @@ module AchClient
18
18
 
19
19
  # Send this transaction individually to AchWorks
20
20
  # @return [String] the front end trace
21
- def send
21
+ def do_send
22
22
  AchClient::AchWorks.wrap_request(
23
23
  method: :send_ach_trans,
24
24
  message: AchClient::AchWorks::CompanyInfo.build.to_hash.merge({
@@ -4,7 +4,7 @@ module AchClient
4
4
  class AchBatch < Abstract::AchBatch
5
5
 
6
6
  # ICheckGateway does not support ACH batching
7
- def send_batch
7
+ def do_send_batch
8
8
  raise 'ICheckGateway does not support ACH batching'
9
9
  end
10
10
  end
@@ -11,7 +11,7 @@ module AchClient
11
11
  # The date range can't be wider than 15 days
12
12
  "ACCESS DENIED: Date Range Exceeds 15 Days",
13
13
  # Because so far they all contain ACCESS_DENIED:
14
- "ACCESS_DENIED"
14
+ "ACCESS DENIED"
15
15
  ]
16
16
 
17
17
  ##
@@ -9,7 +9,7 @@ module AchClient
9
9
  # Raises an exception with as much info as possible if something goes
10
10
  # wrong
11
11
  # @return [String] a string returned by ICheckGateway - external_ach_id
12
- def send
12
+ def do_send
13
13
  # The response comes back as a | separated list of field values with
14
14
  # no header field/keys. It seems that the first column will contain
15
15
  # 'APPROVED' if the request was successful. The 8th column is the
@@ -1,4 +1,4 @@
1
1
  module AchClient
2
2
  # Increment this when changes are published
3
- VERSION = '0.6.8'
3
+ VERSION = '0.7.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: 0.6.8
4
+ version: 0.7.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: 2017-07-19 00:00:00.000000000 Z
11
+ date: 2017-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ach
@@ -248,6 +248,20 @@ dependencies:
248
248
  - - ">="
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
+ - !ruby/object:Gem::Dependency
252
+ name: bundler-audit
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ version: '0'
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ version: '0'
251
265
  description:
252
266
  email:
253
267
  - zach@zachcotter.com
@@ -259,6 +273,7 @@ files:
259
273
  - ".gitignore"
260
274
  - ".rubocop.yml"
261
275
  - ".ruby-version"
276
+ - ".tool-versions"
262
277
  - ".travis.yml"
263
278
  - Gemfile
264
279
  - README.md
@@ -269,6 +284,7 @@ files:
269
284
  - config/return_codes.yml
270
285
  - lib/ach_client.rb
271
286
  - lib/ach_client/abstract/abstract_method_error.rb
287
+ - lib/ach_client/abstract/invalid_ach_transaction_error.rb
272
288
  - lib/ach_client/helpers/dollars_to_cents.rb
273
289
  - lib/ach_client/logging/log_provider_job.rb
274
290
  - lib/ach_client/logging/log_providers/log_provider.rb
@@ -339,7 +355,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
339
355
  version: '0'
340
356
  requirements: []
341
357
  rubyforge_project:
342
- rubygems_version: 2.6.11
358
+ rubygems_version: 2.6.14
343
359
  signing_key:
344
360
  specification_version: 4
345
361
  summary: Adapter to interact with various ACH service providers