Sha256: a508a3de6cb38a54b0d9bc422586e26f8c2f30b7560597d92e1ca4f86a5faf00
Contents?: true
Size: 1.42 KB
Versions: 26
Compression:
Stored size: 1.42 KB
Contents
module ActiveMerchant #:nodoc: module Billing #:nodoc: module Base GATEWAY_MODE_DEPRECATION_MESSAGE = 'Base#gateway_mode is deprecated in favor of Base#mode and will be removed in a future version' # Set ActiveMerchant gateways in test mode. # # ActiveMerchant::Billing::Base.mode = :test mattr_accessor :mode def self.gateway_mode=(mode) ActiveMerchant.deprecated(GATEWAY_MODE_DEPRECATION_MESSAGE) @@mode = mode end def self.gateway_mode ActiveMerchant.deprecated(GATEWAY_MODE_DEPRECATION_MESSAGE) @@mode end self.mode = :production # Return the matching gateway for the provider # * <tt>bogus</tt>: BogusGateway - Does nothing (for testing) # * <tt>moneris</tt>: MonerisGateway # * <tt>authorize_net</tt>: AuthorizeNetGateway # * <tt>trust_commerce</tt>: TrustCommerceGateway # # ActiveMerchant::Billing::Base.gateway('moneris').new 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 # A check to see if we're in test mode def self.test? mode == :test end end end end
Version data entries
26 entries across 26 versions & 3 rubygems