Class: MerchantSidekick::ActiveMerchant::Gateways::AuthorizeNetGateway

Inherits:
Base
  • Object
show all
Defined in:
lib/merchant_sidekick/active_merchant/gateways/authorize_net_gateway.rb

Class Method Summary collapse

Methods inherited from Base

default_gateway=

Methods inherited from Gateway

config, config_path, default_gateway, type

Class Method Details

.gatewayObject

Returns an active merchant authorize net gateway instance unless there is already one assigned.



11
12
13
14
15
16
17
18
19
20
# File 'lib/merchant_sidekick/active_merchant/gateways/authorize_net_gateway.rb', line 11

def gateway
  unless @@gateway
    ::ActiveMerchant::Billing::Base.mode = :test if config[:mode] == "test"
    @@gateway = ::ActiveMerchant::Billing::AuthorizeNetGateway.new({
      :login    => config[:login_id],
      :password => config[:transaction_key]
    }.merge(config[:mode] == "test" ? {:test => true} : {}))
  end
  @@gateway
end