Class: WirecardCheckoutPage::CheckedResponse

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/wirecard_checkout_page/checked_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#stringify_keys

Constructor Details

#initialize(params) ⇒ CheckedResponse

Returns a new instance of CheckedResponse.



5
6
7
# File 'lib/wirecard_checkout_page/checked_response.rb', line 5

def initialize(params)
  @params = stringify_keys(params).freeze
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



9
10
11
# File 'lib/wirecard_checkout_page/checked_response.rb', line 9

def params
  @params
end

Instance Method Details

#messageObject



19
20
21
# File 'lib/wirecard_checkout_page/checked_response.rb', line 19

def message
  @params['message']
end

#success?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/wirecard_checkout_page/checked_response.rb', line 15

def success?
  valid? && @params['paymentState'] == 'SUCCESS'
end

#valid?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/wirecard_checkout_page/checked_response.rb', line 11

def valid?
  WirecardCheckoutPage::ResponseChecksum.new(@params).valid?
end