Sha256: a397dd7a538b8f0ca413fb199506d3efbee97c38ca3059b29697b81c6cd5cf6d

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

require 'logger'

module Killbill::PaypalExpress
  mattr_reader :logger
  mattr_reader :config
  mattr_reader :gateway
  mattr_reader :paypal_sandbox_url
  mattr_reader :paypal_production_url
  mattr_reader :initialized
  mattr_reader :test

  def self.initialize!(config_file='paypal_express.yml', logger=Logger.new(STDOUT))
    @@logger = logger

    @@config = Properties.new(config_file)
    @@config.parse!

    @@paypal_sandbox_url = @@config[:paypal][:sandbox_url] || 'https://www.sandbox.paypal.com/cgi-bin/webscr'
    @@paypal_production_url = @@config[:paypal][:production_url] || 'https://www.paypal.com/cgi-bin/webscr'
    @@test = @@config[:paypal][:test]

    @@gateway = Killbill::PaypalExpress::Gateway.instance
    @@gateway.configure(@@config[:paypal])

    if defined?(JRUBY_VERSION)
      # See https://github.com/jruby/activerecord-jdbc-adapter/issues/302
      require 'jdbc/mysql'
      Jdbc::MySQL.load_driver(:require) if Jdbc::MySQL.respond_to?(:load_driver)
    end

    ActiveRecord::Base.establish_connection(@@config[:database])

    @@initialized = true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
killbill-paypal-express-1.0.2 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.0.1 lib/paypal_express/config/configuration.rb