Module: Omnipay

Defined in:
lib/omnipay.rb,
lib/omnipay/adapter.rb,
lib/omnipay/gateway.rb,
lib/omnipay/helpers.rb,
lib/omnipay/railtie.rb,
lib/omnipay/version.rb,
lib/omnipay/gateways.rb,
lib/omnipay/middleware.rb,
lib/omnipay/configuration.rb,
lib/omnipay/sample_adapter.rb,
lib/omnipay/autosubmit_form.rb

Overview

The root Omnipay module. Used for defining its global configuration

Defined Under Namespace

Modules: ActionController, Adapters, Helpers Classes: Adapter, AutosubmitForm, Configuration, Gateway, Gateways, Middleware, Railtie

Constant Summary collapse

SUCCESS =

Code for a successful transaction

:success
CANCELATION =

Error code for a user-initiated payment failure

:cancelation
PAYMENT_REFUSED =

Error code for a valid response but a failed payment

:payment_refused
INVALID_RESPONSE =

Error code for an untreatable response

:invalid_response
VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.configurationConfiguration

Accessor to the global configuration

Returns:



43
44
45
# File 'lib/omnipay.rb', line 43

def self.configuration
  Configuration.instance
end

.configure {|configuration| ... } ⇒ Object

Allows to configure omnipay via a block

Example use :

Omnipay.configure do |config|
  config.base_path = '/payment'
end

Yields:



54
55
56
# File 'lib/omnipay.rb', line 54

def self.configure
  yield configuration
end

.gatewaysGateways

Accessors to the configured gateways

Returns:

  • (Gateways)

    the configured gateways



29
30
31
# File 'lib/omnipay.rb', line 29

def self.gateways
  @gateways ||= Omnipay::Gateways.new
end

.use_gateway(opts = {}, &block) ⇒ Object

Syntaxic sugar for adding a new gateway



36
37
38
# File 'lib/omnipay.rb', line 36

def self.use_gateway(opts = {}, &block)
  self.gateways.push(opts, &block)
end