Class: Adyen::Configuration
- Inherits:
-
Object
- Object
- Adyen::Configuration
- Defined in:
- lib/adyen/configuration.rb
Constant Summary collapse
- LIVE_RAILS_ENVIRONMENTS =
The Rails environment for which to use to Adyen “live” environment.
['production']
Instance Attribute Summary collapse
-
#api_password ⇒ String
The password that’s used to authenticate for the Adyen SOAP services.
-
#api_username ⇒ String
The username that’s used to authenticate for the Adyen SOAP services.
-
#cse_public_key ⇒ String
The client-side encryption public key that is used to encrypt payment forms.
-
#default_api_params ⇒ Hash
Default arguments that will be used for every API call.
-
#default_form_params ⇒ Hash
Default arguments that will be used in every HTML form.
-
#default_skin ⇒ String
Name of the default skin for HPP requests.
-
#form_skins ⇒ Hash
Returns all registered skins and their accompanying skin code and shared secret.
-
#ipn_password ⇒ String
Password used to authenticate notification requests together with ‘
ipn_username
’ configuration attribute. -
#ipn_username ⇒ String
Username that’s set in Notification settings screen in Adyen PSP system and used by notification service to authenticate instant payment notification requests.
-
#payment_flow ⇒ String
The payment flow page type that’s used to choose the payment process.
-
#payment_flow_domain ⇒ String
The payment flow domain that’s used to choose the payment process.
Instance Method Summary collapse
-
#autodetect_environment ⇒ 'test', 'live'
Autodetects the Adyen environment based on the RAILS_ENV constant.
-
#environment(override = nil) ⇒ 'test', 'live'
Returns the current Adyen environment, either test or live.
-
#environment=(env) ⇒ Object
Setter voor the current Adyen environment.
-
#form_skin_by_code(skin_code) ⇒ Hash?
Returns skin information by skin code.
-
#form_skin_by_name(skin_name) ⇒ Hash?
Returns a skin information by name.
-
#form_skin_shared_secret_by_code(skin_code) ⇒ String?
Returns the shared secret belonging to a skin.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#register_form_skin(name, skin_code, shared_secret, default_form_params = {}) ⇒ Object
Registers a skin for later use.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
3 4 5 6 7 8 9 |
# File 'lib/adyen/configuration.rb', line 3 def initialize @default_api_params = {} @default_form_params = {} @form_skins = {} @payment_flow = :select @environment = nil end |
Instance Attribute Details
#api_password ⇒ String
The password that’s used to authenticate for the Adyen SOAP services. You can configure it in the user management tool of the merchant area.
72 73 74 |
# File 'lib/adyen/configuration.rb', line 72 def api_password @api_password end |
#api_username ⇒ String
The username that’s used to authenticate for the Adyen SOAP services. It should look something like ‘[email protected]+’
66 67 68 |
# File 'lib/adyen/configuration.rb', line 66 def api_username @api_username end |
#cse_public_key ⇒ String
The client-side encryption public key that is used to encrypt payment forms. You can find the key on the webservice user page in the Adyen settings.
87 88 89 |
# File 'lib/adyen/configuration.rb', line 87 def cse_public_key @cse_public_key end |
#default_api_params ⇒ Hash
Default arguments that will be used for every API call. You can override these default values by passing a diffferent value to the service class’s constructor.
81 82 83 |
# File 'lib/adyen/configuration.rb', line 81 def default_api_params @default_api_params end |
#default_form_params ⇒ Hash
Default arguments that will be used in every HTML form.
95 96 97 |
# File 'lib/adyen/configuration.rb', line 95 def default_form_params @default_form_params end |
#default_skin ⇒ String
Name of the default skin for HPP requests.
100 101 102 |
# File 'lib/adyen/configuration.rb', line 100 def default_skin @default_skin end |
#form_skins ⇒ Hash
Returns all registered skins and their accompanying skin code and shared secret.
120 121 122 |
# File 'lib/adyen/configuration.rb', line 120 def form_skins @form_skins end |
#ipn_password ⇒ String
Password used to authenticate notification requests together with ‘ipn_username
’ configuration attribute.
111 112 113 |
# File 'lib/adyen/configuration.rb', line 111 def ipn_password @ipn_password end |
#ipn_username ⇒ String
Username that’s set in Notification settings screen in Adyen PSP system and used by notification service to authenticate instant payment notification requests.
106 107 108 |
# File 'lib/adyen/configuration.rb', line 106 def ipn_username @ipn_username end |
#payment_flow ⇒ String
The payment flow page type that’s used to choose the payment process
52 53 54 |
# File 'lib/adyen/configuration.rb', line 52 def payment_flow @payment_flow end |
#payment_flow_domain ⇒ String
The payment flow domain that’s used to choose the payment process
60 61 62 |
# File 'lib/adyen/configuration.rb', line 60 def payment_flow_domain @payment_flow_domain end |
Instance Method Details
#autodetect_environment ⇒ 'test', 'live'
Autodetects the Adyen environment based on the RAILS_ENV constant.
34 35 36 37 38 39 40 41 42 |
# File 'lib/adyen/configuration.rb', line 34 def autodetect_environment rails_env = if defined?(::Rails) && ::Rails.respond_to?(:env) ::Rails.env.to_s elsif defined?(::RAILS_ENV) ::RAILS_ENV.to_s end LIVE_RAILS_ENVIRONMENTS.include?(rails_env) ? 'live' : 'test' end |
#environment(override = nil) ⇒ 'test', 'live'
Returns the current Adyen environment, either test or live.
It will return the override
value if set, it will return the value set using Adyen.configuration.environment= otherwise. If this value also isn’t set, the environment is determined with autodetect_environment.
28 29 30 |
# File 'lib/adyen/configuration.rb', line 28 def environment(override = nil) override || @environment || autodetect_environment end |
#environment=(env) ⇒ Object
Setter voor the current Adyen environment.
16 17 18 |
# File 'lib/adyen/configuration.rb', line 16 def environment=(env) @environment = env end |
#form_skin_by_code(skin_code) ⇒ Hash?
Returns skin information by skin code.
165 166 167 |
# File 'lib/adyen/configuration.rb', line 165 def form_skin_by_code(skin_code) @form_skins.values.find { |skin| skin[:skin_code] == skin_code } end |
#form_skin_by_name(skin_name) ⇒ Hash?
Returns a skin information by name.
156 157 158 |
# File 'lib/adyen/configuration.rb', line 156 def form_skin_by_name(skin_name) @form_skins[skin_name.to_sym] end |
#form_skin_shared_secret_by_code(skin_code) ⇒ String?
Returns the shared secret belonging to a skin.
174 175 176 177 178 |
# File 'lib/adyen/configuration.rb', line 174 def form_skin_shared_secret_by_code(skin_code) if skin = form_skin_by_code(skin_code) skin[:shared_secret] end end |
#register_form_skin(name, skin_code, shared_secret, default_form_params = {}) ⇒ Object
Registers a skin for later use.
You can store a skin using a self defined symbol. Once the skin is registered, you can refer to it using this symbol instead of the hard-to-remember skin code. Moreover, the skin’s shared_secret will be looked up automatically for calculting signatures.
148 149 150 |
# File 'lib/adyen/configuration.rb', line 148 def register_form_skin(name, skin_code, shared_secret, default_form_params = {}) @form_skins[name.to_sym] = { :name => name.to_sym, :skin_code => skin_code, :shared_secret => shared_secret, :default_form_params => default_form_params} end |