Class: Ideal::Response
- Inherits:
-
Object
- Object
- Ideal::Response
- Defined in:
- lib/ideal/response.rb
Overview
The base class for all iDEAL response classes.
Note that if the iDEAL system is under load it will not allow more then two retries per request.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
-
#consumer_error_message ⇒ Object
Returns a consumer friendly error message.
-
#error_code ⇒ Object
Returns the code of the error that occured.
-
#error_details ⇒ Object
Returns details on the error if available.
-
#error_message ⇒ Object
Returns a technical error message.
-
#error_type ⇒ Object
Returns an error type inflected from the first two characters of the error code.
-
#initialize(response_body, options = {}) ⇒ Response
constructor
A new instance of Response.
-
#success? ⇒ Boolean
Returns whether the request was a success.
-
#test? ⇒ Boolean
Returns whether we’re running in test mode.
Constructor Details
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
14 15 16 |
# File 'lib/ideal/response.rb', line 14 def response @response end |
Instance Method Details
#consumer_error_message ⇒ Object
Returns a consumer friendly error message.
38 39 40 |
# File 'lib/ideal/response.rb', line 38 def text('//Error/consumerMessage') unless success? end |
#error_code ⇒ Object
Returns the code of the error that occured.
Codes
IX: Invalid XML and all related problems
Such as incorrect encoding, invalid version, or otherwise unreadable:
-
IX1000
- Received XML not well-formed. -
IX1100
- Received XML not valid. -
IX1200
- Encoding type not UTF-8. -
IX1300
- XML version number invalid. -
IX1400
- Unknown message. -
IX1500
- Mandatory main value missing. (Merchant ID ?) -
IX1600
- Mandatory value missing.
SO: System maintenance or failure
The errors that are communicated in the event of system maintenance or system failure. Also covers the situation where new requests are no longer being accepted but requests already submitted will be dealt with (until a certain time):
-
SO1000
- Failure in system. -
SO1200
- System busy. Try again later. -
SO1400
- Unavailable due to maintenance.
SE: Security and authentication errors
Incorrect authentication methods and expired certificates:
-
SE2000
- Authentication error. -
SE2100
- Authentication method not supported. -
SE2700
- Invalid electronic signature.
BR: Field errors
Extra information on incorrect fields:
-
BR1200
- iDEAL version number invalid. -
BR1210
- Value contains non-permitted character. -
BR1220
- Value too long. -
BR1230
- Value too short. -
BR1240
- Value too high. -
BR1250
- Value too low. -
BR1250
- Unknown entry in list. -
BR1270
- Invalid date/time. -
BR1280
- Invalid URL.
AP: Application errors
Errors relating to IDs, account numbers, time zones, transactions:
-
AP1000
- Acquirer ID unknown. -
AP1100
- Merchant ID unknown. -
AP1200
- Issuer ID unknown. -
AP1300
- Sub ID unknown. -
AP1500
- Merchant ID not active. -
AP2600
- Transaction does not exist. -
AP2620
- Transaction already submitted. -
AP2700
- Bank account number not 11-proof. -
AP2900
- Selected currency not supported. -
AP2910
- Maximum amount exceeded. (Detailed record states the maximum amount). -
AP2915
- Amount too low. (Detailed record states the minimum amount). -
AP2920
- Please adjust expiration period. See suggested expiration period.
134 135 136 |
# File 'lib/ideal/response.rb', line 134 def error_code text('//errorCode') unless success? end |
#error_details ⇒ Object
Returns details on the error if available.
43 44 45 |
# File 'lib/ideal/response.rb', line 43 def error_details text('//Error/errorDetail') unless success? end |
#error_message ⇒ Object
Returns a technical error message.
33 34 35 |
# File 'lib/ideal/response.rb', line 33 def text('//Error/errorMessage') unless success? end |
#error_type ⇒ Object
Returns an error type inflected from the first two characters of the error code. See error_code for a full list of errors.
Error code to type mappings:
-
IX
-:xml
-
SO
-:system
-
SE
-:security
-
BR
-:value
-
AP
-:application
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/ideal/response.rb', line 57 def error_type unless success? case error_code[0,2] when 'IX' then :xml when 'SO' then :system when 'SE' then :security when 'BR' then :value when 'AP' then :application end end end |
#success? ⇒ Boolean
Returns whether the request was a success
28 29 30 |
# File 'lib/ideal/response.rb', line 28 def success? @success end |
#test? ⇒ Boolean
Returns whether we’re running in test mode
23 24 25 |
# File 'lib/ideal/response.rb', line 23 def test? @test end |