Class: Ideal::StatusResponse
Overview
An instance of StatusResponse is returned from Gateway#capture which returns whether or not the transaction that was started with Gateway#setup_purchase was successful.
It takes care of checking if the message was authentic by verifying the the message and its signature against the iDEAL certificate.
If success? returns false
because the authenticity wasn’t verified there will be no error_code, error_message, and error_type. Use verified? to check if the authenticity has been verified.
Instance Attribute Summary
Attributes inherited from Response
Instance Method Summary collapse
-
#consumer_account_number ⇒ Object
Returns the bankaccount number when the transaction was successful.
-
#consumer_city ⇒ Object
Returns the city on the bankaccount of the customer when the transaction was successful.
-
#consumer_name ⇒ Object
Returns the name on the bankaccount of the customer when the transaction was successful.
-
#initialize(response_body, options = {}) ⇒ StatusResponse
constructor
A new instance of StatusResponse.
-
#status ⇒ Object
Returns the status message, which is one of:
:success
,:cancelled
,:expired
,:open
, or:failure
. -
#verified? ⇒ Boolean
Returns whether or not the authenticity of the message could be verified.
Methods inherited from Response
#consumer_error_message, #error_code, #error_details, #error_message, #error_type, #success?, #test?
Constructor Details
#initialize(response_body, options = {}) ⇒ StatusResponse
Returns a new instance of StatusResponse.
183 184 185 186 |
# File 'lib/ideal/response.rb', line 183 def initialize(response_body, = {}) super @success = transaction_successful? end |
Instance Method Details
#consumer_account_number ⇒ Object
Returns the bankaccount number when the transaction was successful.
204 205 206 |
# File 'lib/ideal/response.rb', line 204 def consumer_account_number text('//consumerAccountNumber') end |
#consumer_city ⇒ Object
Returns the city on the bankaccount of the customer when the transaction was successful.
216 217 218 |
# File 'lib/ideal/response.rb', line 216 def consumer_city text('//consumerCity') end |
#consumer_name ⇒ Object
Returns the name on the bankaccount of the customer when the transaction was successful.
210 211 212 |
# File 'lib/ideal/response.rb', line 210 def consumer_name text('//consumerName') end |
#status ⇒ Object
Returns the status message, which is one of: :success
, :cancelled
, :expired
, :open
, or :failure
.
191 192 193 194 |
# File 'lib/ideal/response.rb', line 191 def status status = text('//status') status.downcase.to_sym unless (status.strip == '') end |
#verified? ⇒ Boolean
Returns whether or not the authenticity of the message could be verified.
198 199 200 201 |
# File 'lib/ideal/response.rb', line 198 def verified? @verified ||= Ideal::Gateway.ideal_certificate.public_key. verify(OpenSSL::Digest::SHA1.new, signature, ) end |