activemerchant-realex3ds 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Gemfile.lock +60 -0
- data/MIT-LICENSE +20 -0
- data/README.md +25 -0
- data/Rakefile +58 -0
- data/activemerchant-realex3ds.gemspec +28 -0
- data/lib/active_merchant/billing/gateways/realex3ds.rb +610 -0
- data/lib/active_merchant/billing/gateways/realex3ds_development.rb +111 -0
- data/test/assert_equal_xml.rb +5 -0
- data/test/comm_stub.rb +40 -0
- data/test/fixtures.yml +71 -0
- data/test/remote/gateways/remote_realex3ds_test.rb +476 -0
- data/test/test_helper.rb +265 -0
- data/test/unit/gateways/realex3ds_test.rb +975 -0
- metadata +149 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,265 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
4
|
+
$:.unshift File.expand_path('..', __FILE__)
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'rubygems'
|
8
|
+
require 'bundler'
|
9
|
+
Bundler.setup
|
10
|
+
rescue LoadError => e
|
11
|
+
puts "Error loading bundler (#{e.message}): \"gem install bundler\" for bundler support."
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'test/unit'
|
15
|
+
require 'money'
|
16
|
+
require 'mocha/version'
|
17
|
+
if(Mocha::VERSION.split(".")[1].to_i < 12)
|
18
|
+
require 'mocha'
|
19
|
+
else
|
20
|
+
require 'mocha/setup'
|
21
|
+
end
|
22
|
+
require 'yaml'
|
23
|
+
require 'json'
|
24
|
+
require 'active_merchant'
|
25
|
+
require 'comm_stub'
|
26
|
+
require 'assert_equal_xml'
|
27
|
+
|
28
|
+
require 'active_support/core_ext/integer/time'
|
29
|
+
require 'active_support/core_ext/numeric/time'
|
30
|
+
require 'active_support/core_ext/hash/slice'
|
31
|
+
|
32
|
+
begin
|
33
|
+
require 'active_support/core_ext/time/acts_like'
|
34
|
+
rescue LoadError
|
35
|
+
end
|
36
|
+
|
37
|
+
begin
|
38
|
+
gem 'actionpack'
|
39
|
+
rescue LoadError
|
40
|
+
raise StandardError, "The view tests need ActionPack installed as gem to run"
|
41
|
+
end
|
42
|
+
|
43
|
+
require 'action_controller'
|
44
|
+
require "action_view/template"
|
45
|
+
begin
|
46
|
+
require 'active_support/core_ext/module/deprecation'
|
47
|
+
require 'action_dispatch/testing/test_process'
|
48
|
+
rescue LoadError
|
49
|
+
require 'action_controller/test_process'
|
50
|
+
end
|
51
|
+
require 'active_merchant/billing/integrations/action_view_helper'
|
52
|
+
|
53
|
+
ActiveMerchant::Billing::Base.mode = :test
|
54
|
+
|
55
|
+
if ENV['DEBUG_ACTIVE_MERCHANT'] == 'true'
|
56
|
+
require 'logger'
|
57
|
+
ActiveMerchant::Billing::Gateway.logger = Logger.new(STDOUT)
|
58
|
+
ActiveMerchant::Billing::Gateway.wiredump_device = STDOUT
|
59
|
+
end
|
60
|
+
|
61
|
+
# Test gateways
|
62
|
+
class SimpleTestGateway < ActiveMerchant::Billing::Gateway
|
63
|
+
end
|
64
|
+
|
65
|
+
class SubclassGateway < SimpleTestGateway
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
module ActiveMerchant
|
70
|
+
module Assertions
|
71
|
+
AssertionClass = RUBY_VERSION > '1.9' ? MiniTest::Assertion : Test::Unit::AssertionFailedError
|
72
|
+
|
73
|
+
def assert_field(field, value)
|
74
|
+
clean_backtrace do
|
75
|
+
assert_equal value, @helper.fields[field]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Allows the testing of you to check for negative assertions:
|
80
|
+
#
|
81
|
+
# # Instead of
|
82
|
+
# assert !something_that_is_false
|
83
|
+
#
|
84
|
+
# # Do this
|
85
|
+
# assert_false something_that_should_be_false
|
86
|
+
#
|
87
|
+
# An optional +msg+ parameter is available to help you debug.
|
88
|
+
def assert_false(boolean, message = nil)
|
89
|
+
message = build_message message, '<?> is not false or nil.', boolean
|
90
|
+
|
91
|
+
clean_backtrace do
|
92
|
+
assert_block message do
|
93
|
+
not boolean
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# A handy little assertion to check for a successful response:
|
99
|
+
#
|
100
|
+
# # Instead of
|
101
|
+
# assert_success response
|
102
|
+
#
|
103
|
+
# # DRY that up with
|
104
|
+
# assert_success response
|
105
|
+
#
|
106
|
+
# A message will automatically show the inspection of the response
|
107
|
+
# object if things go afoul.
|
108
|
+
def assert_success(response)
|
109
|
+
clean_backtrace do
|
110
|
+
assert response.success?, "Response failed: #{response.inspect}"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# The negative of +assert_success+
|
115
|
+
def assert_failure(response)
|
116
|
+
clean_backtrace do
|
117
|
+
assert_false response.success?, "Response expected to fail: #{response.inspect}"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def assert_valid(validateable)
|
122
|
+
clean_backtrace do
|
123
|
+
assert validateable.valid?, "Expected to be valid"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def assert_not_valid(validateable)
|
128
|
+
clean_backtrace do
|
129
|
+
assert_false validateable.valid?, "Expected to not be valid"
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def assert_deprecation_warning(message, target)
|
134
|
+
target.expects(:deprecated).with(message)
|
135
|
+
yield
|
136
|
+
end
|
137
|
+
|
138
|
+
def assert_no_deprecation_warning(target)
|
139
|
+
target.expects(:deprecated).never
|
140
|
+
yield
|
141
|
+
end
|
142
|
+
|
143
|
+
private
|
144
|
+
def clean_backtrace(&block)
|
145
|
+
yield
|
146
|
+
rescue AssertionClass => e
|
147
|
+
path = File.expand_path(__FILE__)
|
148
|
+
raise AssertionClass, e.message, e.backtrace.reject { |line| File.expand_path(line) =~ /#{path}/ }
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
module Fixtures
|
153
|
+
HOME_DIR = RUBY_PLATFORM =~ /mswin32/ ? ENV['HOMEPATH'] : ENV['HOME'] unless defined?(HOME_DIR)
|
154
|
+
LOCAL_CREDENTIALS = File.join(HOME_DIR.to_s, '.active_merchant/fixtures.yml') unless defined?(LOCAL_CREDENTIALS)
|
155
|
+
DEFAULT_CREDENTIALS = File.join(File.dirname(__FILE__), 'fixtures.yml') unless defined?(DEFAULT_CREDENTIALS)
|
156
|
+
|
157
|
+
private
|
158
|
+
def credit_card(number = '4242424242424242', options = {})
|
159
|
+
defaults = {
|
160
|
+
:number => number,
|
161
|
+
:month => 9,
|
162
|
+
:year => Time.now.year + 1,
|
163
|
+
:first_name => 'Longbob',
|
164
|
+
:last_name => 'Longsen',
|
165
|
+
:verification_value => '123',
|
166
|
+
:brand => 'visa'
|
167
|
+
}.update(options)
|
168
|
+
|
169
|
+
Billing::CreditCard.new(defaults)
|
170
|
+
end
|
171
|
+
|
172
|
+
def check(options = {})
|
173
|
+
defaults = {
|
174
|
+
:name => 'Jim Smith',
|
175
|
+
:bank_name => 'Bank of Elbonia',
|
176
|
+
:routing_number => '244183602',
|
177
|
+
:account_number => '15378535',
|
178
|
+
:account_holder_type => 'personal',
|
179
|
+
:account_type => 'checking',
|
180
|
+
:number => '1'
|
181
|
+
}.update(options)
|
182
|
+
|
183
|
+
Billing::Check.new(defaults)
|
184
|
+
end
|
185
|
+
|
186
|
+
def address(options = {})
|
187
|
+
{
|
188
|
+
:name => 'Jim Smith',
|
189
|
+
:address1 => '1234 My Street',
|
190
|
+
:address2 => 'Apt 1',
|
191
|
+
:company => 'Widgets Inc',
|
192
|
+
:city => 'Ottawa',
|
193
|
+
:state => 'ON',
|
194
|
+
:zip => 'K1C2N6',
|
195
|
+
:country => 'CA',
|
196
|
+
:phone => '(555)555-5555',
|
197
|
+
:fax => '(555)555-6666'
|
198
|
+
}.update(options)
|
199
|
+
end
|
200
|
+
|
201
|
+
def all_fixtures
|
202
|
+
@@fixtures ||= load_fixtures
|
203
|
+
end
|
204
|
+
|
205
|
+
def fixtures(key)
|
206
|
+
data = all_fixtures[key] || raise(StandardError, "No fixture data was found for '#{key}'")
|
207
|
+
|
208
|
+
data.dup
|
209
|
+
end
|
210
|
+
|
211
|
+
def load_fixtures
|
212
|
+
[DEFAULT_CREDENTIALS, LOCAL_CREDENTIALS].inject({}) do |credentials, file_name|
|
213
|
+
if File.exists?(file_name)
|
214
|
+
yaml_data = YAML.load(File.read(file_name))
|
215
|
+
credentials.merge!(symbolize_keys(yaml_data))
|
216
|
+
end
|
217
|
+
credentials
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
def symbolize_keys(hash)
|
222
|
+
return unless hash.is_a?(Hash)
|
223
|
+
|
224
|
+
hash.symbolize_keys!
|
225
|
+
hash.each{|k,v| symbolize_keys(v)}
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
Test::Unit::TestCase.class_eval do
|
231
|
+
include ActiveMerchant::Billing
|
232
|
+
include ActiveMerchant::Assertions
|
233
|
+
include ActiveMerchant::Utils
|
234
|
+
include ActiveMerchant::Fixtures
|
235
|
+
end
|
236
|
+
|
237
|
+
module ActionViewHelperTestHelper
|
238
|
+
|
239
|
+
def self.included(base)
|
240
|
+
base.send(:include, ActiveMerchant::Billing::Integrations::ActionViewHelper)
|
241
|
+
base.send(:include, ActionView::Helpers::FormHelper)
|
242
|
+
base.send(:include, ActionView::Helpers::FormTagHelper)
|
243
|
+
base.send(:include, ActionView::Helpers::UrlHelper)
|
244
|
+
base.send(:include, ActionView::Helpers::TagHelper)
|
245
|
+
base.send(:include, ActionView::Helpers::CaptureHelper)
|
246
|
+
base.send(:include, ActionView::Helpers::TextHelper)
|
247
|
+
base.send(:attr_accessor, :output_buffer)
|
248
|
+
end
|
249
|
+
|
250
|
+
def setup
|
251
|
+
@controller = Class.new do
|
252
|
+
attr_reader :url_for_options
|
253
|
+
def url_for(options, *parameters_for_method_reference)
|
254
|
+
@url_for_options = options
|
255
|
+
end
|
256
|
+
end
|
257
|
+
@controller = @controller.new
|
258
|
+
@output_buffer = ''
|
259
|
+
end
|
260
|
+
|
261
|
+
protected
|
262
|
+
def protect_against_forgery?
|
263
|
+
false
|
264
|
+
end
|
265
|
+
end
|
@@ -0,0 +1,975 @@
|
|
1
|
+
require File.expand_path('../../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
require 'digest/sha1'
|
4
|
+
require 'active_merchant/billing/gateways/realex3ds'
|
5
|
+
|
6
|
+
class RealexTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
class ActiveMerchant::Billing::Realex3dsGateway
|
9
|
+
# For the purposes of testing, lets redefine some protected methods as public.
|
10
|
+
public :build_purchase_or_authorization_request, :build_credit_request, :build_void_request,
|
11
|
+
:build_capture_request, :stringify_values, :avs_input_code, :build_cancel_card_request,
|
12
|
+
:build_new_card_request, :build_new_payee_request, :build_receipt_in_request,
|
13
|
+
:build_3d_secure_verify_signature_or_enrolled_request
|
14
|
+
end
|
15
|
+
|
16
|
+
def setup
|
17
|
+
@login = 'your_merchant_id'
|
18
|
+
@password = 'your_secret'
|
19
|
+
@account = 'your_account'
|
20
|
+
@rebate_secret = 'your_rebate_secret'
|
21
|
+
|
22
|
+
@gateway = Realex3dsGateway.new(
|
23
|
+
:login => @login,
|
24
|
+
:password => @password,
|
25
|
+
:account => @account
|
26
|
+
)
|
27
|
+
|
28
|
+
@gateway_with_account = Realex3dsGateway.new(
|
29
|
+
:login => @merchant_id,
|
30
|
+
:password => @secret,
|
31
|
+
:account => 'bill_web_cengal'
|
32
|
+
)
|
33
|
+
|
34
|
+
@credit_card = CreditCard.new(
|
35
|
+
:number => '4263971921001307',
|
36
|
+
:month => 8,
|
37
|
+
:year => 2008,
|
38
|
+
:first_name => 'Longbob',
|
39
|
+
:last_name => 'Longsen',
|
40
|
+
:type => 'visa'
|
41
|
+
)
|
42
|
+
|
43
|
+
@options = {
|
44
|
+
:order_id => '1'
|
45
|
+
}
|
46
|
+
|
47
|
+
@address = {
|
48
|
+
:name => 'Longbob Longsen',
|
49
|
+
:address1 => '123 Fake Street',
|
50
|
+
:city => 'Belfast',
|
51
|
+
:state => 'Antrim',
|
52
|
+
:country => 'Northern Ireland',
|
53
|
+
:zip => 'BT2 8XX'
|
54
|
+
}
|
55
|
+
|
56
|
+
@amount = 100
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_in_test
|
60
|
+
assert_equal :test, ActiveMerchant::Billing::Base.gateway_mode
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_successful_purchase
|
64
|
+
@gateway.expects(:ssl_post).returns(successful_purchase_response)
|
65
|
+
|
66
|
+
response = @gateway.purchase(@amount, @credit_card, @options)
|
67
|
+
assert_instance_of Response, response
|
68
|
+
assert_success response
|
69
|
+
assert response.test?
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_unsuccessful_purchase
|
73
|
+
@gateway.expects(:ssl_post).returns(unsuccessful_purchase_response)
|
74
|
+
|
75
|
+
response = @gateway.purchase(@amount, @credit_card, @options)
|
76
|
+
assert_instance_of Response, response
|
77
|
+
assert_failure response
|
78
|
+
assert response.test?
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_successful_credit
|
82
|
+
@gateway = Realex3dsGateway.new(:login => @login, :password => @password, :rebate_secret => 'xyz')
|
83
|
+
@gateway.expects(:ssl_post).returns(successful_credit_response)
|
84
|
+
|
85
|
+
response = @gateway.credit(@amount, '1234', {:order_id => '1234', :pasref => '1234', :authcode => '1234' })
|
86
|
+
assert_instance_of Response, response
|
87
|
+
assert_success response
|
88
|
+
assert response.test?
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_unsuccessful_credit
|
92
|
+
@gateway = Realex3dsGateway.new(:login => @login, :password => @password, :rebate_secret => 'xyz')
|
93
|
+
@gateway.expects(:ssl_post).returns(unsuccessful_credit_response)
|
94
|
+
|
95
|
+
response = @gateway.credit(@amount, '1234', {:order_id => '1234', :pasref => '1234', :authcode => '1234' })
|
96
|
+
assert_instance_of Response, response
|
97
|
+
assert_failure response
|
98
|
+
assert response.test?
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_supported_countries
|
102
|
+
assert_equal ['IE', 'GB'], Realex3dsGateway.supported_countries
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_supported_card_types
|
106
|
+
assert_equal [ :visa, :master, :american_express, :diners_club, :switch, :solo, :laser ], Realex3dsGateway.supported_cardtypes
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_avs_result_not_supported
|
110
|
+
@gateway.expects(:ssl_post).returns(successful_purchase_response)
|
111
|
+
|
112
|
+
response = @gateway.purchase(@amount, @credit_card, @options)
|
113
|
+
assert_nil response.avs_result['code']
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_cvv_result
|
117
|
+
@gateway.expects(:ssl_post).returns(successful_purchase_response)
|
118
|
+
|
119
|
+
response = @gateway.purchase(@amount, @credit_card, @options)
|
120
|
+
assert_equal 'M', response.cvv_result['code']
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_capture_xml
|
124
|
+
options = {
|
125
|
+
:pasref => '1234',
|
126
|
+
:order_id => '1'
|
127
|
+
}
|
128
|
+
|
129
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
130
|
+
|
131
|
+
valid_capture_xml = <<-SRC
|
132
|
+
<request timestamp="20090824160201" type="settle">
|
133
|
+
<merchantid>your_merchant_id</merchantid>
|
134
|
+
<account>your_account</account>
|
135
|
+
<orderid>1</orderid>
|
136
|
+
<pasref>1234</pasref>
|
137
|
+
<authcode>1234</authcode>
|
138
|
+
<sha1hash>4132600f1dc70333b943fc292bd0ca7d8e722f6e</sha1hash>
|
139
|
+
</request>
|
140
|
+
SRC
|
141
|
+
|
142
|
+
assert_equal_xml valid_capture_xml, @gateway.build_capture_request('1234', options)
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_purchase_xml
|
146
|
+
options = {
|
147
|
+
:order_id => '1'
|
148
|
+
}
|
149
|
+
|
150
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
151
|
+
|
152
|
+
valid_purchase_request_xml = <<-SRC
|
153
|
+
<request timestamp="20090824160201" type="auth">
|
154
|
+
<merchantid>your_merchant_id</merchantid>
|
155
|
+
<account>your_account</account>
|
156
|
+
<orderid>1</orderid>
|
157
|
+
<amount currency="EUR">100</amount>
|
158
|
+
<card>
|
159
|
+
<number>4263971921001307</number>
|
160
|
+
<expdate>0808</expdate>
|
161
|
+
<chname>Longbob Longsen</chname>
|
162
|
+
<type>VISA</type>
|
163
|
+
<issueno/>
|
164
|
+
<cvn>
|
165
|
+
<number/>
|
166
|
+
<presind/>
|
167
|
+
</cvn>
|
168
|
+
</card>
|
169
|
+
<autosettle flag="1"/>
|
170
|
+
<sha1hash>3499d7bc8dbacdcfba2286bd74916d026bae630f</sha1hash>
|
171
|
+
</request>
|
172
|
+
SRC
|
173
|
+
|
174
|
+
assert_equal_xml valid_purchase_request_xml, @gateway.build_purchase_or_authorization_request(:purchase, @amount, @credit_card, options)
|
175
|
+
end
|
176
|
+
|
177
|
+
def test_void_xml
|
178
|
+
options = {
|
179
|
+
:pasref => '1234',
|
180
|
+
:order_id => '1'
|
181
|
+
}
|
182
|
+
|
183
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
184
|
+
|
185
|
+
valid_void_request_xml = <<-SRC
|
186
|
+
<request timestamp="20090824160201" type="void">
|
187
|
+
<merchantid>your_merchant_id</merchantid>
|
188
|
+
<account>your_account</account>
|
189
|
+
<orderid>1</orderid>
|
190
|
+
<pasref>1234</pasref>
|
191
|
+
<authcode>1234</authcode>
|
192
|
+
<sha1hash>4132600f1dc70333b943fc292bd0ca7d8e722f6e</sha1hash>
|
193
|
+
</request>
|
194
|
+
SRC
|
195
|
+
|
196
|
+
assert_equal_xml valid_void_request_xml, @gateway.build_void_request('1234', options)
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_auth_xml
|
200
|
+
options = {
|
201
|
+
:order_id => '1'
|
202
|
+
}
|
203
|
+
|
204
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
205
|
+
|
206
|
+
valid_auth_request_xml = <<-SRC
|
207
|
+
<request timestamp="20090824160201" type="auth">
|
208
|
+
<merchantid>your_merchant_id</merchantid>
|
209
|
+
<account>your_account</account>
|
210
|
+
<orderid>1</orderid>
|
211
|
+
<amount currency=\"EUR\">100</amount>
|
212
|
+
<card>
|
213
|
+
<number>4263971921001307</number>
|
214
|
+
<expdate>0808</expdate>
|
215
|
+
<chname>Longbob Longsen</chname>
|
216
|
+
<type>VISA</type>
|
217
|
+
<issueno/>
|
218
|
+
<cvn>
|
219
|
+
<number/>
|
220
|
+
<presind/>
|
221
|
+
</cvn>
|
222
|
+
</card>
|
223
|
+
<autosettle flag="0"/>
|
224
|
+
<sha1hash>3499d7bc8dbacdcfba2286bd74916d026bae630f</sha1hash>
|
225
|
+
</request>
|
226
|
+
SRC
|
227
|
+
|
228
|
+
assert_equal_xml valid_auth_request_xml, @gateway.build_purchase_or_authorization_request(:authorization, @amount, @credit_card, options)
|
229
|
+
end
|
230
|
+
|
231
|
+
def test_credit_xml
|
232
|
+
gateway = Realex3dsGateway.new(:login => @login, :password => @password, :account => @account)
|
233
|
+
|
234
|
+
|
235
|
+
options = {
|
236
|
+
:pasref => '1234',
|
237
|
+
:order_id => '1'
|
238
|
+
}
|
239
|
+
|
240
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
241
|
+
|
242
|
+
valid_credit_request_xml = <<-SRC
|
243
|
+
<request timestamp="20090824160201" type="rebate">
|
244
|
+
<merchantid>your_merchant_id</merchantid>
|
245
|
+
<account>your_account</account>
|
246
|
+
<orderid>1</orderid>
|
247
|
+
<pasref>1234</pasref>
|
248
|
+
<authcode>1234</authcode>
|
249
|
+
<amount currency="EUR">100</amount>
|
250
|
+
<autosettle flag="1"/>
|
251
|
+
<sha1hash>ef0a6c485452f3f94aff336fa90c6c62993056ca</sha1hash>
|
252
|
+
</request>
|
253
|
+
SRC
|
254
|
+
|
255
|
+
assert_equal_xml valid_credit_request_xml, @gateway.build_credit_request(@amount, '1234', options)
|
256
|
+
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_credit_with_rebate_secret_xml
|
260
|
+
|
261
|
+
gateway = Realex3dsGateway.new(:login => @login, :password => @password, :account => @account, :rebate_secret => @rebate_secret)
|
262
|
+
|
263
|
+
options = {
|
264
|
+
:pasref => '1234',
|
265
|
+
:order_id => '1'
|
266
|
+
}
|
267
|
+
|
268
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
269
|
+
|
270
|
+
valid_credit_request_xml = <<-SRC
|
271
|
+
<request timestamp="20090824160201" type="rebate">
|
272
|
+
<merchantid>your_merchant_id</merchantid>
|
273
|
+
<account>your_account</account>
|
274
|
+
<orderid>1</orderid>
|
275
|
+
<pasref>1234</pasref>
|
276
|
+
<authcode>1234</authcode>
|
277
|
+
<amount currency="EUR">100</amount>
|
278
|
+
<refundhash>f94ff2a7c125a8ad87e5683114ba1e384889240e</refundhash>
|
279
|
+
<autosettle flag="1"/>
|
280
|
+
<sha1hash>ef0a6c485452f3f94aff336fa90c6c62993056ca</sha1hash>
|
281
|
+
</request>
|
282
|
+
SRC
|
283
|
+
|
284
|
+
assert_equal_xml valid_credit_request_xml, gateway.build_credit_request(@amount, '1234', options)
|
285
|
+
|
286
|
+
end
|
287
|
+
|
288
|
+
def test_stringify_values
|
289
|
+
assert_equal "timestamp.merchantid.orderid.ammount.currency.creditcard",
|
290
|
+
@gateway.stringify_values(["timestamp","merchantid", "orderid", "ammount", "currency", "creditcard"])
|
291
|
+
|
292
|
+
assert_equal "timestamp.merchantid.orderid.ammount.currency",
|
293
|
+
@gateway.stringify_values(["timestamp","merchantid", "orderid", "ammount", "currency"])
|
294
|
+
|
295
|
+
assert_equal "timestamp.merchantid.orderid",
|
296
|
+
@gateway.stringify_values(["timestamp","merchantid", "orderid"])
|
297
|
+
end
|
298
|
+
|
299
|
+
def test_should_extract_avs_input
|
300
|
+
address = {:address1 => "123 Fake Street", :zip => 'BT1 0HX'}
|
301
|
+
assert_equal "10|123", @gateway.avs_input_code(address)
|
302
|
+
end
|
303
|
+
|
304
|
+
def test_auth_with_address
|
305
|
+
@gateway.expects(:ssl_post).returns(successful_purchase_response)
|
306
|
+
|
307
|
+
options = {
|
308
|
+
:order_id => '1',
|
309
|
+
:billing_address => @address,
|
310
|
+
:shipping_address => @address
|
311
|
+
}
|
312
|
+
|
313
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
314
|
+
|
315
|
+
response = @gateway.authorize(@amount, @credit_card, options)
|
316
|
+
assert_instance_of Response, response
|
317
|
+
assert_success response
|
318
|
+
assert response.test?
|
319
|
+
|
320
|
+
end
|
321
|
+
|
322
|
+
def test_address_with_avs_code
|
323
|
+
options = {
|
324
|
+
:billing_address => @address
|
325
|
+
}
|
326
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
327
|
+
request = @gateway.build_purchase_or_authorization_request(:purchase, @amount, @credit_card, options)
|
328
|
+
|
329
|
+
avs_request = <<-SRC
|
330
|
+
<request timestamp="20090824160201" type="auth">
|
331
|
+
<merchantid>your_merchant_id</merchantid>
|
332
|
+
<account>your_account</account>
|
333
|
+
<orderid></orderid>
|
334
|
+
<amount currency="EUR">100</amount>
|
335
|
+
<card>
|
336
|
+
<number>4263971921001307</number>
|
337
|
+
<expdate>0808</expdate>
|
338
|
+
<chname>Longbob Longsen</chname>
|
339
|
+
<type>VISA</type>
|
340
|
+
<issueno/>
|
341
|
+
<cvn>
|
342
|
+
<number/>
|
343
|
+
<presind/>
|
344
|
+
</cvn>
|
345
|
+
</card>
|
346
|
+
<autosettle flag="1"/>
|
347
|
+
<sha1hash>2cf9b05d95c7a2eefc3936989b2696a189b518c9</sha1hash>
|
348
|
+
<tssinfo>
|
349
|
+
<address type="billing">
|
350
|
+
<code>28|123</code>
|
351
|
+
<country>Northern Ireland</country>
|
352
|
+
</address>
|
353
|
+
</tssinfo>
|
354
|
+
</request>
|
355
|
+
SRC
|
356
|
+
|
357
|
+
assert_equal_xml avs_request, request
|
358
|
+
end
|
359
|
+
|
360
|
+
def test_skip_avs_check
|
361
|
+
options = {
|
362
|
+
:billing_address => @address,
|
363
|
+
:skip_avs_check => true
|
364
|
+
}
|
365
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
366
|
+
request = @gateway.build_purchase_or_authorization_request(:purchase, @amount, @credit_card, options)
|
367
|
+
|
368
|
+
avs_request = <<-SRC
|
369
|
+
<request timestamp="20090824160201" type="auth">
|
370
|
+
<merchantid>your_merchant_id</merchantid>
|
371
|
+
<account>your_account</account>
|
372
|
+
<orderid></orderid>
|
373
|
+
<amount currency="EUR">100</amount>
|
374
|
+
<card>
|
375
|
+
<number>4263971921001307</number>
|
376
|
+
<expdate>0808</expdate>
|
377
|
+
<chname>Longbob Longsen</chname>
|
378
|
+
<type>VISA</type>
|
379
|
+
<issueno/>
|
380
|
+
<cvn>
|
381
|
+
<number/>
|
382
|
+
<presind/>
|
383
|
+
</cvn>
|
384
|
+
</card>
|
385
|
+
<autosettle flag="1"/>
|
386
|
+
<sha1hash>2cf9b05d95c7a2eefc3936989b2696a189b518c9</sha1hash>
|
387
|
+
<tssinfo>
|
388
|
+
<address type="billing">
|
389
|
+
<code>BT2 8XX</code>
|
390
|
+
<country>Northern Ireland</country>
|
391
|
+
</address>
|
392
|
+
</tssinfo>
|
393
|
+
</request>
|
394
|
+
SRC
|
395
|
+
|
396
|
+
assert_equal_xml avs_request, request
|
397
|
+
end
|
398
|
+
|
399
|
+
def test_verify_signature_xml
|
400
|
+
gateway = Realex3dsGateway.new(:login => @login, :password => @password, :account => @account)
|
401
|
+
|
402
|
+
|
403
|
+
options = {
|
404
|
+
:order_id => '1',
|
405
|
+
:three_d_secure_auth => {
|
406
|
+
:pa_res => 'xxxx'
|
407
|
+
}
|
408
|
+
}
|
409
|
+
|
410
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
411
|
+
|
412
|
+
valid_verify_signature_request_xml = <<-SRC
|
413
|
+
<request timestamp="20090824160201" type="3ds-verifysig">
|
414
|
+
<merchantid>your_merchant_id</merchantid>
|
415
|
+
<account>your_account</account>
|
416
|
+
<orderid>1</orderid>
|
417
|
+
<amount currency="EUR">100</amount>
|
418
|
+
<card>
|
419
|
+
<number>4263971921001307</number>
|
420
|
+
<expdate>0808</expdate>
|
421
|
+
<chname>Longbob Longsen</chname>
|
422
|
+
<type>VISA</type>
|
423
|
+
<issueno/>
|
424
|
+
<cvn>
|
425
|
+
<number/>
|
426
|
+
<presind/>
|
427
|
+
</cvn>
|
428
|
+
</card>
|
429
|
+
<pares>xxxx</pares>
|
430
|
+
<sha1hash>3499d7bc8dbacdcfba2286bd74916d026bae630f</sha1hash>
|
431
|
+
</request>
|
432
|
+
SRC
|
433
|
+
|
434
|
+
assert_equal_xml valid_verify_signature_request_xml, @gateway.build_3d_secure_verify_signature_or_enrolled_request('3ds-verifysig', @amount, @credit_card, options)
|
435
|
+
|
436
|
+
end
|
437
|
+
|
438
|
+
def test_verify_enrolled_xml
|
439
|
+
gateway = Realex3dsGateway.new(:login => @login, :password => @password, :account => @account)
|
440
|
+
|
441
|
+
|
442
|
+
options = {
|
443
|
+
:order_id => '1',
|
444
|
+
:three_d_secure_auth => {
|
445
|
+
}
|
446
|
+
}
|
447
|
+
|
448
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
449
|
+
|
450
|
+
valid_verify_signature_request_xml = <<-SRC
|
451
|
+
<request timestamp="20090824160201" type="3ds-verifyenrolled">
|
452
|
+
<merchantid>your_merchant_id</merchantid>
|
453
|
+
<account>your_account</account>
|
454
|
+
<orderid>1</orderid>
|
455
|
+
<amount currency="EUR">100</amount>
|
456
|
+
<card>
|
457
|
+
<number>4263971921001307</number>
|
458
|
+
<expdate>0808</expdate>
|
459
|
+
<chname>Longbob Longsen</chname>
|
460
|
+
<type>VISA</type>
|
461
|
+
<issueno/>
|
462
|
+
<cvn>
|
463
|
+
<number/>
|
464
|
+
<presind/>
|
465
|
+
</cvn>
|
466
|
+
</card>
|
467
|
+
<sha1hash>3499d7bc8dbacdcfba2286bd74916d026bae630f</sha1hash>
|
468
|
+
</request>
|
469
|
+
SRC
|
470
|
+
|
471
|
+
assert_equal_xml valid_verify_signature_request_xml, @gateway.build_3d_secure_verify_signature_or_enrolled_request('3ds-verifyenrolled', @amount, @credit_card, options)
|
472
|
+
|
473
|
+
end
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
def test_payee_new_xml
|
478
|
+
gateway = Realex3dsGateway.new(:login => @login, :password => @password, :account => @account)
|
479
|
+
options = {
|
480
|
+
:order_id => '1',
|
481
|
+
:user => {
|
482
|
+
:id => 1,
|
483
|
+
:first_name => 'John',
|
484
|
+
:last_name => 'Smith'
|
485
|
+
}
|
486
|
+
}
|
487
|
+
|
488
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
489
|
+
|
490
|
+
valid_new_payee_request_xml = <<-SRC
|
491
|
+
<request timestamp="20090824160201" type="payer-new">
|
492
|
+
<merchantid>your_merchant_id</merchantid>
|
493
|
+
<account>your_account</account>
|
494
|
+
<orderid>1</orderid>
|
495
|
+
<payer type="Business" ref="1">
|
496
|
+
<firstname>John</firstname>
|
497
|
+
<surname>Smith</surname>
|
498
|
+
</payer>
|
499
|
+
<sha1hash>388dd92c8b251ee8970fb4770dc0fed31aa6f1ba</sha1hash>
|
500
|
+
</request>
|
501
|
+
SRC
|
502
|
+
|
503
|
+
assert_equal_xml valid_new_payee_request_xml, @gateway.build_new_payee_request(options)
|
504
|
+
|
505
|
+
end
|
506
|
+
|
507
|
+
def test_new_card_xml
|
508
|
+
gateway = Realex3dsGateway.new(:login => @login, :password => @password, :account => @account)
|
509
|
+
options = {
|
510
|
+
:order_id => '1',
|
511
|
+
:payment_method => 'visa01',
|
512
|
+
:user => {
|
513
|
+
:id => 1,
|
514
|
+
:first_name => 'John',
|
515
|
+
:last_name => 'Smith'
|
516
|
+
}
|
517
|
+
}
|
518
|
+
|
519
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
520
|
+
|
521
|
+
valid_new_card_request_xml = <<-SRC
|
522
|
+
<request timestamp="20090824160201" type="card-new">
|
523
|
+
<merchantid>your_merchant_id</merchantid>
|
524
|
+
<account>your_account</account>
|
525
|
+
<orderid>1</orderid>
|
526
|
+
<card>
|
527
|
+
<ref>visa01</ref>
|
528
|
+
<payerref>1</payerref>
|
529
|
+
<number>4263971921001307</number>
|
530
|
+
<expdate>0808</expdate>
|
531
|
+
<chname>Longbob Longsen</chname>
|
532
|
+
<type>VISA</type>
|
533
|
+
<issueno/>
|
534
|
+
<cvn>
|
535
|
+
<number/>
|
536
|
+
<presind/>
|
537
|
+
</cvn>
|
538
|
+
</card>
|
539
|
+
<sha1hash>2b95dd150f1d7192fe1e4c2d701f826883e5956b</sha1hash>
|
540
|
+
</request>
|
541
|
+
SRC
|
542
|
+
|
543
|
+
assert_equal_xml valid_new_card_request_xml, @gateway.build_new_card_request(@credit_card, options)
|
544
|
+
|
545
|
+
end
|
546
|
+
|
547
|
+
def test_receipt_in_xml
|
548
|
+
gateway = Realex3dsGateway.new(:login => @login, :password => @password, :account => @account)
|
549
|
+
options = {
|
550
|
+
:order_id => '1',
|
551
|
+
:payment_method => 'visa01',
|
552
|
+
:user => {
|
553
|
+
:id => 1,
|
554
|
+
:first_name => 'John',
|
555
|
+
:last_name => 'Smith'
|
556
|
+
}
|
557
|
+
}
|
558
|
+
|
559
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
560
|
+
|
561
|
+
valid_receipt_in_request_xml = <<-SRC
|
562
|
+
<request timestamp="20090824160201" type="receipt-in">
|
563
|
+
<merchantid>your_merchant_id</merchantid>
|
564
|
+
<account>your_account</account>
|
565
|
+
<orderid>1</orderid>
|
566
|
+
<amount currency=\"EUR\">100</amount>
|
567
|
+
<payerref>1</payerref>
|
568
|
+
<paymentmethod>visa01</paymentmethod>
|
569
|
+
<autosettle flag="1"/>
|
570
|
+
<sha1hash>f8365c0ba649e82bed6eebc1043e6a211919676e</sha1hash>
|
571
|
+
</request>
|
572
|
+
SRC
|
573
|
+
|
574
|
+
assert_equal_xml valid_receipt_in_request_xml, @gateway.build_receipt_in_request(@amount, @credit_card, options)
|
575
|
+
|
576
|
+
end
|
577
|
+
|
578
|
+
def test_card_unstore_xml
|
579
|
+
gateway = Realex3dsGateway.new(:login => @login, :password => @password, :account => @account)
|
580
|
+
options = {
|
581
|
+
:order_id => '1',
|
582
|
+
:payment_method => 'visa01',
|
583
|
+
:user => {
|
584
|
+
:id => 1,
|
585
|
+
:first_name => 'John',
|
586
|
+
:last_name => 'Smith'
|
587
|
+
}
|
588
|
+
}
|
589
|
+
|
590
|
+
ActiveMerchant::Billing::Realex3dsGateway.expects(:timestamp).returns('20090824160201')
|
591
|
+
|
592
|
+
valid_cancel_card_request_xml = <<-SRC
|
593
|
+
<request timestamp="20090824160201" type="card-cancel-card">
|
594
|
+
<merchantid>your_merchant_id</merchantid>
|
595
|
+
<account>your_account</account>
|
596
|
+
<card>
|
597
|
+
<ref>visa01</ref>
|
598
|
+
<payerref>1</payerref>
|
599
|
+
<expdate>0808</expdate>
|
600
|
+
</card>
|
601
|
+
<sha1hash>ff0d7ff2ff82fef20de477b4d91478533bd4ab85</sha1hash>
|
602
|
+
</request>
|
603
|
+
SRC
|
604
|
+
|
605
|
+
assert_equal_xml valid_cancel_card_request_xml, @gateway.build_cancel_card_request(@credit_card, options)
|
606
|
+
|
607
|
+
end
|
608
|
+
|
609
|
+
|
610
|
+
private
|
611
|
+
|
612
|
+
def successful_purchase_response
|
613
|
+
<<-RESPONSE
|
614
|
+
<response timestamp='20010427043422'>
|
615
|
+
<merchantid>your merchant id</merchantid>
|
616
|
+
<account>account to use</account>
|
617
|
+
<orderid>order id from request</orderid>
|
618
|
+
<authcode>authcode received</authcode>
|
619
|
+
<result>00</result>
|
620
|
+
<message>[ test system ] message returned from system</message>
|
621
|
+
<pasref> realex payments reference</pasref>
|
622
|
+
<cvnresult>M</cvnresult>
|
623
|
+
<batchid>batch id for this transaction (if any)</batchid>
|
624
|
+
<cardissuer>
|
625
|
+
<bank>Issuing Bank Name</bank>
|
626
|
+
<country>Issuing Bank Country</country>
|
627
|
+
<countrycode>Issuing Bank Country Code</countrycode>
|
628
|
+
<region>Issuing Bank Region</region>
|
629
|
+
</cardissuer>
|
630
|
+
<tss>
|
631
|
+
<result>89</result>
|
632
|
+
<check id="1000">9</check>
|
633
|
+
<check id="1001">9</check>
|
634
|
+
</tss>
|
635
|
+
<sha1hash>7384ae67....ac7d7d</sha1hash>
|
636
|
+
<md5hash>34e7....a77d</md5hash>
|
637
|
+
</response>"
|
638
|
+
RESPONSE
|
639
|
+
end
|
640
|
+
|
641
|
+
def unsuccessful_purchase_response
|
642
|
+
<<-RESPONSE
|
643
|
+
<response timestamp='20010427043422'>
|
644
|
+
<merchantid>your merchant id</merchantid>
|
645
|
+
<account>account to use</account>
|
646
|
+
<orderid>order id from request</orderid>
|
647
|
+
<authcode>authcode received</authcode>
|
648
|
+
<result>01</result>
|
649
|
+
<message>[ test system ] message returned from system</message>
|
650
|
+
<pasref> realex payments reference</pasref>
|
651
|
+
<cvnresult>M</cvnresult>
|
652
|
+
<batchid>batch id for this transaction (if any)</batchid>
|
653
|
+
<cardissuer>
|
654
|
+
<bank>Issuing Bank Name</bank>
|
655
|
+
<country>Issuing Bank Country</country>
|
656
|
+
<countrycode>Issuing Bank Country Code</countrycode>
|
657
|
+
<region>Issuing Bank Region</region>
|
658
|
+
</cardissuer>
|
659
|
+
<tss>
|
660
|
+
<result>89</result>
|
661
|
+
<check id="1000">9</check>
|
662
|
+
<check id="1001">9</check>
|
663
|
+
</tss>
|
664
|
+
<sha1hash>7384ae67....ac7d7d</sha1hash>
|
665
|
+
<md5hash>34e7....a77d</md5hash>
|
666
|
+
</response>"
|
667
|
+
RESPONSE
|
668
|
+
end
|
669
|
+
|
670
|
+
def successful_credit_response
|
671
|
+
<<-RESPONSE
|
672
|
+
<response timestamp='20010427043422'>
|
673
|
+
<merchantid>your merchant id</merchantid>
|
674
|
+
<account>account to use</account>
|
675
|
+
<orderid>order id from request</orderid>
|
676
|
+
<authcode>authcode received</authcode>
|
677
|
+
<result>00</result>
|
678
|
+
<message>[ test system ] message returned from system</message>
|
679
|
+
<pasref> realex payments reference</pasref>
|
680
|
+
<cvnresult>M</cvnresult>
|
681
|
+
<batchid>batch id for this transaction (if any)</batchid>
|
682
|
+
<sha1hash>7384ae67....ac7d7d</sha1hash>
|
683
|
+
<md5hash>34e7....a77d</md5hash>
|
684
|
+
</response>"
|
685
|
+
RESPONSE
|
686
|
+
end
|
687
|
+
|
688
|
+
def unsuccessful_credit_response
|
689
|
+
<<-RESPONSE
|
690
|
+
<response timestamp='20010427043422'>
|
691
|
+
<merchantid>your merchant id</merchantid>
|
692
|
+
<account>account to use</account>
|
693
|
+
<orderid>order id from request</orderid>
|
694
|
+
<authcode>authcode received</authcode>
|
695
|
+
<result>508</result>
|
696
|
+
<message>[ test system ] You may only rebate up to 115% of the original amount.</message>
|
697
|
+
<pasref> realex payments reference</pasref>
|
698
|
+
<cvnresult>M</cvnresult>
|
699
|
+
<batchid>batch id for this transaction (if any)</batchid>
|
700
|
+
<sha1hash>7384ae67....ac7d7d</sha1hash>
|
701
|
+
<md5hash>34e7....a77d</md5hash>
|
702
|
+
</response>"
|
703
|
+
RESPONSE
|
704
|
+
end
|
705
|
+
|
706
|
+
def successful_verify_request
|
707
|
+
<<-REQUEST
|
708
|
+
<request timestamp="20030625172305" type="3ds-verifyenrolled">
|
709
|
+
<merchantid>merchantid</merchantid>
|
710
|
+
<account />
|
711
|
+
<orderid>orderid</orderid>
|
712
|
+
<amount currency="EUR">2499</amount>
|
713
|
+
<card>
|
714
|
+
<number>4012001037141112</number>
|
715
|
+
<expdate>0404</expdate>
|
716
|
+
<type>visa</type>
|
717
|
+
<chname>Joe Pescquali</chname>
|
718
|
+
</card>
|
719
|
+
<sha1hash>c914a520f88743e40d0620e1b5328c4eebb33725</sha1hash>
|
720
|
+
<comments>
|
721
|
+
<comment id="1" />
|
722
|
+
<comment id="2" />
|
723
|
+
</comments>
|
724
|
+
</request>
|
725
|
+
REQUEST
|
726
|
+
end
|
727
|
+
|
728
|
+
def successful_verify_enrollment_response
|
729
|
+
<<-RESPONSE
|
730
|
+
<response timestamp="20030625171810">
|
731
|
+
<merchantid>merchantid</merchantid>
|
732
|
+
<account>internet</account>
|
733
|
+
<orderid>orderid</orderid>
|
734
|
+
<authcode></authcode>
|
735
|
+
<result>00</result>
|
736
|
+
<message>Enrolled</message>
|
737
|
+
<pasref></pasref>
|
738
|
+
<timetaken>3</timetaken>
|
739
|
+
<authtimetaken>0</authtimetaken>
|
740
|
+
<pareq>eJxVUttygkAM/ZUdnitZFlBw4na02tE6bR0vD+0bLlHpFFDASv++u6i1
|
741
|
+
zVNycju54H2dfrIvKsokz3qWY3OLUabyOMm2PWu1fGwF1r3E5a4gGi5IH
|
742
|
+
QuS+ExlGW2JJXHPCjcuVyLYbIRQnrf2o3VMEY+57q05oIsibP+nA4SL02k
|
743
|
+
7mELhKupqxVqF2WVxEgdBpMX6dwE4YJhSsVkKB3RH9ypGFyvNXpkrLW
|
744
|
+
982HcancQzn7MopSkO2RnqmxJZYXQgKjyY1YV39Lt6O5XA4/Fp9xV1b4L
|
745
|
+
cDqdbDcum8xKJ9oqTxFMAMKN5OxotFIXrJNY1otpMH0qYQwP43w08Pn0
|
746
|
+
/W1Ql6+nj+cegonAOKpICs5d3hY+czpdJ+g6HKHBUoNEyk8OwzZaDXXE
|
747
|
+
58R3JtG/as7DBH+IqhZFvpS3zLsBHqeq4VU7/OMTA7Cr45wo/0wNptWlV
|
748
|
+
4Xb8Thftv3A30xs+7GYaokej3c415TxhgIJhUu54TLF2jt33f8ADVyvnA=</pareq>
|
749
|
+
<url>http://www.acs.com</url>
|
750
|
+
<enrolled>Y</enrolled>
|
751
|
+
<xid>7ba3b1e6e6b542489b73243aac050777</xid>
|
752
|
+
<sha1hash>9eda1f99191d4e994627ddf38550b9f47981f614</sha1hash>
|
753
|
+
</response>
|
754
|
+
RESPONSE
|
755
|
+
end
|
756
|
+
|
757
|
+
def unsuccessful_verify_enrollment_response
|
758
|
+
<<-RESPONSE
|
759
|
+
<response timestamp="20030625171810">
|
760
|
+
<merchantid>merchantid</merchantid>
|
761
|
+
<account>internet</account>
|
762
|
+
<orderid>orderid</orderid>
|
763
|
+
<authcode></authcode>
|
764
|
+
<result>110</result>
|
765
|
+
<message>Not Enrolled</message>
|
766
|
+
<pasref></pasref>
|
767
|
+
<timetaken>3</timetaken>
|
768
|
+
<authtimetaken>0</authtimetaken>
|
769
|
+
<pareq>eJxVUttygkAM/ZUdnitZFlBw4na02tE6bR0vD+0bLlHpFFDASv++u6i1
|
770
|
+
zVNycju54H2dfrIvKsokz3qWY3OLUabyOMm2PWu1fGwF1r3E5a4gGi5IH
|
771
|
+
QuS+ExlGW2JJXHPCjcuVyLYbIRQnrf2o3VMEY+57q05oIsibP+nA4SL02k
|
772
|
+
7mELhKupqxVqF2WVxEgdBpMX6dwE4YJhSsVkKB3RH9ypGFyvNXpkrLW
|
773
|
+
982HcancQzn7MopSkO2RnqmxJZYXQgKjyY1YV39Lt6O5XA4/Fp9xV1b4L
|
774
|
+
cDqdbDcum8xKJ9oqTxFMAMKN5OxotFIXrJNY1otpMH0qYQwP43w08Pn0
|
775
|
+
/W1Ql6+nj+cegonAOKpICs5d3hY+czpdJ+g6HKHBUoNEyk8OwzZaDXXE
|
776
|
+
58R3JtG/as7DBH+IqhZFvpS3zLsBHqeq4VU7/OMTA7Cr45wo/0wNptWlV
|
777
|
+
4Xb8Thftv3A30xs+7GYaokej3c415TxhgIJhUu54TLF2jt33f8ADVyvnA=</pareq>
|
778
|
+
<url></url>
|
779
|
+
<enrolled>N</enrolled>
|
780
|
+
<xid>e9dafe706f7142469c45d4877aaf5984</xid>
|
781
|
+
<sha1hash>9eda1f99191d4e994627ddf38550b9f47981f614</sha1hash>
|
782
|
+
</response>
|
783
|
+
RESPONSE
|
784
|
+
end
|
785
|
+
|
786
|
+
def successful_verify_signature_request
|
787
|
+
<<-REQUEST
|
788
|
+
<request timestamp="20030625172325" type="3ds-verifysig">
|
789
|
+
<merchantid>merchantid</merchantid>
|
790
|
+
<account />
|
791
|
+
<orderid>orderid</orderid>
|
792
|
+
<amount currency="EUR">2499</amount>
|
793
|
+
<card>
|
794
|
+
<number>4012001037141112</number>
|
795
|
+
<expdate>0404</expdate>
|
796
|
+
<type>visa</type>
|
797
|
+
<chname>Joe Pescqualli</chname>
|
798
|
+
</card>
|
799
|
+
<pares>eJztWFmT4jgS/..... a/A2OMEv4=</pares>
|
800
|
+
<sha1hash>e0817f5ffeca1241c23a52b0eafa5c578ef68356</sha1hash>
|
801
|
+
<comments>
|
802
|
+
<comment id="1" />
|
803
|
+
<comment id="2" />
|
804
|
+
</comments>
|
805
|
+
</request>
|
806
|
+
REQUEST
|
807
|
+
end
|
808
|
+
|
809
|
+
def successful_verify_signature_response
|
810
|
+
<<-RESPONSE
|
811
|
+
<response timestamp="20030625171823">
|
812
|
+
<merchantid>merchantid</merchantid>
|
813
|
+
<account />
|
814
|
+
<orderid>orderid</orderid>
|
815
|
+
<result>00</result>
|
816
|
+
<message>Authentication Successful</message>
|
817
|
+
<threedsecure>
|
818
|
+
<status>N</status>
|
819
|
+
<eci />
|
820
|
+
<xid />
|
821
|
+
<cavv />
|
822
|
+
<algorithm />
|
823
|
+
</threedsecure>
|
824
|
+
<sha1hash>e5a7745da5dc32d234c3f52860132c482107e9ac</sha1hash>
|
825
|
+
</response>
|
826
|
+
RESPONSE
|
827
|
+
end
|
828
|
+
|
829
|
+
|
830
|
+
# TODO
|
831
|
+
# Ensure this response error is caught and payments made unobtrusively...
|
832
|
+
#
|
833
|
+
# <response timestamp="20060322231944">
|
834
|
+
# <result> 508</ result>
|
835
|
+
# < message> Transaction MPI data does not match the data in the MPI database</ message>
|
836
|
+
# </response>
|
837
|
+
|
838
|
+
def successful_authorisation_request_with_3dsecure
|
839
|
+
<<-REQUEST
|
840
|
+
<request timestamp="20030625172325" type="auth">
|
841
|
+
<merchantid>merchantid</merchantid>
|
842
|
+
<account />
|
843
|
+
<orderid>orderid</orderid>
|
844
|
+
<amount currency="EUR">2499</amount>
|
845
|
+
<card>
|
846
|
+
<number>4012001037141112</number>
|
847
|
+
<expdate>0404</expdate>
|
848
|
+
<type>visa</type>
|
849
|
+
<chname>Joe Pescqualli</chname>
|
850
|
+
</card>
|
851
|
+
<autosettle flag="1" />
|
852
|
+
<mpi>
|
853
|
+
<cavv>AAACAWQWaRKIFwQlVBZpAAAAAAA=</cavv>
|
854
|
+
<xid>l2ncCuvKNtCtRY3OoC/ztHS8ZvI=</xid>
|
855
|
+
<eci>5</eci>
|
856
|
+
</mpi>
|
857
|
+
<sha1hash>e0817f5ffeca1241c23a52b0eafa5c578ef68356</sha1hash>
|
858
|
+
<comments>
|
859
|
+
<comment id="1" />
|
860
|
+
<comment id="2" />
|
861
|
+
</comments>
|
862
|
+
<autosettle flag="1" />
|
863
|
+
</request>
|
864
|
+
REQUEST
|
865
|
+
end
|
866
|
+
|
867
|
+
def successful_payer_new_response
|
868
|
+
<<-RESPONSE
|
869
|
+
<response timestamp="20080611122312">
|
870
|
+
<merchantid>yourmerchantid</merchantid>
|
871
|
+
<account>internet</account>
|
872
|
+
<orderid>transaction01</orderid>
|
873
|
+
<result>00</result>
|
874
|
+
<message>Successful</message>
|
875
|
+
<pasref>5e6b67d303404710a98a4f18abdcd402</pasref>
|
876
|
+
<authcode></authcode>
|
877
|
+
<batchid></batchid>
|
878
|
+
<timetaken>0</timetaken>
|
879
|
+
<processingtimetaken></processingtimetaken>
|
880
|
+
<md5hash>ff3be479aca946522a9d72d792855018</md5hash>
|
881
|
+
<sha1hash>2858c85a5e380e9dc9398329bbd1f086527fc2a7</sha1hash>
|
882
|
+
</response>
|
883
|
+
RESPONSE
|
884
|
+
end
|
885
|
+
|
886
|
+
def successful_payer_edit_response
|
887
|
+
<<-RESPONSE
|
888
|
+
<response timestamp="20080619114736">
|
889
|
+
<merchantid>yourmerchantid</merchantid>
|
890
|
+
<account>internet</account>
|
891
|
+
<orderid>transaction01</orderid>
|
892
|
+
<result>00</result>
|
893
|
+
<message>Successful</message>
|
894
|
+
<pasref>889510cbf2e74b27b745b2b9b908fabf</pasref>
|
895
|
+
<authcode></authcode>
|
896
|
+
<batchid></batchid>
|
897
|
+
<timetaken>0</timetaken>
|
898
|
+
<processingtimetaken></processingtimetaken>
|
899
|
+
<md5hash>0bcbd8187c2e2ff48668bca26c706a39</md5hash>
|
900
|
+
<sha1hash>7cd0d46c65d6985b7871a7e682451be5ac1b5a2d</sha1hash>
|
901
|
+
</response>
|
902
|
+
RESPONSE
|
903
|
+
end
|
904
|
+
|
905
|
+
def successful_card_store_response
|
906
|
+
<<-RESPONSE
|
907
|
+
<response timestamp="20080619120024">
|
908
|
+
<merchantid>yourmerchantid</merchantid>
|
909
|
+
<account>internet</account>
|
910
|
+
<orderid>transaction01</orderid>
|
911
|
+
<result>00</result>
|
912
|
+
<message>Successful</message>
|
913
|
+
<pasref>6326ce64fbe340d699433dfc01785c69</pasref>
|
914
|
+
<authcode></authcode>
|
915
|
+
<batchid></batchid>
|
916
|
+
<timetaken>0</timetaken>
|
917
|
+
<processingtimetaken></processingtimetaken>
|
918
|
+
<md5hash>e41b9e80d0421930131572d66c830407</md5hash>
|
919
|
+
<sha1hash>281e5be5a58c7e26b2a6aa31018177960a9c49ab</sha1hash>
|
920
|
+
</response>
|
921
|
+
RESPONSE
|
922
|
+
end
|
923
|
+
|
924
|
+
def unsuccessful_card_store_response
|
925
|
+
<<-RESPONSE
|
926
|
+
<response timestamp="20080619120121">
|
927
|
+
<merchantid></merchantid>
|
928
|
+
<account></account>
|
929
|
+
<orderid></orderid>
|
930
|
+
<result>501</result>
|
931
|
+
<message>This Card Ref [cardref01] has already been used [Perhaps you've already set up this
|
932
|
+
card for this Payer?]</message>
|
933
|
+
<pasref></pasref>
|
934
|
+
<authcode></authcode>
|
935
|
+
<batchid></batchid>
|
936
|
+
<timetaken>1</timetaken>
|
937
|
+
<processingtimetaken></processingtimetaken>
|
938
|
+
<md5hash>ce30d3ea0e4c9b3d152b61bc5dc93fba</md5hash>
|
939
|
+
<sha1hash>8f00805dc22a8832ad43ba2d31ba1ee868ed51f9</sha1hash>
|
940
|
+
</response>
|
941
|
+
RESPONSE
|
942
|
+
end
|
943
|
+
|
944
|
+
def successful_reccurring_response
|
945
|
+
<<-RESPONSE
|
946
|
+
<response timestamp="20080611121850">
|
947
|
+
<merchantid>yourmerchantid</merchantid>
|
948
|
+
<account>internet</account>
|
949
|
+
<orderid>transaction01</orderid>
|
950
|
+
<result>00</result>
|
951
|
+
<message>Successful</message>
|
952
|
+
<pasref>6210a82bba414793ba391254dffbbf77</pasref>
|
953
|
+
<authcode></authcode>
|
954
|
+
<batchid>161</batchid>
|
955
|
+
<timetaken>1</timetaken>
|
956
|
+
<processingtimetaken></processingtimetaken>
|
957
|
+
<md5hash>22049e6b2c68a5a3942a615c46a1bd72</md5hash>
|
958
|
+
<sha1hash>ddd37a93aa377e8c85b42ff4c3a1f88db33ea977</sha1hash>
|
959
|
+
</response>
|
960
|
+
RESPONSE
|
961
|
+
end
|
962
|
+
|
963
|
+
def unsucessful_recurring_response
|
964
|
+
<<-RESPONSE
|
965
|
+
<response timestamp="20080611122328">
|
966
|
+
<merchantid>yourmerchantid</merchantid>
|
967
|
+
<account>internet</account>
|
968
|
+
<result>520</result>
|
969
|
+
<message>There is no such Payment Method [cardref] configured for that Payer
|
970
|
+
[payerref]</message>
|
971
|
+
</response>
|
972
|
+
RESPONSE
|
973
|
+
end
|
974
|
+
|
975
|
+
end
|