Sha256: df33feb5e0a21f83b3b0cd0bf8ff963683f634cad0ad324731559f026e8664f2

Contents?: true

Size: 1.43 KB

Versions: 2

Compression:

Stored size: 1.43 KB

Contents

require 'test_helper'

module Workarea
  module Kount
    class OrderFraudUpdateServiceTest < Workarea::TestCase
      setup :setup_sandbox_credentials
      teardown :restore_credentials

      def test_update_with_auth
        VCR.use_cassette('kount/order_fraud_update') do
          checkout = create_purchasable_checkout(order: {
            kount_session_id: '12345666',
            ip_address: '170.115.187.68'
          })

          assert(checkout.place_order)

          update_response = OrderFraudUpdateService.new(
            order: checkout.order,
            payment: checkout.payment
          ).perform!

          assert(update_response.success?)
        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
          }

          Workarea.config.fraud_analyzer = 'Workarea::Checkout::Fraud::KountAnalyzer'
        end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-kount-3.3.1 test/services/workarea/kount/order_fraud_update_service_test.rb
workarea-kount-3.3.0 test/services/workarea/kount/order_fraud_update_service_test.rb