module Vtweb::Config

Constants

BILLING_DIFFERENT_WITH_SHIPPING

Params Config

GET_TOKENS_URL
REDIRECTION_URL
VTWEB_SERVER

Server

Public Class Methods

included(mod) click to toggle source
# File lib/vtweb/config.rb, line 15
    def Config.included(mod)
      class <<self
        template = {
          'merchant_id' => nil,
          'merchant_hash_key' => nil,
          'finish_payment_return_url' => nil,
          'unfinish_payment_return_url' => nil,
          'error_payment_return_url' => nil,
          'vtweb_server' => nil
        }
        
        @@config_env = ::Object.const_defined?(:Rails) ? Rails.env : "development"
        @@config = File.exists?("./config/vtweb.yml") ? YAML.load_file("./config/vtweb.yml") : {}
        @@config['development'] = {} if !@@config['development']
        @@config['production' ] = {} if !@@config['production']
        @@config['development'] = template.clone.merge(@@config['development'])
        @@config['production']  = template.clone.merge(@@config['production'])
      end

      mod.instance_eval <<CODE

      def self.config_env=(env)
        @@config_env = env
      end

      def self.config
        @@config[@@config_env]
      end 
CODE

    end