module CsobPaymentGateway

Constants

BASE_PATH
VERSION

Public Class Methods

configuration() click to toggle source
# File lib/csob_payment_gateway/config.rb, line 10
def self.configuration
  @configuration ||= Configuration.new
end
configure() { |configuration| ... } click to toggle source
# File lib/csob_payment_gateway/config.rb, line 6
def self.configure
  yield configuration
end
configure_from_rails() click to toggle source
# File lib/csob_payment_gateway/config.rb, line 31
def self.configure_from_rails
 path = ::Rails.root.join("config", "csob.yml")
   configure_from_yaml(path) if File.exists?(path)

   env = if defined?(::Rails) && ::Rails.respond_to?(:env)
           ::Rails.env.to_sym
         elsif defined?(::RAILS_ENV)
           ::RAILS_ENV.to_sym
         end
   configuration.environment ||= (env == :production) ? :production : :test

   warn "CSOB Payment Gateway wasnt properly configured." if CsobPaymentGateway.configuration.merchant_id.blank?
   configuration
 end
configure_from_yaml(path) click to toggle source
# File lib/csob_payment_gateway/config.rb, line 14
def self.configure_from_yaml(path)
  yaml = YAML.load_file(path)
  return unless yaml

  configuration.merchant_id = yaml["merchant_id"]
  configuration.gateway_url = yaml["gateway_url"]
  configuration.return_url = yaml["return_url"]
  configuration.public_key = yaml["public_key"]
  configuration.private_key = yaml["private_key"]
  configuration.currency = yaml["currency"]
  configuration.return_method_post = yaml["return_method_post"]
  configuration.close_payment = yaml["close_payment"]
  configuration.keys_directory = yaml["keys_directory"]

  configuration
end