Sha256: 6876a87fbfbcb2f0bebcd5f422170bb4b7d5b04f5db8603e19698a9ae21c4959

Contents?: true

Size: 1.34 KB

Versions: 10

Compression:

Stored size: 1.34 KB

Contents

module AchClient
  class Fake
    # Fake ACH polling that always returns the same set of results.
    class AchStatusChecker < Abstract::AchStatusChecker

      def self.most_recent
        in_range(start_date: Date.today - 3.days, end_date: Date.today)
      end

      def self.in_range(start_date:, end_date:)
        {
          'processing' => [AchClient::ProcessingAchResponse.new(amount: 100.0, date: start_date)],
          'settled' => [AchClient::SettledAchResponse.new(amount: 100.0, date: start_date)],
          'returned' => [
            AchClient::ReturnedAchResponse.new(
              amount: 100.0,
              date: start_date,
              return_code: AchClient::ReturnCodes.find_by(code: 'R01')
            )
          ],
          'corrected' => [
            AchClient::CorrectedAchResponse.new(
              amount: 100.0,
              date: start_date,
              return_code: AchClient::ReturnCodes.find_by(code: 'XZ2'),
              corrections: '123456789'
            )
          ],
          'late_returned' => [
            AchClient::SettledAchResponse.new(amount: 100.0, date: start_date),
            AchClient::ReturnedAchResponse.new(
              amount: 100.0,
              date: end_date,
              return_code: AchClient::ReturnCodes.find_by(code: 'R08')
            )
          ]
        }
      end

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ach_client-5.3.2 lib/ach_client/providers/soap/fake/ach_status_checker.rb
ach_client-5.3.1 lib/ach_client/providers/soap/fake/ach_status_checker.rb
ach_client-5.3.0 lib/ach_client/providers/soap/fake/ach_status_checker.rb
ach_client-5.2.0 lib/ach_client/providers/soap/fake/ach_status_checker.rb
ach_client-5.1.0 lib/ach_client/providers/soap/fake/ach_status_checker.rb
ach_client-5.0.0 lib/ach_client/providers/soap/fake/ach_status_checker.rb
ach_client-4.0.0 lib/ach_client/providers/soap/fake/ach_status_checker.rb
ach_client-3.1.0 lib/ach_client/providers/soap/fake/ach_status_checker.rb
ach_client-3.0.0 lib/ach_client/providers/soap/fake/ach_status_checker.rb
ach_client-2.1.0 lib/ach_client/providers/soap/fake/ach_status_checker.rb