Class: ActiveMerchant::Billing::IdealResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/active_merchant_ideal/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.

Instance Method Summary collapse

Constructor Details

#initialize(response_body, options = {}) ⇒ IdealResponse

Returns a new instance of IdealResponse.



15
16
17
18
19
# File 'lib/active_merchant_ideal/ideal_response.rb', line 15

def initialize(response_body, options = {})
  @response = REXML::Document.new(response_body).root
  @success = !error_occured?
  @test = options[:test]
end

Instance Method Details

#consumer_error_messageObject

Returns a consumer friendly error message.



27
28
29
# File 'lib/active_merchant_ideal/ideal_response.rb', line 27

def consumer_error_message
  text('//Error/consumerMessage') unless success?
end

#error_codeObject

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.



123
124
125
# File 'lib/active_merchant_ideal/ideal_response.rb', line 123

def error_code
  text('//errorCode') unless success?
end

#error_detailsObject

Returns details on the error if available.



32
33
34
# File 'lib/active_merchant_ideal/ideal_response.rb', line 32

def error_details
  text('//Error/errorDetail') unless success?
end

#error_messageObject

Returns a technical error message.



22
23
24
# File 'lib/active_merchant_ideal/ideal_response.rb', line 22

def error_message
  text('//Error/errorMessage') unless success?
end

#error_typeObject

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



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/active_merchant_ideal/ideal_response.rb', line 46

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