Sha256: fd80b9958a30b8d7b6d7c098c8a2dfb5a13f7a3e0cb200af6c23d25fc6bd31c4

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

require 'test_helper'

class RemoteCompleteTransactionTest < Test::Unit::TestCase
  def setup
    @environment = Spreedly::Environment.new(remote_test_environment_key, remote_test_access_secret)
  end

  def test_successful_complete_a_3ds_transaction
    gateway_token = @environment.add_gateway(:test).token
    card_token = create_threeds_2_card_on(@environment).token
    base64_encoded_browser_info = "eyJ3aWR0aCI6MTY4MCwiaGVpZ2h0IjoxMDUwLCJkZXB0aCI6MjQsInRpbWV6b25lIjoyNDAsInVzZXJfYWdlbnQiOiJNb3ppbGxhLzUuMCAoTWFjaW50b3NoOyBJbnRlbCBNYWMgT1MgWCAxMF8xNF80KSBBcHBsZVdlYktpdC82MDUuMS4xNSAoS0hUTUwsIGxpa2UgR2Vja28pIFZlcnNpb24vMTIuMSBTYWZhcmkvNjA1LjEuMTUiLCJqYXZhIjp0cnVlLCJsYW5ndWFnZSI6ImVuLVVTIn0="
    purchase = @environment.purchase_on_gateway(
      gateway_token,
      card_token,
      3003,
      browser_info: base64_encoded_browser_info,
      three_ds_version: '2.0',
      redirect_url: 'https://example.com/redirect',
      callback_url: 'https://example.com/callback',
      attempt_3dsecure: true
    )
    assert_equal 'pending', purchase.state

    complete_transaction = @environment.complete_transaction(purchase.token)
    assert_equal 'succeeded', complete_transaction.state
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spreedly-2.0.28 test/remote/remote_complete_test.rb
spreedly-2.0.27 test/remote/remote_complete_test.rb
spreedly-2.0.26 test/remote/remote_complete_test.rb
spreedly-2.0.25 test/remote/remote_complete_test.rb
spreedly-2.0.24 test/remote/remote_complete_test.rb