class Adyen::Configuration
Constants
- LIVE_RAILS_ENVIRONMENTS
The Rails environment for which to use to
Adyen
“live” environment.
Attributes
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.
@return [String]
The username that’s used to authenticate for the Adyen
SOAP services. It should look something like ‘+ws@AndyInc.SuperShop+’
@return [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.
@return [String]
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.
@example
Adyen.configuration.default_api_params[:merchant_account] = 'SuperShop'
@return [Hash]
Default arguments that will be used in every HTML form.
@example
Adyen.configuration.default_form_params[:merchant_account] = 'SuperShop'
@return [Hash]
Name of the default skin for HPP requests.
@return [String]
Returns all registered skins and their accompanying skin code and shared secret.
@return [Hash] The hash of registered skins.
Password used to authenticate notification requests together with 'ipn_username
' configuration attribute.
@return [String]
Username that's set in Notification settings screen in Adyen
PSP system and used by notification service to authenticate instant payment notification requests.
@return [String]
TODO
The payment flow page type that’s used to choose the payment process
@example
Adyen.configuration.payment_flow = :select Adyen.configuration.payment_flow = :pay Adyen.configuration.payment_flow = :details
@return [String]
The payment flow domain that’s used to choose the payment process
@example
Adyen.configuration.payment_flow_domain = checkout.mydomain.com
@return [String]
Public Class Methods
# File lib/adyen/configuration.rb 3 def initialize 4 @default_api_params = {} 5 @default_form_params = {} 6 @form_skins = {} 7 @payment_flow = :select 8 @environment = nil 9 end
Public Instance Methods
Autodetects the Adyen
environment based on the RAILS_ENV constant. @return ['test', 'live'] The Adyen
environment that corresponds to the Rails environment
# File lib/adyen/configuration.rb 34 def autodetect_environment 35 rails_env = if defined?(::Rails) && ::Rails.respond_to?(:env) 36 ::Rails.env.to_s 37 elsif defined?(::RAILS_ENV) 38 ::RAILS_ENV.to_s 39 end 40 41 LIVE_RAILS_ENVIRONMENTS.include?(rails_env) ? 'live' : 'test' 42 end
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.
@param ['test', 'live'] override An environment to override the default with. @return ['test', 'live'] The Adyen
environment that is currently being used.
# File lib/adyen/configuration.rb 28 def environment(override = nil) 29 override || @environment || autodetect_environment 30 end
Returns skin information by skin code.
@param [String] skin_code The code of the skin.
@return [Hash, nil] A hash with the skin information, or nil if not found.
# File lib/adyen/configuration.rb 169 def form_skin_by_code(skin_code) 170 @form_skins.values.find { |skin| skin[:skin_code] == skin_code } 171 end
Returns a skin information by name.
@param [Symbol] skin_name The name of the skin @return [Hash, nil] A hash with the skin information, or nil if not found.
# File lib/adyen/configuration.rb 160 def form_skin_by_name(skin_name) 161 @form_skins[skin_name.to_sym] 162 end
Sets the registered skins.
@param [Hash<Symbol, Hash>] hash A hash with the skin name as key and the skin parameter hash
(which should include +:skin_code+ and +:shared_secret+) as value.
@see Adyen::Configuration.register_form_skin
# File lib/adyen/configuration.rb 132 def form_skins=(hash) 133 @form_skins = hash.inject({}) do |skins, (name, skin)| 134 skins[name.to_sym] = skin.merge(:name => name.to_sym) 135 skins 136 end 137 end
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.
@example
Adyen::Configuration.register_form_skin(:my_skin, 'dsfH67PO', 'Dfs*7uUln9')
@param [Symbol] name The name of the skin. @param [String] skin_code The skin code for this skin, as defined by Adyen
. @param [String] shared_secret The shared secret used for signature calculation.
# File lib/adyen/configuration.rb 152 def register_form_skin(name, skin_code, shared_secret, default_form_params = {}) 153 @form_skins[name.to_sym] = { :name => name.to_sym, :skin_code => skin_code, :shared_secret => shared_secret, :default_form_params => default_form_params} 154 end