PageRenderTime 49ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/test/test_active_merchant_ideal.rb

https://github.com/dusdanig/active_merchant_ideal
Ruby | 704 lines | 652 code | 41 blank | 11 comment | 0 complexity | 3473de5d1458131493a9ea5cb197742f MD5 | raw file
  1. require File.dirname(__FILE__) + '/helper'
  2. module IdealTestCases
  3. # This method is called at the end of the file when all fixture data has been loaded.
  4. def self.setup_ideal_gateway!
  5. ActiveMerchant::Billing::IdealGateway.class_eval do
  6. self.merchant_id = '123456789'
  7. self.passphrase = 'passphrase'
  8. self.private_key = PRIVATE_KEY
  9. self.private_certificate = PRIVATE_CERTIFICATE
  10. self.ideal_certificate = IDEAL_CERTIFICATE
  11. self.test_url = "https://idealtest.example.com:443/ideal/iDeal"
  12. self.live_url = "https://ideal.example.com:443/ideal/iDeal"
  13. end
  14. end
  15. VALID_PURCHASE_OPTIONS = {
  16. :issuer_id => '0001',
  17. :expiration_period => 'PT10M',
  18. :return_url => 'http://return_to.example.com',
  19. :order_id => '12345678901',
  20. :description => 'A classic Dutch windmill',
  21. :entrance_code => '1234'
  22. }
  23. ###
  24. #
  25. # Actual test cases
  26. #
  27. class ClassMethodsTest < Test::Unit::TestCase
  28. def test_merchant_id
  29. assert_equal IdealGateway.merchant_id, '123456789'
  30. end
  31. def test_private_certificate_returns_a_loaded_Certificate_instance
  32. assert_equal IdealGateway.private_certificate.to_text,
  33. OpenSSL::X509::Certificate.new(PRIVATE_CERTIFICATE).to_text
  34. end
  35. def test_private_key_returns_a_loaded_PKey_RSA_instance
  36. assert_equal IdealGateway.private_key.to_text,
  37. OpenSSL::PKey::RSA.new(PRIVATE_KEY, IdealGateway.passphrase).to_text
  38. end
  39. def test_ideal_certificate_returns_a_loaded_Certificate_instance
  40. assert_equal IdealGateway.ideal_certificate.to_text,
  41. OpenSSL::X509::Certificate.new(IDEAL_CERTIFICATE).to_text
  42. end
  43. end
  44. class GeneralTest < Test::Unit::TestCase
  45. def setup
  46. @gateway = IdealGateway.new
  47. end
  48. def test_optional_initialization_options
  49. assert_equal 0, IdealGateway.new.sub_id
  50. assert_equal 1, IdealGateway.new(:sub_id => 1).sub_id
  51. end
  52. def test_returns_the_test_url_when_in_the_test_env
  53. @gateway.stubs(:test?).returns(true)
  54. assert_equal IdealGateway.test_url, @gateway.send(:acquirer_url)
  55. end
  56. def test_returns_the_live_url_when_not_in_the_test_env
  57. @gateway.stubs(:test?).returns(false)
  58. assert_equal IdealGateway.live_url, @gateway.send(:acquirer_url)
  59. end
  60. def test_returns_created_at_timestamp
  61. timestamp = '2001-12-17T09:30:47.000Z'
  62. Time.any_instance.stubs(:gmtime).returns(DateTime.parse(timestamp))
  63. assert_equal timestamp, @gateway.send(:created_at_timestamp)
  64. end
  65. def test_ruby_to_java_keys_conversion
  66. keys = [
  67. [:acquirer_transaction_request, 'AcquirerTrxReq'],
  68. [:acquirer_status_request, 'AcquirerStatusReq'],
  69. [:directory_request, 'DirectoryReq'],
  70. [:created_at, 'createDateTimeStamp'],
  71. [:issuer, 'Issuer'],
  72. [:merchant, 'Merchant'],
  73. [:transaction, 'Transaction'],
  74. [:issuer_id, 'issuerID'],
  75. [:merchant_id, 'merchantID'],
  76. [:sub_id, 'subID'],
  77. [:token_code, 'tokenCode'],
  78. [:merchant_return_url, 'merchantReturnURL'],
  79. [:purchase_id, 'purchaseID'],
  80. [:expiration_period, 'expirationPeriod'],
  81. [:entrance_code, 'entranceCode']
  82. ]
  83. keys.each do |key, expected_key|
  84. assert_equal expected_key, @gateway.send(:javaize_key, key)
  85. end
  86. end
  87. def test_does_not_convert_unknown_key_to_java_key
  88. assert_equal 'not_a_registered_key', @gateway.send(:javaize_key, :not_a_registered_key)
  89. end
  90. def test_token_generation
  91. expected_token = Digest::SHA1.hexdigest(OpenSSL::X509::Certificate.new(PRIVATE_CERTIFICATE).to_der).upcase
  92. assert_equal expected_token, @gateway.send(:token)
  93. end
  94. def test_token_code_generation
  95. message = "Top\tsecret\tman.\nI could tell you, but then I'd have to kill you…"
  96. stripped_message = message.gsub(/\s/m, '')
  97. sha1 = OpenSSL::Digest::SHA1.new
  98. OpenSSL::Digest::SHA1.stubs(:new).returns(sha1)
  99. signature = IdealGateway.private_key.sign(sha1, stripped_message)
  100. encoded_signature = Base64.encode64(signature).strip.gsub(/\n/, '')
  101. assert_equal encoded_signature, @gateway.send(:token_code, message)
  102. end
  103. def test_posts_data_with_ssl_to_acquirer_url_and_return_the_correct_response
  104. IdealResponse.expects(:new).with('response', :test => true)
  105. @gateway.expects(:ssl_post).with(@gateway.acquirer_url, 'data').returns('response')
  106. @gateway.send(:post_data, 'data', IdealResponse)
  107. @gateway.stubs(:test?).returns(false)
  108. IdealResponse.expects(:new).with('response', :test => false)
  109. @gateway.expects(:ssl_post).with(@gateway.acquirer_url, 'data').returns('response')
  110. @gateway.send(:post_data, 'data', IdealResponse)
  111. end
  112. end
  113. class XMLBuildingTest < Test::Unit::TestCase
  114. def setup
  115. @gateway = IdealGateway.new
  116. end
  117. def test_contains_correct_info_in_root_node
  118. expected_xml = Builder::XmlMarkup.new
  119. expected_xml.instruct!
  120. expected_xml.tag!('AcquirerTrxReq', 'xmlns' => IdealGateway::XML_NAMESPACE, 'version' => IdealGateway::API_VERSION) {}
  121. assert_equal expected_xml.target!, @gateway.send(:xml_for, :acquirer_transaction_request, [])
  122. end
  123. def test_creates_correct_xml_with_java_keys_from_array_with_ruby_keys
  124. expected_xml = Builder::XmlMarkup.new
  125. expected_xml.instruct!
  126. expected_xml.tag!('AcquirerTrxReq', 'xmlns' => IdealGateway::XML_NAMESPACE, 'version' => IdealGateway::API_VERSION) do
  127. expected_xml.tag!('a_parent') do
  128. expected_xml.tag!('createDateTimeStamp', '2009-01-26')
  129. end
  130. end
  131. assert_equal expected_xml.target!, @gateway.send(:xml_for, :acquirer_transaction_request, [[:a_parent, [[:created_at, '2009-01-26']]]])
  132. end
  133. end
  134. class RequestBodyBuildingTest < Test::Unit::TestCase
  135. def setup
  136. @gateway = IdealGateway.new
  137. @gateway.stubs(:created_at_timestamp).returns('created_at_timestamp')
  138. @gateway.stubs(:token).returns('the_token')
  139. @gateway.stubs(:token_code)
  140. @transaction_id = '0001023456789112'
  141. end
  142. def test_build_transaction_request_body_raises_ArgumentError_with_missing_required_options
  143. options = VALID_PURCHASE_OPTIONS.dup
  144. options.keys.each do |key|
  145. options.delete(key)
  146. assert_raise(ArgumentError) do
  147. @gateway.send(:build_transaction_request_body, 100, options)
  148. end
  149. end
  150. end
  151. def test_valid_with_valid_options
  152. assert_not_nil @gateway.send(:build_transaction_request_body, 4321, VALID_PURCHASE_OPTIONS)
  153. end
  154. def test_checks_that_fields_are_not_too_long
  155. assert_raise ArgumentError do
  156. @gateway.send(:build_transaction_request_body, 1234567890123, VALID_PURCHASE_OPTIONS) # 13 chars
  157. end
  158. [
  159. [:order_id, '12345678901234567'], # 17 chars,
  160. [:description, '123456789012345678901234567890123'], # 33 chars
  161. [:entrance_code, '12345678901234567890123456789012345678901'] # 41
  162. ].each do |key, value|
  163. options = VALID_PURCHASE_OPTIONS.dup
  164. options[key] = value
  165. assert_raise ArgumentError do
  166. @gateway.send(:build_transaction_request_body, 4321, options)
  167. end
  168. end
  169. end
  170. def test_checks_that_fields_do_not_contain_diacritical_characters
  171. assert_raise ArgumentError do
  172. @gateway.send(:build_transaction_request_body, 'graphème', VALID_PURCHASE_OPTIONS)
  173. end
  174. [:order_id, :description, :entrance_code].each do |key, value|
  175. options = VALID_PURCHASE_OPTIONS.dup
  176. options[key] = 'graphème'
  177. assert_raise ArgumentError do
  178. @gateway.send(:build_transaction_request_body, 4321, options)
  179. end
  180. end
  181. end
  182. def test_builds_a_transaction_request_body
  183. money = 4321
  184. message = 'created_at_timestamp' +
  185. VALID_PURCHASE_OPTIONS[:issuer_id] +
  186. IdealGateway.merchant_id +
  187. @gateway.sub_id.to_s +
  188. VALID_PURCHASE_OPTIONS[:return_url] +
  189. VALID_PURCHASE_OPTIONS[:order_id] +
  190. money.to_s +
  191. IdealGateway::CURRENCY +
  192. IdealGateway::LANGUAGE +
  193. VALID_PURCHASE_OPTIONS[:description] +
  194. VALID_PURCHASE_OPTIONS[:entrance_code]
  195. @gateway.expects(:token_code).with(message).returns('the_token_code')
  196. @gateway.expects(:xml_for).with(:acquirer_transaction_request, [
  197. [:created_at, 'created_at_timestamp'],
  198. [:issuer, [[:issuer_id, VALID_PURCHASE_OPTIONS[:issuer_id]]]],
  199. [:merchant, [
  200. [:merchant_id, IdealGateway.merchant_id],
  201. [:sub_id, @gateway.sub_id],
  202. [:authentication, IdealGateway::AUTHENTICATION_TYPE],
  203. [:token, 'the_token'],
  204. [:token_code, 'the_token_code'],
  205. [:merchant_return_url, VALID_PURCHASE_OPTIONS[:return_url]]
  206. ]],
  207. [:transaction, [
  208. [:purchase_id, VALID_PURCHASE_OPTIONS[:order_id]],
  209. [:amount, money],
  210. [:currency, IdealGateway::CURRENCY],
  211. [:expiration_period, VALID_PURCHASE_OPTIONS[:expiration_period]],
  212. [:language, IdealGateway::LANGUAGE],
  213. [:description, VALID_PURCHASE_OPTIONS[:description]],
  214. [:entrance_code, VALID_PURCHASE_OPTIONS[:entrance_code]]
  215. ]]
  216. ])
  217. @gateway.send(:build_transaction_request_body, money, VALID_PURCHASE_OPTIONS)
  218. end
  219. def test_builds_a_directory_request_body
  220. message = 'created_at_timestamp' + IdealGateway.merchant_id + @gateway.sub_id.to_s
  221. @gateway.expects(:token_code).with(message).returns('the_token_code')
  222. @gateway.expects(:xml_for).with(:directory_request, [
  223. [:created_at, 'created_at_timestamp'],
  224. [:merchant, [
  225. [:merchant_id, IdealGateway.merchant_id],
  226. [:sub_id, @gateway.sub_id],
  227. [:authentication, IdealGateway::AUTHENTICATION_TYPE],
  228. [:token, 'the_token'],
  229. [:token_code, 'the_token_code']
  230. ]]
  231. ])
  232. @gateway.send(:build_directory_request_body)
  233. end
  234. def test_builds_a_status_request_body_raises_ArgumentError_with_missing_required_options
  235. assert_raise(ArgumentError) do
  236. @gateway.send(:build_status_request_body, {})
  237. end
  238. end
  239. def test_builds_a_status_request_body
  240. options = { :transaction_id => @transaction_id }
  241. message = 'created_at_timestamp' + IdealGateway.merchant_id + @gateway.sub_id.to_s + options[:transaction_id]
  242. @gateway.expects(:token_code).with(message).returns('the_token_code')
  243. @gateway.expects(:xml_for).with(:acquirer_status_request, [
  244. [:created_at, 'created_at_timestamp'],
  245. [:merchant, [
  246. [:merchant_id, IdealGateway.merchant_id],
  247. [:sub_id, @gateway.sub_id],
  248. [:authentication, IdealGateway::AUTHENTICATION_TYPE],
  249. [:token, 'the_token'],
  250. [:token_code, 'the_token_code']
  251. ]],
  252. [:transaction, [
  253. [:transaction_id, options[:transaction_id]]
  254. ]],
  255. ])
  256. @gateway.send(:build_status_request_body, options)
  257. end
  258. end
  259. class GeneralResponseTest < Test::Unit::TestCase
  260. def test_resturns_if_it_is_a_test_request
  261. assert IdealResponse.new(DIRECTORY_RESPONSE_WITH_MULTIPLE_ISSUERS, :test => true).test?
  262. assert !IdealResponse.new(DIRECTORY_RESPONSE_WITH_MULTIPLE_ISSUERS, :test => false).test?
  263. assert !IdealResponse.new(DIRECTORY_RESPONSE_WITH_MULTIPLE_ISSUERS).test?
  264. end
  265. end
  266. class SuccessfulResponseTest < Test::Unit::TestCase
  267. def setup
  268. @response = IdealResponse.new(DIRECTORY_RESPONSE_WITH_MULTIPLE_ISSUERS)
  269. end
  270. def test_initializes_with_only_response_body
  271. assert_equal REXML::Document.new(DIRECTORY_RESPONSE_WITH_MULTIPLE_ISSUERS).root.to_s,
  272. @response.instance_variable_get(:@response).to_s
  273. end
  274. def test_successful
  275. assert @response.success?
  276. end
  277. def test_returns_no_error_messages
  278. assert_nil @response.error_message
  279. end
  280. def test_returns_no_error_code
  281. assert_nil @response.error_code
  282. end
  283. end
  284. class ErrorResponseTest < Test::Unit::TestCase
  285. def setup
  286. @response = IdealResponse.new(ERROR_RESPONSE)
  287. end
  288. def test_unsuccessful
  289. assert !@response.success?
  290. end
  291. def test_returns_error_messages
  292. assert_equal 'Failure in system', @response.error_message
  293. assert_equal 'System generating error: issuer', @response.error_details
  294. assert_equal 'Betalen met iDEAL is nu niet mogelijk.', @response.consumer_error_message
  295. end
  296. def test_returns_error_code
  297. assert_equal 'SO1000', @response.error_code
  298. end
  299. def test_returns_error_type
  300. [
  301. ['IX1000', :xml],
  302. ['SO1000', :system],
  303. ['SE2000', :security],
  304. ['BR1200', :value],
  305. ['AP1000', :application]
  306. ].each do |code, type|
  307. @response.stubs(:error_code).returns(code)
  308. assert_equal type, @response.error_type
  309. end
  310. end
  311. end
  312. class DirectoryTest < Test::Unit::TestCase
  313. def setup
  314. @gateway = IdealGateway.new
  315. end
  316. def test_returns_a_list_with_only_one_issuer
  317. @gateway.stubs(:build_directory_request_body).returns('the request body')
  318. @gateway.expects(:ssl_post).with(@gateway.acquirer_url, 'the request body').returns(DIRECTORY_RESPONSE_WITH_ONE_ISSUER)
  319. expected_issuers = [{ :id => '1006', :name => 'ABN AMRO Bank' }]
  320. directory_response = @gateway.issuers
  321. assert_instance_of IdealDirectoryResponse, directory_response
  322. assert_equal expected_issuers, directory_response.list
  323. end
  324. def test_returns_list_of_issuers_from_response
  325. @gateway.stubs(:build_directory_request_body).returns('the request body')
  326. @gateway.expects(:ssl_post).with(@gateway.acquirer_url, 'the request body').returns(DIRECTORY_RESPONSE_WITH_MULTIPLE_ISSUERS)
  327. expected_issuers = [
  328. { :id => '1006', :name => 'ABN AMRO Bank' },
  329. { :id => '1003', :name => 'Postbank' },
  330. { :id => '1005', :name => 'Rabobank' },
  331. { :id => '1017', :name => 'Asr bank' },
  332. { :id => '1023', :name => 'Van Lanschot' }
  333. ]
  334. directory_response = @gateway.issuers
  335. assert_instance_of IdealDirectoryResponse, directory_response
  336. assert_equal expected_issuers, directory_response.list
  337. end
  338. end
  339. class SetupPurchaseTest < Test::Unit::TestCase
  340. def setup
  341. @gateway = IdealGateway.new
  342. @gateway.stubs(:build_transaction_request_body).with(4321, VALID_PURCHASE_OPTIONS).returns('the request body')
  343. @gateway.expects(:ssl_post).with(@gateway.acquirer_url, 'the request body').returns(ACQUIRER_TRANSACTION_RESPONSE)
  344. @setup_purchase_response = @gateway.setup_purchase(4321, VALID_PURCHASE_OPTIONS)
  345. end
  346. def test_setup_purchase_returns_IdealTransactionResponse
  347. assert_instance_of IdealTransactionResponse, @setup_purchase_response
  348. end
  349. def test_setup_purchase_returns_response_with_service_url
  350. assert_equal 'https://ideal.example.com/long_service_url?X009=BETAAL&X010=20', @setup_purchase_response.service_url
  351. end
  352. def test_setup_purchase_returns_response_with_transaction_and_order_ids
  353. assert_equal '0001023456789112', @setup_purchase_response.transaction_id
  354. assert_equal 'iDEAL-aankoop 21', @setup_purchase_response.order_id
  355. end
  356. end
  357. class CapturePurchaseTest < Test::Unit::TestCase
  358. def setup
  359. @gateway = IdealGateway.new
  360. @gateway.stubs(:build_status_request_body).
  361. with(:transaction_id => '0001023456789112').returns('the request body')
  362. end
  363. def test_setup_purchase_returns_IdealStatusResponse
  364. expects_request_and_returns ACQUIRER_SUCCEEDED_STATUS_RESPONSE
  365. assert_instance_of IdealStatusResponse, @gateway.capture('0001023456789112')
  366. end
  367. # Because we don't have a real private key and certificate we stub
  368. # verified? to return true. However, this is properly tested in the remote
  369. # tests.
  370. def test_capture_of_successful_payment
  371. IdealStatusResponse.any_instance.stubs(:verified?).returns(true)
  372. expects_request_and_returns ACQUIRER_SUCCEEDED_STATUS_RESPONSE
  373. capture_response = @gateway.capture('0001023456789112')
  374. assert capture_response.success?
  375. end
  376. def test_capture_of_failed_payment
  377. expects_request_and_returns ACQUIRER_FAILED_STATUS_RESPONSE
  378. capture_response = @gateway.capture('0001023456789112')
  379. assert !capture_response.success?
  380. end
  381. def test_capture_of_successful_payment_but_message_does_not_match_signature
  382. expects_request_and_returns ACQUIRER_SUCCEEDED_BUT_WRONG_SIGNATURE_STATUS_RESPONSE
  383. capture_response = @gateway.capture('0001023456789112')
  384. assert !capture_response.success?
  385. end
  386. def test_returns_status
  387. response = IdealStatusResponse.new(ACQUIRER_SUCCEEDED_STATUS_RESPONSE)
  388. [
  389. ['Success', :success],
  390. ['Cancelled', :cancelled],
  391. ['Expired', :expired],
  392. ['Open', :open],
  393. ['Failure', :failure]
  394. ].each do |raw_status, expected_status|
  395. response.stubs(:text).with("//status").returns(raw_status)
  396. assert_equal expected_status, response.status
  397. end
  398. end
  399. private
  400. def expects_request_and_returns(str)
  401. @gateway.expects(:ssl_post).with(@gateway.acquirer_url, 'the request body').returns(str)
  402. end
  403. end
  404. ###
  405. #
  406. # Fixture data
  407. #
  408. PRIVATE_CERTIFICATE = %{-----BEGIN CERTIFICATE-----
  409. MIIC+zCCAmSgAwIBAgIJALVAygHjnd8ZMA0GCSqGSIb3DQEBBQUAMF0xCzAJBgNV
  410. BAYTAk5MMRYwFAYDVQQIEw1Ob29yZC1Ib2xsYW5kMRIwEAYDVQQHEwlBbXN0ZXJk
  411. YW0xIjAgBgNVBAoTGWlERUFMIEFjdGl2ZU1lcmNoYW50IFRlc3QwHhcNMDkwMTMw
  412. MTMxNzQ5WhcNMjQxMjExMDM1MjI5WjBdMQswCQYDVQQGEwJOTDEWMBQGA1UECBMN
  413. Tm9vcmQtSG9sbGFuZDESMBAGA1UEBxMJQW1zdGVyZGFtMSIwIAYDVQQKExlpREVB
  414. TCBBY3RpdmVNZXJjaGFudCBUZXN0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
  415. gQDmBpi+RVvZBA01kdP5lV5bDzu6Jp1zy78qhxxwlG8WMdUh0Qtg0kkYmeThFPoh
  416. 2c3BYuFQ+AA6f1R0Spb+hTNrBxkZaRnHCfMMD9LXquFjJ/lvSGnwkjvBmGzyTPZ1
  417. LIunpejm8hH0MJPqpp5AIeXjp1mv7BXA9y0FqObrrLAPaQIDAQABo4HCMIG/MB0G
  418. A1UdDgQWBBTLqGWJt5+Ri6vrOpqGZhINbRtXczCBjwYDVR0jBIGHMIGEgBTLqGWJ
  419. t5+Ri6vrOpqGZhINbRtXc6FhpF8wXTELMAkGA1UEBhMCTkwxFjAUBgNVBAgTDU5v
  420. b3JkLUhvbGxhbmQxEjAQBgNVBAcTCUFtc3RlcmRhbTEiMCAGA1UEChMZaURFQUwg
  421. QWN0aXZlTWVyY2hhbnQgVGVzdIIJALVAygHjnd8ZMAwGA1UdEwQFMAMBAf8wDQYJ
  422. KoZIhvcNAQEFBQADgYEAGtgkmME9tgaxJIU3T7v1/xbKr6A/iwmt3sCmfJEl4Pty
  423. aUGaHFy1KB7xmkna8gomxMWL2zZkdv4t1iGeuVCl9n77SL3MzapotdeNNqahblcN
  424. RBshYCpWpsQQPF45/R5Xp7rXWWsjxgip7qTBNpgTx+Z/VKQpuQsFjYCYq4UCf2Y=
  425. -----END CERTIFICATE-----}
  426. PRIVATE_KEY = %{-----BEGIN RSA PRIVATE KEY-----
  427. MIICXAIBAAKBgQDmBpi+RVvZBA01kdP5lV5bDzu6Jp1zy78qhxxwlG8WMdUh0Qtg
  428. 0kkYmeThFPoh2c3BYuFQ+AA6f1R0Spb+hTNrBxkZaRnHCfMMD9LXquFjJ/lvSGnw
  429. kjvBmGzyTPZ1LIunpejm8hH0MJPqpp5AIeXjp1mv7BXA9y0FqObrrLAPaQIDAQAB
  430. AoGAfkccz0ewVoDc5424+wk/FWpVdaoBQjKWLbiiqkMygNK2mKv0PSD0M+c4OUCU
  431. 2MSDKikoXJTpOzPvny/bmLpzMMGn9YJiWEQ5WdaTdppffdylfGPBZXZkt5M9nxJA
  432. NL3fPT79R79mkCF8cgNUbLtNL4woSoFKwRHDU2CGvtTbxqkCQQD+TY1sGJv1VTQi
  433. MYYx3FlEOqw3jp/2q7QluTDDGmvmVOSFnAPfmX0rKEtnBmG4ID7IaG+IQFthDudL
  434. 3trqGQdTAkEA54+RxyCZiXDfkh23cD0QaApZaBuk6cKkx6qeFxeg1T+/idGgtWJI
  435. Qg3i9fHzOIFUXwk51R3xh5IimvMJZ9Ii0wJAb7yrsx9tB3MUoSGZkTb8kholqZOl
  436. fcEcOqcQYemuF1qdvoc6vHi4osnlt7L6JOkmLPCWcQu2GwNtZczZ65pruQJBAJ3p
  437. vbtzUuF01TKbC18Cda7N5/zkZUl5ENCNXTRYS7lBuQhuqc8okChjufSJpJlTMUuC
  438. Sis5OV5/3ROYTEC+ADsCQCwq6VQ1kXRrM+3tkMwi2rZi73dsFVuFx8crlBOmvhkD
  439. U7Ar9bW13qhBeH9px8RCRDMWTGQcxY/C/TEQc/qvhkI=
  440. -----END RSA PRIVATE KEY-----}
  441. IDEAL_CERTIFICATE = %{-----BEGIN CERTIFICATE-----
  442. MIIEAzCCA3CgAwIBAgIQMIEnzk1UPrPDLOY9dc2cUjANBgkqhkiG9w0BAQUFADBf
  443. MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXUlNBIERhdGEgU2VjdXJpdHksIEluYy4x
  444. LjAsBgNVBAsTJVNlY3VyZSBTZXJ2ZXIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw
  445. HhcNMDQwNjA4MDAwMDAwWhcNMDUwNjA4MjM1OTU5WjCBvDELMAkGA1UEBhMCTkwx
  446. FjAUBgNVBAgTDU5vb3JkLUhvbGxhbmQxEjAQBgNVBAcUCUFtc3RlcmRhbTEbMBkG
  447. A1UEChQSQUJOIEFNUk8gQmFuayBOLlYuMRYwFAYDVQQLFA1JTi9OUy9FLUlORlJB
  448. MTMwMQYDVQQLFCpUZXJtcyBvZiB1c2UgYXQgd3d3LnZlcmlzaWduLmNvbS9ycGEg
  449. KGMpMDAxFzAVBgNVBAMUDnd3dy5hYm5hbXJvLm5sMIGfMA0GCSqGSIb3DQEBAQUA
  450. A4GNADCBiQKBgQD1hPZlFD01ZdQu0GVLkUQ7tOwtVw/jmZ1Axu8v+3bxrjKX9Qi1
  451. 0w6EIadCXScDMmhCstExVptaTEQ5hG3DedV2IpMcwe93B1lfyviNYlmc/XIol1B7
  452. PM70mI9XUTYAoJpquEv8AaupRO+hgxQlz3FACHINJxEIMgdxa1iyoJfCKwIDAQAB
  453. o4IBZDCCAWAwCQYDVR0TBAIwADALBgNVHQ8EBAMCBaAwPAYDVR0fBDUwMzAxoC+g
  454. LYYraHR0cDovL2NybC52ZXJpc2lnbi5jb20vUlNBU2VjdXJlU2VydmVyLmNybDBE
  455. BgNVHSAEPTA7MDkGC2CGSAGG+EUBBxcDMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8v
  456. d3d3LnZlcmlzaWduLmNvbS9ycGEwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUF
  457. BwMCMDQGCCsGAQUFBwEBBCgwJjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AudmVy
  458. aXNpZ24uY29tMG0GCCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAh
  459. MB8wBwYFKw4DAhoEFI/l0xqGrI2Oa8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dv
  460. LnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMA0GCSqGSIb3DQEBBQUAA34AY7BYsNvj
  461. i5fjnEHPlGOd2yxseCHU54HDPPCZOoP9a9kVWGX8tuj2b1oeiOsIbI1viIo+O4eQ
  462. ilZjTJIlLOkXk6uE8vQGjZy0BUnjNPkXOQGkTyj4jDxZ2z+z9Vy8BwfothdcYbZK
  463. 48ZOp3u74DdEfQejNxBeqLODzrxQTV4=
  464. -----END CERTIFICATE-----}
  465. DIRECTORY_RESPONSE_WITH_ONE_ISSUER = %{<?xml version="1.0" encoding="UTF-8"?>
  466. <DirectoryRes xmlns="http://www.idealdesk.com/Message" version="1.1.0">
  467. <createDateTimeStamp>2001-12-17T09:30:47.0Z</createDateTimeStamp>
  468. <Acquirer>
  469. <acquirerID>0245</acquirerID>
  470. </Acquirer>
  471. <Directory>
  472. <directoryDateTimeStamp>2004-11-10T10:15:12.145Z</directoryDateTimeStamp>
  473. <Issuer>
  474. <issuerID>1006</issuerID>
  475. <issuerName>ABN AMRO Bank</issuerName>
  476. <issuerList>Short</issuerList>
  477. </Issuer>
  478. </Directory>
  479. </DirectoryRes>}
  480. DIRECTORY_RESPONSE_WITH_MULTIPLE_ISSUERS = %{<?xml version="1.0" encoding="UTF-8"?>
  481. <DirectoryRes xmlns="http://www.idealdesk.com/Message" version="1.1.0">
  482. <createDateTimeStamp>2001-12-17T09:30:47.0Z</createDateTimeStamp>
  483. <Acquirer>
  484. <acquirerID>0245</acquirerID>
  485. </Acquirer>
  486. <Directory>
  487. <directoryDateTimeStamp>2004-11-10T10:15:12.145Z</directoryDateTimeStamp>
  488. <Issuer>
  489. <issuerID>1006</issuerID>
  490. <issuerName>ABN AMRO Bank</issuerName>
  491. <issuerList>Short</issuerList>
  492. </Issuer>
  493. <Issuer>
  494. <issuerID>1003</issuerID>
  495. <issuerName>Postbank</issuerName>
  496. <issuerList>Short</issuerList>
  497. </Issuer>
  498. <Issuer>
  499. <issuerID>1005</issuerID>
  500. <issuerName>Rabobank</issuerName>
  501. <issuerList>Short</issuerList>
  502. </Issuer>
  503. <Issuer>
  504. <issuerID>1017</issuerID>
  505. <issuerName>Asr bank</issuerName>
  506. <issuerList>Long</issuerList>
  507. </Issuer>
  508. <Issuer>
  509. <issuerID>1023</issuerID>
  510. <issuerName>Van Lanschot</issuerName>
  511. <issuerList>Long</issuerList>
  512. </Issuer>
  513. </Directory>
  514. </DirectoryRes>}
  515. ACQUIRER_TRANSACTION_RESPONSE = %{<?xml version="1.0" encoding="UTF-8"?>
  516. <AcquirerTrxRes xmlns="http://www.idealdesk.com/Message" version="1.1.0">
  517. <createDateTimeStamp>2001-12-17T09:30:47.0Z</createDateTimeStamp>
  518. <Acquirer>
  519. <acquirerID>1545</acquirerID>
  520. </Acquirer>
  521. <Issuer>
  522. <issuerAuthenticationURL>https://ideal.example.com/long_service_url?X009=BETAAL&amp;X010=20</issuerAuthenticationURL>
  523. </Issuer>
  524. <Transaction>
  525. <transactionID>0001023456789112</transactionID>
  526. <purchaseID>iDEAL-aankoop 21</purchaseID>
  527. </Transaction>
  528. </AcquirerTrxRes>}
  529. ACQUIRER_SUCCEEDED_STATUS_RESPONSE = %{<?xml version="1.0" encoding="UTF-8"?>
  530. <AcquirerStatusRes xmlns="http://www.idealdesk.com/Message" version="1.1.0">
  531. <createDateTimeStamp>2001-12-17T09:30:47.0Z</createDateTimeStamp>
  532. <Acquirer>
  533. <acquirerID>1234</acquirerID>
  534. </Acquirer>
  535. <Transaction>
  536. <transactionID>0001023456789112</transactionID>
  537. <status>Success</status>
  538. <consumerName>Onderheuvel</consumerName>
  539. <consumerAccountNumber>0949298989</consumerAccountNumber>
  540. <consumerCity>DEN HAAG</consumerCity>
  541. </Transaction>
  542. <Signature>
  543. <signatureValue>db82/jpJRvKQKoiDvu33X0yoDAQpayJOaW2Y8zbR1qk1i3epvTXi+6g+QVBY93YzGv4w+Va+vL3uNmzyRjYsm2309d1CWFVsn5Mk24NLSvhYfwVHEpznyMqizALEVUNSoiSHRkZUDfXowBAyLT/tQVGbuUuBj+TKblY826nRa7U=</signatureValue>
  544. <fingerprint>1E15A00E3D7DF085768749D4ABBA3284794D8AE9</fingerprint>
  545. </Signature>
  546. </AcquirerStatusRes>}
  547. ACQUIRER_SUCCEEDED_BUT_WRONG_SIGNATURE_STATUS_RESPONSE = %{<?xml version="1.0" encoding="UTF-8"?>
  548. <AcquirerStatusRes xmlns="http://www.idealdesk.com/Message" version="1.1.0">
  549. <createDateTimeStamp>2001-12-17T09:30:47.0Z</createDateTimeStamp>
  550. <Acquirer>
  551. <acquirerID>1234</acquirerID>
  552. </Acquirer>
  553. <Transaction>
  554. <transactionID>0001023456789112</transactionID>
  555. <status>Success</status>
  556. <consumerName>Onderheuvel</consumerName>
  557. <consumerAccountNumber>0949298989</consumerAccountNumber>
  558. <consumerCity>DEN HAAG</consumerCity>
  559. </Transaction>
  560. <Signature>
  561. <signatureValue>WRONG</signatureValue>
  562. <fingerprint>1E15A00E3D7DF085768749D4ABBA3284794D8AE9</fingerprint>
  563. </Signature>
  564. </AcquirerStatusRes>}
  565. ACQUIRER_FAILED_STATUS_RESPONSE = %{<?xml version="1.0" encoding="UTF-8"?>
  566. <AcquirerStatusRes xmlns="http://www.idealdesk.com/Message" version="1.1.0">
  567. <createDateTimeStamp>2001-12-17T09:30:47.0Z</createDateTimeStamp>
  568. <Acquirer>
  569. <acquirerID>1234</acquirerID>
  570. </Acquirer>
  571. <Transaction>
  572. <transactionID>0001023456789112</transactionID>
  573. <status>Failed</status>
  574. <consumerName>Onderheuvel</consumerName>
  575. <consumerAccountNumber>0949298989</consumerAccountNumber>
  576. <consumerCity>DEN HAAG</consumerCity>
  577. </Transaction>
  578. <Signature>
  579. <signatureValue>db82/jpJRvKQKoiDvu33X0yoDAQpayJOaW2Y8zbR1qk1i3epvTXi+6g+QVBY93YzGv4w+Va+vL3uNmzyRjYsm2309d1CWFVsn5Mk24NLSvhYfwVHEpznyMqizALEVUNSoiSHRkZUDfXowBAyLT/tQVGbuUuBj+TKblY826nRa7U=</signatureValue>
  580. <fingerprint>1E15A00E3D7DF085768749D4ABBA3284794D8AE9</fingerprint>
  581. </Signature>
  582. </AcquirerStatusRes>}
  583. ERROR_RESPONSE = %{<?xml version="1.0" encoding="UTF-8"?>
  584. <ErrorRes xmlns="http://www.idealdesk.com/Message" version="1.1.0">
  585. <createDateTimeStamp>2001-12-17T09:30:47.0Z</createDateTimeStamp>
  586. <Error>
  587. <errorCode>SO1000</errorCode>
  588. <errorMessage>Failure in system</errorMessage>
  589. <errorDetail>System generating error: issuer</errorDetail>
  590. <suggestedAction></suggestedAction>
  591. <suggestedExpirationPeriod></suggestedExpirationPeriod>
  592. <consumerMessage>Betalen met iDEAL is nu niet mogelijk.</consumerMessage>
  593. </Error>
  594. </ErrorRes>}
  595. setup_ideal_gateway!
  596. end