Sha256: 77bddd4408f97b9b7b0f8d260ed7be4a3b376cabe28b0c6e0deca779cda657b9

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

require 'test_helper'

module Workarea
  class Checkout
    module Fraud
      class KountAnalyzerTest < Workarea::TestCase
        setup :setup_sandbox_credentials
        teardown :restore_credentials

        def test_basic_fraud_test
          checkout = create_purchasable_checkout(order: {
            kount_session_id: '12345666',
            ip_address: '170.115.187.68'
          })

          VCR.use_cassette("kount/basic_fraud_test") do
            analyzer = KountAnalyzer.new(checkout)
            response = analyzer.decide!

            assert_equal(:approved, response.decision)
          end
        end

        private

        def setup_sandbox_credentials
          @_old_credentials = Workarea::Kount.credentials

          Rails.application.secrets.kount = {
            merchant_id: '200755',
            version: '0630',
            key: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIyMDA3NTUiLCJhdWQiOiJLb3VudC4xIiwiaWF0IjoxNTAwNDA3NTE1LCJzY3AiOnsia2EiOm51bGwsImtjIjpudWxsLCJhcGkiOnRydWUsInJpcyI6dHJ1ZX19.1YwTR1G8qBQ_TDK8MBYxDB2EhpUD0IlwWdvqHVOnm0o',
            ksalt: '4077th hawkeye trapper radar section-8',
            is_test: true
          }
        end

        def restore_credentials
          Rails.application.secrets.kount = @_old_credentials
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-kount-3.3.1 test/models/workarea/checkout/fraud/kount_analyzer_test.rb
workarea-kount-3.3.0 test/models/workarea/checkout/fraud/kount_analyzer_test.rb