Module: Vtweb::Config

Included in:
Client
Defined in:
lib/vtweb/config.rb

Constant Summary collapse

VTWEB_SERVER =

Server

"https://vtweb.veritrans.co.id"
GET_TOKENS_URL =
"/v1/tokens"
REDIRECTION_URL =
"/v1/payments"
BILLING_DIFFERENT_WITH_SHIPPING =

Params Config

'0'
PAYMENT_TYPE =
"01"

Class Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/vtweb/config.rb', line 16

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 "\n  def self.config_env=(env)\n    @@config_env = env\n  end\n\n  def self.config\n    @@config[@@config_env]\n  end \n"

end