class Adyen::Configuration

Constants

LIVE_RAILS_ENVIRONMENTS

The Rails environment for which to use to Adyen “live” environment.

Attributes

api_password[RW]

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]

api_username[RW]

The username that’s used to authenticate for the Adyen SOAP services. It should look something like ‘+ws@AndyInc.SuperShop+’

@return [String]

cse_public_key[RW]

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_api_params[RW]

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_form_params[RW]

Default arguments that will be used in every HTML form.

@example

Adyen.configuration.default_form_params[:merchant_account] = 'SuperShop'

@return [Hash]

default_skin[RW]

Name of the default skin for HPP requests.

@return [String]

form_skins[R]

Returns all registered skins and their accompanying skin code and shared secret.

@return [Hash] The hash of registered skins.

ipn_password[RW]

Password used to authenticate notification requests together with 'ipn_username' configuration attribute.

@return [String]

ipn_username[RW]

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]

merchant_specific_endpoint[RW]

TODO

payment_flow[RW]

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]

payment_flow_domain[RW]

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

new() click to toggle source
  # 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

autodetect_environment() click to toggle source

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
environment(override = nil) click to toggle source

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
environment=(env) click to toggle source

Setter voor the current Adyen environment. @param ['test', 'live'] env The Adyen environment to use

   # File lib/adyen/configuration.rb
16 def environment=(env)
17   @environment = env
18 end
form_skin_by_code(skin_code) click to toggle source

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
form_skin_by_name(skin_name) click to toggle source

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
form_skin_shared_secret_by_code(skin_code) click to toggle source

Returns the shared secret belonging to a skin.

@param [String] skin_code The skin code of the skin

@return [String, nil] The shared secret for the skin, or nil if not found.

    # File lib/adyen/configuration.rb
178 def form_skin_shared_secret_by_code(skin_code)
179   if skin = form_skin_by_code(skin_code)
180     skin[:shared_secret]
181   end
182 end
form_skins=(hash) click to toggle source

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
register_form_skin(name, skin_code, shared_secret, default_form_params = {}) click to toggle source

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