Class: Ipizza::Provider::Nordea::AuthenticationResponse

Inherits:
AuthenticationResponse show all
Defined in:
lib/ipizza/provider/nordea/authentication_response.rb

Constant Summary

Constants inherited from Response

Response::PARAM_ORDER

Instance Attribute Summary

Attributes inherited from Response

#verify_params, #verify_params_order

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ AuthenticationResponse

Returns a new instance of AuthenticationResponse.



6
7
8
# File 'lib/ipizza/provider/nordea/authentication_response.rb', line 6

def initialize(params)
  @params = params
end

Instance Method Details

#authentication_infoObject



31
32
33
# File 'lib/ipizza/provider/nordea/authentication_response.rb', line 31

def authentication_info
  @authentication_info ||= Ipizza::Authentication.new(user_name: info_name, user_id: info_social_security_id)
end

#info_nameObject



23
24
25
# File 'lib/ipizza/provider/nordea/authentication_response.rb', line 23

def info_name
  valid? ? @params['B02K_CUSTNAME'] : ''
end

#info_social_security_idObject



27
28
29
# File 'lib/ipizza/provider/nordea/authentication_response.rb', line 27

def info_social_security_id
  valid? ? @params['B02K_CUSTID'] : ''
end

#success?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/ipizza/provider/nordea/authentication_response.rb', line 15

def success?
  @valid && @params['B02K_CUSTID'].present?
end

#valid?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/ipizza/provider/nordea/authentication_response.rb', line 19

def valid?
  @valid
end

#verify(key_path) ⇒ Object



10
11
12
13
# File 'lib/ipizza/provider/nordea/authentication_response.rb', line 10

def verify(key_path)
  key = File.read(key_path).strip
  @valid = @params['B02K_MAC'] == Digest::MD5.hexdigest(mac_data_string(key)).upcase
end