Module: Workarea::CyberSource

Defined in:
lib/workarea/cyber_source.rb,
lib/workarea/cyber_source/engine.rb,
lib/workarea/cyber_source/version.rb

Defined Under Namespace

Classes: Engine

Constant Summary collapse

VERSION =
"1.0.3"

Class Method Summary collapse

Class Method Details

.auto_configure_gatewayObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/workarea/cyber_source.rb', line 12

def self.auto_configure_gateway
  if Rails.application.secrets.cyber_source.present?
    if ENV["HTTP_PROXY"].present?
      uri = URI.parse(ENV["HTTP_PROXY"])
      ActiveMerchant::Billing::CyberSourceGateway.proxy_address = uri.host
      ActiveMerchant::Billing::CyberSourceGateway.proxy_port = uri.port
    end

    self.gateway = ActiveMerchant::Billing::CyberSourceGateway.new(
      Rails.application.secrets.cyber_source.deep_symbolize_keys
    )
  else
    self.gateway = ActiveMerchant::Billing::BogusCyberSourceGateway.new
  end
end

.gatewayObject



28
29
30
# File 'lib/workarea/cyber_source.rb', line 28

def self.gateway
  Workarea.config.gateways.credit_card
end

.gateway=(gateway) ⇒ Object



32
33
34
# File 'lib/workarea/cyber_source.rb', line 32

def self.gateway=(gateway)
  Workarea.config.gateways.credit_card = gateway
end