Class: AbnAmro::Internetkassa

Inherits:
Object
  • Object
show all
Defined in:
lib/abn-amro/internetkassa.rb,
lib/abn-amro/internetkassa/helpers.rb,
lib/abn-amro/internetkassa/response.rb,
lib/abn-amro/internetkassa/response_codes.rb

Defined Under Namespace

Modules: Helpers Classes: Response

Constant Summary collapse

MANDATORY_VALUES =
%w{ merchant_id order_id amount currency language }
DEFAULT_VALUES =
{ :currency => 'EUR', :language => 'nl_NL' }
PRODUCTION_URL =
"https://internetkassa.abnamro.nl/ncol/prod/orderstandard.asp"
TEST_URL =
"https://internetkassa.abnamro.nl/ncol/test/orderstandard.asp"

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Internetkassa

Returns a new instance of Internetkassa.



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/abn-amro/internetkassa.rb', line 36

def initialize(params = {})
  @params = {}
  
  DEFAULT_VALUES.merge(params).each do |k,v|
    if respond_to?("#{k}=")
      send("#{k}=", v)
    else
      @params[k] = v
    end
  end
end

Class Attribute Details

.pspidObject Also known as: merchant_id

Returns the value of attribute pspid.



8
9
10
# File 'lib/abn-amro/internetkassa.rb', line 8

def pspid
  @pspid
end

.shasignObject Also known as: passphrase

Returns the value of attribute shasign.



8
9
10
# File 'lib/abn-amro/internetkassa.rb', line 8

def shasign
  @shasign
end

.testObject

Returns the value of attribute test.



8
9
10
# File 'lib/abn-amro/internetkassa.rb', line 8

def test
  @test
end

Instance Attribute Details

#accept_urlObject

Returns the value of attribute accept_url.



33
34
35
# File 'lib/abn-amro/internetkassa.rb', line 33

def accept_url
  @accept_url
end

#amountObject

Returns the value of attribute amount.



32
33
34
# File 'lib/abn-amro/internetkassa.rb', line 32

def amount
  @amount
end

#cancel_urlObject

Returns the value of attribute cancel_url.



33
34
35
# File 'lib/abn-amro/internetkassa.rb', line 33

def cancel_url
  @cancel_url
end

#currencyObject

Returns the value of attribute currency.



32
33
34
# File 'lib/abn-amro/internetkassa.rb', line 32

def currency
  @currency
end

#decline_urlObject

Returns the value of attribute decline_url.



33
34
35
# File 'lib/abn-amro/internetkassa.rb', line 33

def decline_url
  @decline_url
end

#descriptionObject

Returns the value of attribute description.



32
33
34
# File 'lib/abn-amro/internetkassa.rb', line 32

def description
  @description
end

#endpoint_paramsObject

Returns the value of attribute endpoint_params.



34
35
36
# File 'lib/abn-amro/internetkassa.rb', line 34

def endpoint_params
  @endpoint_params
end

#exception_urlObject

Returns the value of attribute exception_url.



33
34
35
# File 'lib/abn-amro/internetkassa.rb', line 33

def exception_url
  @exception_url
end

#languageObject

Returns the value of attribute language.



32
33
34
# File 'lib/abn-amro/internetkassa.rb', line 32

def language
  @language
end

#order_idObject

Returns the value of attribute order_id.



32
33
34
# File 'lib/abn-amro/internetkassa.rb', line 32

def order_id
  @order_id
end

#paramsObject (readonly)

Returns the value of attribute params.



30
31
32
# File 'lib/abn-amro/internetkassa.rb', line 30

def params
  @params
end

#url_variableObject

Returns the value of attribute url_variable.



34
35
36
# File 'lib/abn-amro/internetkassa.rb', line 34

def url_variable
  @url_variable
end

Class Method Details

.service_urlObject



20
21
22
# File 'lib/abn-amro/internetkassa.rb', line 20

def service_url
  test? ? TEST_URL : PRODUCTION_URL
end

.test?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/abn-amro/internetkassa.rb', line 16

def test?
  @test
end

Instance Method Details

#dataObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/abn-amro/internetkassa.rb', line 54

def data
  verify_values!
  @params.merge(
    :PSPID        => merchant_id,
    :orderID      => @order_id,
    :amount       => @amount,
    :currency     => @currency,
    :language     => @language,
    :COM          => @description,
    :SHASign      => signature,
    :PARAMVAR     => @url_variable,
    :PARAMPLUS    => url_encoded_endpoint_params,
    :accepturl    => @accept_url,
    :declineurl   => @decline_url,
    :exceptionurl => @exception_url,
    :cancelurl    => @cancel_url
  ).delete_if { |key, value| value.nil? || value.to_s.empty? }
end

#endpoint_url=(url) ⇒ Object

Shortcut which sets the accept_url, decline_url, cancel_url, exception_url, and cancel_url to the specified url.



50
51
52
# File 'lib/abn-amro/internetkassa.rb', line 50

def endpoint_url=(url)
  @accept_url = @decline_url = @exception_url = @cancel_url = url
end