Class: Adyen::Configuration
- Inherits:
-
Object
- Object
- Adyen::Configuration
- Defined in:
- lib/adyen/configuration.rb
Constant Summary
- LIVE_RAILS_ENVIRONMENTS =
The Rails environment for which to use to Adyen "live" environment.
['production']
Instance Attribute Summary (collapse)
-
- (String) api_password
The password that???s used to authenticate for the Adyen SOAP services.
-
- (String) api_username
The username that???s used to authenticate for the Adyen SOAP services.
-
- (Hash) default_api_params
Default arguments that will be used for every API call.
-
- (Hash) default_form_params
Default arguments that will be used for in every HTML form.
-
- (Hash) form_skins
Returns all registered skins and their accompanying skin code and shared secret.
-
- (String) ipn_password
Password used to authenticate notification requests together with 'ipn_username' configuration attribute.
-
- (String) ipn_username
Username that's set in Notification settings screen in Adyen PSP system and used by notification service to authenticate instant payment notification requests.
-
- (String) payment_flow
The payment flow page type that???s used to choose the payment process.
-
- (String) payment_flow_domain
The payment flow domain that???s used to choose the payment process.
Instance Method Summary (collapse)
-
- ('test', 'live') autodetect_environment
Autodetects the Adyen environment based on the RAILS_ENV constant.
-
- ('test', 'live') environment(override = nil)
Returns the current Adyen environment, either test or live.
-
- (Object) environment=(env)
Setter voor the current Adyen environment.
-
- (Hash?) form_skin_by_code(skin_code)
Returns skin information by code code.
-
- (Hash?) form_skin_by_name(skin_name)
Returns a skin information by name.
-
- (String?) form_skin_shared_secret_by_code(skin_code)
Returns the shared secret belonging to a skin.
-
- (Configuration) initialize
constructor
A new instance of Configuration.
-
- (Object) register_form_skin(name, skin_code, shared_secret, default_form_params = {})
Registers a skin for later use.
Constructor Details
- (Configuration) initialize
A new instance of Configuration
3 4 5 6 7 8 |
# File 'lib/adyen/configuration.rb', line 3 def initialize @default_api_params = {} @default_form_params = {} @form_skins = {} @payment_flow = :select end |
Instance Attribute Details
- (String) api_password
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.
71 72 73 |
# File 'lib/adyen/configuration.rb', line 71 def api_password @api_password end |
- (String) api_username
The username that???s used to authenticate for the Adyen SOAP services. It should look something like ???+ws@AndyInc.SuperShop+???
65 66 67 |
# File 'lib/adyen/configuration.rb', line 65 def api_username @api_username end |
- (Hash) default_api_params
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.
80 81 82 |
# File 'lib/adyen/configuration.rb', line 80 def default_api_params @default_api_params end |
- (Hash) default_form_params
Default arguments that will be used for in every HTML form.
88 89 90 |
# File 'lib/adyen/configuration.rb', line 88 def default_form_params @default_form_params end |
- (Hash) form_skins
Returns all registered skins and their accompanying skin code and shared secret.
108 109 110 |
# File 'lib/adyen/configuration.rb', line 108 def form_skins @form_skins end |
- (String) ipn_password
Password used to authenticate notification requests together with 'ipn_username' configuration attribute.
99 100 101 |
# File 'lib/adyen/configuration.rb', line 99 def ipn_password @ipn_password end |
- (String) ipn_username
Username that's set in Notification settings screen in Adyen PSP system and used by notification service to authenticate instant payment notification requests.
94 95 96 |
# File 'lib/adyen/configuration.rb', line 94 def ipn_username @ipn_username end |
- (String) payment_flow
The payment flow page type that???s used to choose the payment process
51 52 53 |
# File 'lib/adyen/configuration.rb', line 51 def payment_flow @payment_flow end |
- (String) payment_flow_domain
The payment flow domain that???s used to choose the payment process
59 60 61 |
# File 'lib/adyen/configuration.rb', line 59 def payment_flow_domain @payment_flow_domain end |
Instance Method Details
- ('test', 'live') autodetect_environment
Autodetects the Adyen environment based on the RAILS_ENV constant.
33 34 35 36 37 38 39 40 41 |
# File 'lib/adyen/configuration.rb', line 33 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 |
- ('test', 'live') environment(override = nil)
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.
27 28 29 |
# File 'lib/adyen/configuration.rb', line 27 def environment(override = nil) override || @environment || autodetect_environment end |
- (Object) environment=(env)
Setter voor the current Adyen environment.
15 16 17 |
# File 'lib/adyen/configuration.rb', line 15 def environment=(env) @environment = env end |
- (Hash?) form_skin_by_code(skin_code)
Returns skin information by code code.
153 154 155 156 157 |
# File 'lib/adyen/configuration.rb', line 153 def form_skin_by_code(skin_code) if skin = @form_skins.detect { |(name, skin)| skin[:skin_code] == skin_code } skin.last end end |
- (Hash?) form_skin_by_name(skin_name)
Returns a skin information by name.
144 145 146 |
# File 'lib/adyen/configuration.rb', line 144 def form_skin_by_name(skin_name) @form_skins[skin_name.to_sym] end |
- (String?) form_skin_shared_secret_by_code(skin_code)
Returns the shared secret belonging to a skin.
164 165 166 167 168 |
# File 'lib/adyen/configuration.rb', line 164 def form_skin_shared_secret_by_code(skin_code) if skin = form_skin_by_code(skin_code) skin[:shared_secret] end end |
- (Object) register_form_skin(name, skin_code, shared_secret, default_form_params = {})
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.
136 137 138 |
# File 'lib/adyen/configuration.rb', line 136 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 |