Method: ActiveMerchant::Billing::Base.gateway

Defined in:
lib/active_merchant/billing/base.rb

.gateway(name) ⇒ Object

Return the matching gateway for the provider

  • bogus: BogusGateway - Does nothing (for testing)

  • moneris: MonerisGateway

  • authorize_net: AuthorizeNetGateway

  • trust_commerce: TrustCommerceGateway

    ActiveMerchant::Billing::Base.gateway(‘moneris’).new

Raises:

  • (ArgumentError)


30
31
32
33
34
35
36
37
38
39
40
# File 'lib/active_merchant/billing/base.rb', line 30

def self.gateway(name)
  name_str = name.to_s.strip.downcase

  raise(ArgumentError, 'A gateway provider must be specified') if name_str.blank?

  begin
    Billing.const_get("#{name_str}_gateway".camelize)
  rescue
    raise ArgumentError, "The specified gateway is not valid (#{name_str})"
  end
end