Skip to content

Instantly share code, notes, and snippets.

@sr3d
sr3d / config__initializers__active_merchant.rb
Created August 21, 2020 05:51 — forked from werkshy/config__initializers__active_merchant.rb
Mock Authorize.net CIM Gateway (ActiveMerchant). Released under the MIT License
# Initializer where we inject the mock gateway into global variable AUTHNET_GATEWAY or setup the real client
if !Rails.env.production?
ActiveMerchant::Billing::Base.mode = :test
end
$using_mock_auth_net_gateway = false
# Use FORCE_AUTH_NET to use the real Auth.net API in tests
# Use MOCK_AUTH_NET to use the mock Auth.net API even in development (good on a plane!)