Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with WebMock 3.16.0 #4523

Closed
jdufresne opened this issue Aug 4, 2022 · 1 comment
Closed

Incompatible with WebMock 3.16.0 #4523

jdufresne opened this issue Aug 4, 2022 · 1 comment
Labels

Comments

@jdufresne
Copy link

WebMock recently had a new release 3.16.0. This causes issues when used with Active Merchant due to it accessing private instance variables. See here:

return {} unless use_ssl? && @socket.present?
{ version: @socket.io.ssl_version, cipher: @socket.io.cipher[0] }

On at least one occasion, Active Merchant has made changes to remain compatible with WebMock, so it seems like the current situation is not desirable. See: #2874.

The issue was tracked down to WebMock PR bblimke/webmock#976.

Below is an example script that shows the incompatibility. This script does not fail with WebMock 3.15.

require 'activemerchant'
require 'webmock'
include WebMock::API

WebMock.enable!

stub_request(:post, "https://api2.authorize.net/xml/v1/request.api")

ActiveMerchant::Billing::Base.mode = 'test'

credit_card = ActiveMerchant::Billing::CreditCard.new({
  number: '4111111111111111',
  month: '11',
  year: '25',
  first_name: 'John',
  last_name: 'Doe',
  verification_value: '111',
})

gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(
  login: 'test',
  password: 'test',
)

gateway.authorize(1000, credit_card)
/home/jon/test-webmock/.bundle/ruby/3.1.0/gems/activemerchant-1.126.0/lib/active_merchant/net_http_ssl_connection.rb:8:in `ssl_connection': undefined method `ssl_version' for #<StubSocket::StubIO:0x00007f222d331f48> (NoMethodError)

      { version: @socket.io.ssl_version, cipher: @socket.io.cipher[0] }
                           ^^^^^^^^^^^^
	from /home/jon/test-webmock/.bundle/ruby/3.1.0/gems/activemerchant-1.126.0/lib/active_merchant/connection.rb:82:in `block (2 levels) in request'
	from /home/jon/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/benchmark.rb:311:in `realtime'
	from /home/jon/test-webmock/.bundle/ruby/3.1.0/gems/activemerchant-1.126.0/lib/active_merchant/connection.rb:80:in `block in request'
	from /home/jon/test-webmock/.bundle/ruby/3.1.0/gems/activemerchant-1.126.0/lib/active_merchant/network_connection_retries.rb:24:in `block in retry_exceptions'
	from /home/jon/test-webmock/.bundle/ruby/3.1.0/gems/activemerchant-1.126.0/lib/active_merchant/network_connection_retries.rb:52:in `retry_network_exceptions'
	from /home/jon/test-webmock/.bundle/ruby/3.1.0/gems/activemerchant-1.126.0/lib/active_merchant/network_connection_retries.rb:23:in `retry_exceptions'
	from /home/jon/test-webmock/.bundle/ruby/3.1.0/gems/activemerchant-1.126.0/lib/active_merchant/connection.rb:75:in `request'
	from /home/jon/test-webmock/.bundle/ruby/3.1.0/gems/activemerchant-1.126.0/lib/active_merchant/posts_data.rb:74:in `raw_ssl_request'
	from /home/jon/test-webmock/.bundle/ruby/3.1.0/gems/activemerchant-1.126.0/lib/active_merchant/posts_data.rb:44:in `ssl_request'
	from /home/jon/test-webmock/.bundle/ruby/3.1.0/gems/activemerchant-1.126.0/lib/active_merchant/posts_data.rb:40:in `ssl_post'
	from /home/jon/test-webmock/.bundle/ruby/3.1.0/gems/activemerchant-1.126.0/lib/active_merchant/billing/gateways/authorize_net.rb:817:in `commit'
	from /home/jon/test-webmock/.bundle/ruby/3.1.0/gems/activemerchant-1.126.0/lib/active_merchant/billing/gateways/authorize_net.rb:120:in `authorize'
	from test.rb:27:in `<main>'
Copy link

github-actions bot commented Dec 2, 2023

To provide a cleaner slate for the maintenance of the library, this PR/Issue is being labeled stale after 60 days without activity. It will be closed in 14 days unless you comment with an update regarding its applicability to the current build. Thank you!

@github-actions github-actions bot added the Stale label Dec 2, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant