Class: AchClient::Abstract::AchBatch

Inherits:
Object
  • Object
show all
Defined in:
lib/ach_client/providers/abstract/ach_batch.rb

Overview

Base class for sending batched ACH transactions to various providers

Instance Method Summary collapse

Constructor Details

#initialize(ach_transactions: []) ⇒ AchBatch

Returns a new instance of AchBatch.

Parameters:

  • ach_transactions (Array) (defaults to: [])

    List of AchTransaction objects to batch



10
11
12
# File 'lib/ach_client/providers/abstract/ach_batch.rb', line 10

def initialize(ach_transactions: [])
  @ach_transactions = ach_transactions
end

Instance Method Details

#do_send_batchArray<String>

Implementation of sending the ACH batch to the provider, to be

implemented by the subclass

processing later on.

Returns:

  • (Array<String>)

    Identifiers to use to poll for result of batch

Raises:



30
31
32
# File 'lib/ach_client/providers/abstract/ach_batch.rb', line 30

def do_send_batch
  raise AbstractMethodError
end

#send_batchArray<String>

Sends the batch to the provider, and returns a tracking identifier processing later on.

Returns:

  • (Array<String>)

    Identifiers to use to poll for result of batch



18
19
20
21
22
23
24
# File 'lib/ach_client/providers/abstract/ach_batch.rb', line 18

def send_batch
  if @ach_transactions.all?(&:sendable?)
    do_send_batch
  else
    raise InvalidAchTransactionError
  end
end