Class: Transbank::Onepay::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/transbank/sdk/onepay/base.rb

Constant Summary collapse

DEFAULT_CALLBACK =

The base class for Transbank Onepay

"http://no.callback.has/been.set".freeze
DEFAULT_API_KEY =
'dKVhq1WGt_XapIYirTXNyUKoWTDFfxaEV63-O5jcsdw'.freeze
DEFAULT_SHARED_SECRET =
'?XW#WOLG##FBAGEAYSNQ5APD#JF@$AYZ'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject



86
87
88
89
# File 'lib/transbank/sdk/onepay/base.rb', line 86

def api_key
  return ENV['ONEPAY_API_KEY'] if @api_key.nil?
  @api_key
end

.app_schemeString

Returns the app_scheme failing that, the value of ENV (your env variable)



81
82
83
84
# File 'lib/transbank/sdk/onepay/base.rb', line 81

def app_scheme
  return ENV['ONEPAY_APP_SCHEME'] unless @app_scheme
  @app_scheme
end

.callback_urlString

Your callback URL, used to resume the payment process after validating with Transbank when paying on Channel::MOBILE



36
37
38
# File 'lib/transbank/sdk/onepay/base.rb', line 36

def callback_url
  @callback_url
end

.default_channelString (readonly)

The default channel. Value must be in Channel.values



56
57
58
# File 'lib/transbank/sdk/onepay/base.rb', line 56

def default_channel
  @default_channel
end

.integration_typeSymbol

The current integration type



46
47
48
# File 'lib/transbank/sdk/onepay/base.rb', line 46

def integration_type
  @integration_type
end

.integration_typesHash<String, String> (readonly)

Contains all valid integration types



26
27
28
# File 'lib/transbank/sdk/onepay/base.rb', line 26

def integration_types
  @integration_types
end

.shared_secretObject



99
100
101
102
# File 'lib/transbank/sdk/onepay/base.rb', line 99

def shared_secret
  return ENV['ONEPAY_SHARED_SECRET'] if @shared_secret.nil?
  @shared_secret
end

Class Method Details

.current_integration_type_app_keyString



64
65
66
# File 'lib/transbank/sdk/onepay/base.rb', line 64

def current_integration_type_app_key
  @app_keys[@integration_type]
end

.current_integration_type_urlString



59
60
61
# File 'lib/transbank/sdk/onepay/base.rb', line 59

def current_integration_type_url
  @integration_types[@integration_type]
end

.default_api_keyString

Returns the ‘ONEPAY_API_KEY’ env variable, or, if ONEPAY_API_KEY doesn’t exist, returns a default api key



94
95
96
97
# File 'lib/transbank/sdk/onepay/base.rb', line 94

def default_api_key
  env_api_key = ENV['ONEPAY_API_KEY']
  env_api_key.nil? ? DEFAULT_API_KEY : env_api_key
end

.default_shared_secretString

Returns the ‘ONEPAY_SHARED_SECRET’ env variable, or, if ONEPAY_SHARED_SECRET doesn’t exist, returns a default shared secret



107
108
109
110
# File 'lib/transbank/sdk/onepay/base.rb', line 107

def default_shared_secret
  env_shared_secret = ENV['ONEPAY_SHARED_SECRET']
  env_shared_secret.nil? ? DEFAULT_SHARED_SECRET : env_shared_secret
end