Class: ActivePayment::Gateway::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/activepayment/gateway_base.rb

Direct Known Subclasses

Payone::Gateway, Wirecard::Gateway

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#transaction_paramsObject

Returns the value of attribute transaction_params.



7
8
9
# File 'lib/activepayment/gateway_base.rb', line 7

def transaction_params
  @transaction_params
end

Class Method Details

.build(name) ⇒ Object



9
10
11
# File 'lib/activepayment/gateway_base.rb', line 9

def self.build(name)
  "ActivePayment::#{name.to_s.classify}::Gateway".constantize
end

.config {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



18
19
20
# File 'lib/activepayment/gateway_base.rb', line 18

def self.config
  yield self
end

.config=(config) ⇒ Object



13
14
15
16
# File 'lib/activepayment/gateway_base.rb', line 13

def self.config=(config)
  config = config[self.gateway_name] if config.include?(self.gateway_name) && !config[self.gateway_name].blank?
  config.each { |method, value| self.send("#{method}=", value) }
end

Instance Method Details

#http_connectionObject



30
31
32
33
34
35
36
37
# File 'lib/activepayment/gateway_base.rb', line 30

def http_connection
  http = Net::HTTP.new(self.url.host, self.url.port)
  unless http.blank?
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    yield http
  end
end

#urlObject



22
23
24
25
26
27
28
# File 'lib/activepayment/gateway_base.rb', line 22

def url
  if  self.mode.blank? || self.mode.eql?('demo') || self.mode.eql?('test')
    URI.parse self.test_url
  else
    URI.parse self.live_url
  end
end