Class: Payzen::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/payzen/config.rb

Constant Summary collapse

DEFAULTS =
{
    target_url:       'https://secure.payzen.eu/vads-payment/',
    vads_action_mode: 'INTERACTIVE',
    vads_ctx_mode:    'TEST',
    vads_contrib:     'Wizypay',
    vads_page_action: 'PAYMENT',
    vads_return_mode: 'POST',
    vads_version:     'V2',
    vads_payment_config:  'SINGLE',
    vads_currency:    '978',
    vads_language:    'fr',
    # INTERACTIVE: card information entered in Systempay payment page
    # SILENT: card info captured in merchant's site (contract option)
    # or 'PRODUCTION'
    # or 'GET', but request in GET could be too large
    # 978 EUR; 840 USD'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



37
38
39
40
41
# File 'lib/payzen/config.rb', line 37

def initialize
  DEFAULTS.each do |k, v|
    send("#{k}=", v)
  end
end

Instance Attribute Details

#certificateObject

Returns the value of attribute certificate.



21
22
23
# File 'lib/payzen/config.rb', line 21

def certificate
  @certificate
end

#target_urlObject

Returns the value of attribute target_url.



21
22
23
# File 'lib/payzen/config.rb', line 21

def target_url
  @target_url
end

#vads_action_modeObject

Returns the value of attribute vads_action_mode.



21
22
23
# File 'lib/payzen/config.rb', line 21

def vads_action_mode
  @vads_action_mode
end

#vads_contribObject

Returns the value of attribute vads_contrib.



21
22
23
# File 'lib/payzen/config.rb', line 21

def vads_contrib
  @vads_contrib
end

#vads_ctx_modeObject

Returns the value of attribute vads_ctx_mode.



21
22
23
# File 'lib/payzen/config.rb', line 21

def vads_ctx_mode
  @vads_ctx_mode
end

#vads_currencyObject

Returns the value of attribute vads_currency.



21
22
23
# File 'lib/payzen/config.rb', line 21

def vads_currency
  @vads_currency
end

#vads_languageObject

Returns the value of attribute vads_language.



21
22
23
# File 'lib/payzen/config.rb', line 21

def vads_language
  @vads_language
end

#vads_page_actionObject

Returns the value of attribute vads_page_action.



21
22
23
# File 'lib/payzen/config.rb', line 21

def vads_page_action
  @vads_page_action
end

#vads_payment_configObject

Returns the value of attribute vads_payment_config.



21
22
23
# File 'lib/payzen/config.rb', line 21

def vads_payment_config
  @vads_payment_config
end

#vads_return_modeObject

Returns the value of attribute vads_return_mode.



21
22
23
# File 'lib/payzen/config.rb', line 21

def vads_return_mode
  @vads_return_mode
end

#vads_shop_nameObject

Returns the value of attribute vads_shop_name.



21
22
23
# File 'lib/payzen/config.rb', line 21

def vads_shop_name
  @vads_shop_name
end

#vads_shop_urlObject

Returns the value of attribute vads_shop_url.



21
22
23
# File 'lib/payzen/config.rb', line 21

def vads_shop_url
  @vads_shop_url
end

#vads_site_idObject

Returns the value of attribute vads_site_id.



21
22
23
# File 'lib/payzen/config.rb', line 21

def vads_site_id
  @vads_site_id
end

#vads_validation_modeObject

Returns the value of attribute vads_validation_mode.



21
22
23
# File 'lib/payzen/config.rb', line 21

def vads_validation_mode
  @vads_validation_mode
end

#vads_versionObject

Returns the value of attribute vads_version.



21
22
23
# File 'lib/payzen/config.rb', line 21

def vads_version
  @vads_version
end

Instance Method Details

#vads_paramsObject



43
44
45
46
47
# File 'lib/payzen/config.rb', line 43

def vads_params
  Hash[instance_variables.
           select { |v| v.to_s.starts_with? '@vads_' }.
           map { |v| [v[1..-1].to_sym, instance_variable_get(v)] }]
end