exact4r 0.9.3 → 1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +3 -0
- data/README +0 -11
- data/Rakefile +38 -6
- data/VERSION +1 -1
- data/lib/ews/transaction/request.rb +4 -0
- data/lib/ews/transaction/validator.rb +2 -0
- data/lib/ews/transporter.rb +4 -2
- data/test/credentials.rb +62 -0
- data/test/credentials.yml +53 -0
- data/test/exhaustive/batch_query_close_test.rb +193 -0
- data/test/exhaustive/forced_post_test.rb +3 -3
- data/test/exhaustive/online_debit_purchase_test.rb +9 -5
- data/test/exhaustive/online_debit_refund_test.rb +9 -5
- data/test/exhaustive/pre_auth_completion_test.rb +3 -3
- data/test/exhaustive/pre_auth_only_test.rb +9 -3
- data/test/exhaustive/pre_auth_test.rb +3 -3
- data/test/exhaustive/purchase_correction_test.rb +13 -7
- data/test/exhaustive/purchase_test.rb +3 -3
- data/test/exhaustive/recurring_seed_pre_auth_test.rb +3 -3
- data/test/exhaustive/recurring_seed_purchase_test.rb +3 -3
- data/test/exhaustive/refund_correction_test.rb +12 -6
- data/test/exhaustive/refund_test.rb +3 -3
- data/test/exhaustive/secure_storage_test.rb +3 -3
- data/test/exhaustive/tagged_online_debit_refund_test.rb +64 -37
- data/test/exhaustive/tagged_pre_auth_completion_test.rb +8 -8
- data/test/exhaustive/tagged_pre_auth_test.rb +8 -8
- data/test/exhaustive/tagged_purchase_test.rb +8 -8
- data/test/exhaustive/tagged_refund_test.rb +9 -9
- data/test/exhaustive/tagged_void_test.rb +24 -10
- data/test/exhaustive/transaction_details_test.rb +8 -6
- data/test/exhaustive/void_test.rb +9 -3
- data/test/general/avs_test.rb +7 -7
- data/test/general/request_test.rb +20 -37
- data/test/general/transporter_test.rb +6 -6
- data/test/general/validator_test.rb +2 -2
- data/test/test_helper.rb +8 -18
- metadata +5 -27
- data/doc/classes/EWS/Transaction/FakeResponse.html +0 -451
- data/doc/classes/EWS/Transaction/Request.html +0 -469
- data/doc/classes/EWS/Transaction/Response.html +0 -472
- data/doc/classes/EWS/Transaction/Validator.html +0 -182
- data/doc/classes/EWS/Transporter.html +0 -269
- data/doc/classes/REXML/Document.html +0 -176
- data/doc/classes/REXML/Entity.html +0 -150
- data/doc/classes/REXML.html +0 -112
- data/doc/created.rid +0 -1
- data/doc/files/CHANGELOG.html +0 -156
- data/doc/files/LICENCE.html +0 -109
- data/doc/files/README.html +0 -371
- data/doc/files/VERSION.html +0 -107
- data/doc/files/lib/ews/transaction/fake_response_rb.html +0 -101
- data/doc/files/lib/ews/transaction/mapping_rb.html +0 -108
- data/doc/files/lib/ews/transaction/request_rb.html +0 -108
- data/doc/files/lib/ews/transaction/response_rb.html +0 -101
- data/doc/files/lib/ews/transaction/validator_rb.html +0 -101
- data/doc/files/lib/ews/transporter_rb.html +0 -108
- data/doc/files/lib/exact4r_rb.html +0 -117
- data/doc/fr_class_index.html +0 -34
- data/doc/fr_file_index.html +0 -37
- data/doc/fr_method_index.html +0 -48
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + "/../test_helper"
|
|
3
3
|
class TaggedRefundTest < Test::Unit::TestCase
|
4
4
|
|
5
5
|
def setup
|
6
|
-
@transporter = EWS::Transporter.new(
|
6
|
+
@transporter = EWS::Transporter.new(@@credentials.config['location'])
|
7
7
|
|
8
8
|
# do initial recurring seed
|
9
9
|
request = EWS::Transaction::Request.new(cc_number_params.merge(:transaction_type => :recurring_seed_purchase))
|
@@ -19,11 +19,11 @@ class TaggedRefundTest < Test::Unit::TestCase
|
|
19
19
|
assert !request.valid?
|
20
20
|
assert_equal "gateway_id must be supplied", request.errors[:gateway_id]
|
21
21
|
|
22
|
-
request.gateway_id =
|
22
|
+
request.gateway_id = @@credentials.current_gateway[:gateway_id]
|
23
23
|
assert !request.valid?
|
24
24
|
assert_equal "password must be supplied", request.errors[:password]
|
25
25
|
|
26
|
-
request.password =
|
26
|
+
request.password = @@credentials.current_gateway[:password]
|
27
27
|
assert !request.valid?
|
28
28
|
assert_equal "One of the following must be supplied: cc_number, track1, track2 or transaction_tag.", request.errors[:base]
|
29
29
|
|
@@ -49,7 +49,7 @@ class TaggedRefundTest < Test::Unit::TestCase
|
|
49
49
|
:amount => 11.25,
|
50
50
|
:transaction_tag => @response.transaction_tag,
|
51
51
|
:authorization_num => @response.authorization_num
|
52
|
-
}.merge(
|
52
|
+
}.merge(@@credentials.current_gateway))
|
53
53
|
assert request.valid?, request.errors.inspect
|
54
54
|
|
55
55
|
assert_details_correct request, @transporter.submit(request, :json)
|
@@ -61,7 +61,7 @@ class TaggedRefundTest < Test::Unit::TestCase
|
|
61
61
|
:amount => 11.25,
|
62
62
|
:transaction_tag => @response.transaction_tag,
|
63
63
|
:authorization_num => @response.authorization_num
|
64
|
-
}.merge(
|
64
|
+
}.merge(@@credentials.current_gateway))
|
65
65
|
assert request.valid?, request.errors.inspect
|
66
66
|
|
67
67
|
assert_details_correct request, @transporter.submit(request, :rest)
|
@@ -73,7 +73,7 @@ class TaggedRefundTest < Test::Unit::TestCase
|
|
73
73
|
:amount => 11.25,
|
74
74
|
:transaction_tag => @response.transaction_tag,
|
75
75
|
:authorization_num => @response.authorization_num
|
76
|
-
}.merge(
|
76
|
+
}.merge(@@credentials.current_gateway))
|
77
77
|
assert request.valid?, request.errors.inspect
|
78
78
|
|
79
79
|
assert_details_correct request, @transporter.submit(request, :soap)
|
@@ -85,7 +85,7 @@ class TaggedRefundTest < Test::Unit::TestCase
|
|
85
85
|
:amount => 3.50,
|
86
86
|
:transaction_tag => @response.transaction_tag,
|
87
87
|
:authorization_num => @response.authorization_num
|
88
|
-
}.merge(
|
88
|
+
}.merge(@@credentials.current_gateway))
|
89
89
|
assert request.valid?, request.errors.inspect
|
90
90
|
|
91
91
|
assert_details_correct request, @transporter.submit(request, :json)
|
@@ -112,7 +112,7 @@ class TaggedRefundTest < Test::Unit::TestCase
|
|
112
112
|
:amount => 11.25,
|
113
113
|
:transaction_tag => pre_response.transaction_tag,
|
114
114
|
:authorization_num => pre_response.authorization_num
|
115
|
-
}.merge(
|
115
|
+
}.merge(@@credentials.current_gateway))
|
116
116
|
assert request.valid?, request.errors.inspect
|
117
117
|
|
118
118
|
response = @transporter.submit(request, :json)
|
@@ -134,7 +134,7 @@ class TaggedRefundTest < Test::Unit::TestCase
|
|
134
134
|
:amount => 11.25,
|
135
135
|
:transaction_tag => pre_response.transaction_tag,
|
136
136
|
:authorization_num => pre_response.authorization_num
|
137
|
-
}.merge(
|
137
|
+
}.merge(@@credentials.current_gateway))
|
138
138
|
assert request.valid?, request.errors.inspect
|
139
139
|
|
140
140
|
assert_details_correct request, @transporter.submit(request, :json)
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + "/../test_helper"
|
|
3
3
|
class TaggedVoidTest < Test::Unit::TestCase
|
4
4
|
|
5
5
|
def setup
|
6
|
-
@transporter = EWS::Transporter.new(
|
6
|
+
@transporter = EWS::Transporter.new(@@credentials.config['location'])
|
7
7
|
|
8
8
|
# do initial recurring seed
|
9
9
|
request = EWS::Transaction::Request.new(cc_number_params.merge(:transaction_type => :recurring_seed_purchase))
|
@@ -19,11 +19,11 @@ class TaggedVoidTest < Test::Unit::TestCase
|
|
19
19
|
assert !request.valid?
|
20
20
|
assert_equal "gateway_id must be supplied", request.errors[:gateway_id]
|
21
21
|
|
22
|
-
request.gateway_id =
|
22
|
+
request.gateway_id = @@credentials.current_gateway[:gateway_id]
|
23
23
|
assert !request.valid?
|
24
24
|
assert_equal "password must be supplied", request.errors[:password]
|
25
25
|
|
26
|
-
request.password =
|
26
|
+
request.password = @@credentials.current_gateway[:password]
|
27
27
|
assert !request.valid?
|
28
28
|
assert_equal "One of the following must be supplied: cc_number, track1, track2 or transaction_tag.", request.errors[:base]
|
29
29
|
|
@@ -44,48 +44,56 @@ class TaggedVoidTest < Test::Unit::TestCase
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_json
|
47
|
+
return if @@credentials.moneris?
|
48
|
+
|
47
49
|
request = EWS::Transaction::Request.new({
|
48
50
|
:transaction_type => :tagged_void,
|
49
51
|
:amount => 11.25,
|
50
52
|
:transaction_tag => @response.transaction_tag,
|
51
53
|
:authorization_num => @response.authorization_num
|
52
|
-
}.merge(
|
54
|
+
}.merge(@@credentials.current_gateway))
|
53
55
|
assert request.valid?, request.errors.inspect
|
54
56
|
|
55
57
|
assert_details_correct request, @transporter.submit(request, :json)
|
56
58
|
end
|
57
59
|
|
58
60
|
def test_rest
|
61
|
+
return if @@credentials.moneris?
|
62
|
+
|
59
63
|
request = EWS::Transaction::Request.new({
|
60
64
|
:transaction_type => :tagged_void,
|
61
65
|
:amount => 11.25,
|
62
66
|
:transaction_tag => @response.transaction_tag,
|
63
67
|
:authorization_num => @response.authorization_num
|
64
|
-
}.merge(
|
68
|
+
}.merge(@@credentials.current_gateway))
|
65
69
|
assert request.valid?, request.errors.inspect
|
66
70
|
|
67
71
|
assert_details_correct request, @transporter.submit(request, :rest)
|
68
72
|
end
|
69
73
|
|
70
74
|
def test_soap
|
75
|
+
return if @@credentials.moneris?
|
76
|
+
|
71
77
|
request = EWS::Transaction::Request.new({
|
72
78
|
:transaction_type => :tagged_void,
|
73
79
|
:amount => 11.25,
|
74
80
|
:transaction_tag => @response.transaction_tag,
|
75
81
|
:authorization_num => @response.authorization_num
|
76
|
-
}.merge(
|
82
|
+
}.merge(@@credentials.current_gateway))
|
77
83
|
assert request.valid?, request.errors.inspect
|
78
84
|
|
79
85
|
assert_details_correct request, @transporter.submit(request, :soap)
|
80
86
|
end
|
81
87
|
|
82
88
|
def test_requires_correct_amount
|
89
|
+
return if @@credentials.moneris?
|
90
|
+
|
83
91
|
request = EWS::Transaction::Request.new({
|
84
92
|
:transaction_type => :tagged_void,
|
85
93
|
:amount => 3.50,
|
86
94
|
:transaction_tag => @response.transaction_tag,
|
87
95
|
:authorization_num => @response.authorization_num
|
88
|
-
}.merge(
|
96
|
+
}.merge(@@credentials.current_gateway))
|
89
97
|
assert request.valid?, request.errors.inspect
|
90
98
|
|
91
99
|
response = @transporter.submit(request, :json)
|
@@ -100,12 +108,14 @@ class TaggedVoidTest < Test::Unit::TestCase
|
|
100
108
|
end
|
101
109
|
|
102
110
|
def test_multiple_voids_against_one_seed
|
111
|
+
return if @@credentials.moneris?
|
112
|
+
|
103
113
|
request = EWS::Transaction::Request.new({
|
104
114
|
:transaction_type => :tagged_void,
|
105
115
|
:amount => 11.25,
|
106
116
|
:transaction_tag => @response.transaction_tag,
|
107
117
|
:authorization_num => @response.authorization_num
|
108
|
-
}.merge(
|
118
|
+
}.merge(@@credentials.current_gateway))
|
109
119
|
assert request.valid?, request.errors.inspect
|
110
120
|
|
111
121
|
assert_details_correct request, @transporter.submit(request, :json)
|
@@ -116,6 +126,8 @@ class TaggedVoidTest < Test::Unit::TestCase
|
|
116
126
|
end
|
117
127
|
|
118
128
|
def test_not_permitted_after_recurring_seed_pre_auth
|
129
|
+
return if @@credentials.moneris?
|
130
|
+
|
119
131
|
# do initial recurring seed pre auth
|
120
132
|
pre_request = EWS::Transaction::Request.new(cc_number_params.merge(:transaction_type => :recurring_seed_pre_auth))
|
121
133
|
pre_request.amount = 11.25
|
@@ -130,7 +142,7 @@ class TaggedVoidTest < Test::Unit::TestCase
|
|
130
142
|
:amount => 11.25,
|
131
143
|
:transaction_tag => pre_response.transaction_tag,
|
132
144
|
:authorization_num => pre_response.authorization_num
|
133
|
-
}.merge(
|
145
|
+
}.merge(@@credentials.current_gateway))
|
134
146
|
assert request.valid?, request.errors.inspect
|
135
147
|
|
136
148
|
response = @transporter.submit(request, :json)
|
@@ -138,6 +150,8 @@ class TaggedVoidTest < Test::Unit::TestCase
|
|
138
150
|
end
|
139
151
|
|
140
152
|
def test_permitted_after_plain_purchase
|
153
|
+
return if @@credentials.moneris?
|
154
|
+
|
141
155
|
# do initial purchase
|
142
156
|
pre_request = EWS::Transaction::Request.new(cc_number_params.merge(:transaction_type => :purchase))
|
143
157
|
pre_request.amount = 11.25
|
@@ -152,7 +166,7 @@ class TaggedVoidTest < Test::Unit::TestCase
|
|
152
166
|
:amount => 11.25,
|
153
167
|
:transaction_tag => pre_response.transaction_tag,
|
154
168
|
:authorization_num => pre_response.authorization_num
|
155
|
-
}.merge(
|
169
|
+
}.merge(@@credentials.current_gateway))
|
156
170
|
assert request.valid?, request.errors.inspect
|
157
171
|
|
158
172
|
assert_details_correct request, @transporter.submit(request, :json)
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + "/../test_helper"
|
|
3
3
|
class TransactionDetailsTest < Test::Unit::TestCase
|
4
4
|
|
5
5
|
def setup
|
6
|
-
@transporter = EWS::Transporter.new(
|
6
|
+
@transporter = EWS::Transporter.new(@@credentials.config['location'])
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_mandatory
|
@@ -11,11 +11,11 @@ class TransactionDetailsTest < Test::Unit::TestCase
|
|
11
11
|
assert !request.valid?
|
12
12
|
assert_equal "gateway_id must be supplied", request.errors[:gateway_id]
|
13
13
|
|
14
|
-
request.gateway_id =
|
14
|
+
request.gateway_id = @@credentials.current_gateway[:gateway_id]
|
15
15
|
assert !request.valid?
|
16
16
|
assert_equal "password must be supplied", request.errors[:password]
|
17
17
|
|
18
|
-
request.password =
|
18
|
+
request.password = @@credentials.current_gateway[:password]
|
19
19
|
assert !request.valid?
|
20
20
|
assert_equal "transaction_tag must be supplied", request.errors[:transaction_tag]
|
21
21
|
|
@@ -35,7 +35,7 @@ class TransactionDetailsTest < Test::Unit::TestCase
|
|
35
35
|
request = EWS::Transaction::Request.new({
|
36
36
|
:transaction_type => :transaction_details,
|
37
37
|
:transaction_tag => pre_response.transaction_tag
|
38
|
-
}.merge(
|
38
|
+
}.merge(@@credentials.current_gateway))
|
39
39
|
assert request.valid?, request.errors.inspect
|
40
40
|
|
41
41
|
assert_details_match_original_response pre_response, @transporter.submit(request, :json)
|
@@ -44,13 +44,15 @@ class TransactionDetailsTest < Test::Unit::TestCase
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_debit_transaction_details
|
47
|
+
return unless @@credentials.chase?
|
48
|
+
|
47
49
|
# do initial purchase
|
48
50
|
pre_request = EWS::Transaction::Request.new({
|
49
51
|
:transaction_type => :idebit_purchase,
|
50
52
|
:amount => 10.1,
|
51
53
|
:pan => TEST_CARD_NUMBER,
|
52
54
|
:cardholder_name => TEST_CARD_HOLDER
|
53
|
-
}.merge(
|
55
|
+
}.merge(@@credentials.current_gateway))
|
54
56
|
assert pre_request.valid?, pre_request.errors.inspect
|
55
57
|
|
56
58
|
pre_response = @transporter.submit(pre_request, :json)
|
@@ -59,7 +61,7 @@ class TransactionDetailsTest < Test::Unit::TestCase
|
|
59
61
|
request = EWS::Transaction::Request.new({
|
60
62
|
:transaction_type => :transaction_details,
|
61
63
|
:transaction_tag => pre_response.transaction_tag
|
62
|
-
}.merge(
|
64
|
+
}.merge(@@credentials.current_gateway))
|
63
65
|
assert request.valid?, request.errors.inspect
|
64
66
|
|
65
67
|
assert_details_match_original_response pre_response, @transporter.submit(request, :json)
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + "/../test_helper"
|
|
3
3
|
class VoidTest < Test::Unit::TestCase
|
4
4
|
|
5
5
|
def setup
|
6
|
-
@transporter = EWS::Transporter.new(
|
6
|
+
@transporter = EWS::Transporter.new(@@credentials.config['location'])
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_mandatory
|
@@ -11,11 +11,11 @@ class VoidTest < Test::Unit::TestCase
|
|
11
11
|
assert !request.valid?
|
12
12
|
assert_equal "gateway_id must be supplied", request.errors[:gateway_id]
|
13
13
|
|
14
|
-
request.gateway_id =
|
14
|
+
request.gateway_id = @@credentials.current_gateway[:gateway_id]
|
15
15
|
assert !request.valid?
|
16
16
|
assert_equal "password must be supplied", request.errors[:password]
|
17
17
|
|
18
|
-
request.password =
|
18
|
+
request.password = @@credentials.current_gateway[:password]
|
19
19
|
assert !request.valid?
|
20
20
|
assert_equal "One of the following must be supplied: cc_number, track1, track2 or transaction_tag.", request.errors[:base]
|
21
21
|
|
@@ -40,6 +40,8 @@ class VoidTest < Test::Unit::TestCase
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_by_credit_card
|
43
|
+
return if @@credentials.chase? || @@credentials.moneris?
|
44
|
+
|
43
45
|
request = EWS::Transaction::Request.new(cc_number_params.merge(:transaction_type => :void))
|
44
46
|
request.amount = 11.25
|
45
47
|
request.authorization_num = "1234"
|
@@ -51,6 +53,8 @@ class VoidTest < Test::Unit::TestCase
|
|
51
53
|
end
|
52
54
|
|
53
55
|
def test_by_track1
|
56
|
+
return if @@credentials.chase? || @@credentials.moneris?
|
57
|
+
|
54
58
|
request = EWS::Transaction::Request.new(track1_params.merge(:transaction_type => :void))
|
55
59
|
request.amount = 11.25
|
56
60
|
request.authorization_num = "1234"
|
@@ -62,6 +66,8 @@ class VoidTest < Test::Unit::TestCase
|
|
62
66
|
end
|
63
67
|
|
64
68
|
def test_by_track2
|
69
|
+
return if @@credentials.chase? || @@credentials.moneris?
|
70
|
+
|
65
71
|
request = EWS::Transaction::Request.new(track2_params.merge(:transaction_type => :void))
|
66
72
|
request.amount = 11.25
|
67
73
|
request.authorization_num = "1234"
|
data/test/general/avs_test.rb
CHANGED
@@ -35,11 +35,11 @@ class AvsTest < Test::Unit::TestCase
|
|
35
35
|
:avs_street_address => '1234567LOUGHEEDHIGHW',
|
36
36
|
:avs_unit_no => nil,
|
37
37
|
:avs_po_box => nil,
|
38
|
-
:avs_postal_code => '902101234').merge(
|
38
|
+
:avs_postal_code => '902101234').merge(@@credentials.chase)
|
39
39
|
r = EWS::Transaction::Request.new(tx_params)
|
40
40
|
assert_equal '1234567LOUGHEEDHIGHW|902101234', r.cc_verification_str1
|
41
41
|
|
42
|
-
resp = EWS::Transporter.new(
|
42
|
+
resp = EWS::Transporter.new(@@credentials.config['location']).submit(r)
|
43
43
|
assert_equal r.cc_verification_str1, resp.cc_verification_str1
|
44
44
|
end
|
45
45
|
|
@@ -48,21 +48,21 @@ class AvsTest < Test::Unit::TestCase
|
|
48
48
|
:avs_street_address => '1234567LOUGHEEDHIGHW',
|
49
49
|
:avs_unit_no => nil,
|
50
50
|
:avs_po_box => nil,
|
51
|
-
:avs_postal_code => '902101234').merge(
|
51
|
+
:avs_postal_code => '902101234').merge(@@credentials.emergis)
|
52
52
|
r = EWS::Transaction::Request.new(tx_params)
|
53
|
-
resp = EWS::Transporter.new(
|
53
|
+
resp = EWS::Transporter.new(@@credentials.config['location']).submit(r)
|
54
54
|
assert_equal '1234567LOUGHEEDHIGHW902101234', resp.cc_verification_str1
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_space_with_numerals_for_tsys
|
58
|
-
transporter = EWS::Transporter.new(
|
58
|
+
transporter = EWS::Transporter.new(@@credentials.config['location'])
|
59
59
|
|
60
60
|
# should put space between numeral and zip code for Tsys
|
61
61
|
tx_params = basic_params.merge(:avs_test_flag => nil,
|
62
62
|
:avs_street_address => nil,
|
63
63
|
:avs_unit_no => nil,
|
64
64
|
:avs_po_box => 'P.O.BOX24356',
|
65
|
-
:avs_postal_code => '902101234').merge(
|
65
|
+
:avs_postal_code => '902101234').merge(@@credentials.tsys)
|
66
66
|
r = EWS::Transaction::Request.new(tx_params)
|
67
67
|
resp = transporter.submit(r)
|
68
68
|
|
@@ -73,7 +73,7 @@ class AvsTest < Test::Unit::TestCase
|
|
73
73
|
:avs_street_address => '1234567LOUGHEEDHIGHW',
|
74
74
|
:avs_unit_no => nil,
|
75
75
|
:avs_po_box => nil,
|
76
|
-
:avs_postal_code => '902101234').merge(
|
76
|
+
:avs_postal_code => '902101234').merge(@@credentials.emergis)
|
77
77
|
r = EWS::Transaction::Request.new(tx_params)
|
78
78
|
resp = transporter.submit(r)
|
79
79
|
|
@@ -52,98 +52,81 @@ class RequestTest < Test::Unit::TestCase
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_default_submission
|
55
|
-
transporter = EWS::Transporter.new(
|
55
|
+
transporter = EWS::Transporter.new(@@credentials.config['location'])
|
56
56
|
resp = transporter.submit(basic_new_transaction)
|
57
57
|
|
58
58
|
assert_equal "00", resp.exact_resp_code
|
59
59
|
assert_equal "Transaction Normal", resp.exact_message
|
60
60
|
assert_equal 1, resp.transaction_approved
|
61
|
-
assert_match /approved/, resp.bank_message.downcase
|
62
61
|
assert_not_nil resp.transaction_tag
|
63
62
|
end
|
64
63
|
|
65
64
|
def test_json_submission
|
66
|
-
transporter = EWS::Transporter.new(
|
65
|
+
transporter = EWS::Transporter.new(@@credentials.config['location'])
|
67
66
|
resp = transporter.submit(basic_new_transaction, :json)
|
68
67
|
|
69
68
|
assert_equal "00", resp.exact_resp_code
|
70
69
|
assert_equal "Transaction Normal", resp.exact_message
|
71
70
|
assert_equal 1, resp.transaction_approved
|
72
|
-
assert_match /approved/, resp.bank_message.downcase
|
73
71
|
assert_not_nil resp.transaction_tag
|
74
72
|
end
|
75
73
|
|
76
74
|
def test_rest_submission
|
77
|
-
transporter = EWS::Transporter.new(
|
75
|
+
transporter = EWS::Transporter.new(@@credentials.config['location'])
|
78
76
|
resp = transporter.submit(basic_new_transaction, :rest)
|
79
77
|
|
80
78
|
assert_equal "00", resp.exact_resp_code
|
81
79
|
assert_equal "Transaction Normal", resp.exact_message
|
82
80
|
assert_equal 1, resp.transaction_approved
|
83
|
-
assert_match /approved/, resp.bank_message.downcase
|
84
81
|
assert_not_nil resp.transaction_tag
|
85
82
|
end
|
86
83
|
|
87
84
|
def test_soap_submission
|
88
|
-
transporter = EWS::Transporter.new(
|
85
|
+
transporter = EWS::Transporter.new(@@credentials.config['location'])
|
89
86
|
resp = transporter.submit(basic_new_transaction, :soap)
|
90
87
|
|
91
88
|
assert_equal "00", resp.exact_resp_code
|
92
89
|
assert_equal "Transaction Normal", resp.exact_message
|
93
90
|
assert_equal 1, resp.transaction_approved
|
94
|
-
assert_match /approved/, resp.bank_message.downcase
|
95
91
|
assert_not_nil resp.transaction_tag
|
96
92
|
end
|
97
93
|
|
98
|
-
def test_default_find
|
99
|
-
transporter = EWS::Transporter.new(LOCATION)
|
100
|
-
original_resp = transporter.submit(basic_new_transaction)
|
101
|
-
|
102
|
-
req = basic_find_transaction(:transaction_tag => original_resp.transaction_tag)
|
103
|
-
resp = transporter.submit(req)
|
104
|
-
|
105
|
-
assert_equal "00", resp.exact_resp_code
|
106
|
-
assert_equal "Transaction Normal", resp.exact_message
|
107
|
-
assert_match /approved/, resp.bank_message.downcase
|
108
|
-
assert_equal original_resp.transaction_tag, resp.transaction_tag
|
109
|
-
end
|
110
|
-
|
111
94
|
def test_json_find
|
112
|
-
transporter = EWS::Transporter.new(
|
95
|
+
transporter = EWS::Transporter.new(@@credentials.config['location'])
|
113
96
|
original_resp = transporter.submit(basic_new_transaction, :json)
|
114
97
|
|
115
98
|
req = basic_find_transaction(:transaction_tag => original_resp.transaction_tag)
|
116
99
|
resp = transporter.submit(req, :json)
|
117
100
|
|
118
|
-
assert_equal
|
119
|
-
assert_equal
|
120
|
-
assert_match
|
101
|
+
assert_equal original_resp.exact_resp_code, resp.exact_resp_code
|
102
|
+
assert_equal original_resp.exact_message, resp.exact_message
|
103
|
+
assert_match original_resp.bank_message, resp.bank_message
|
121
104
|
assert_equal original_resp.transaction_tag, resp.transaction_tag
|
122
105
|
end
|
123
106
|
|
124
107
|
def test_rest_find
|
125
|
-
transporter = EWS::Transporter.new(
|
108
|
+
transporter = EWS::Transporter.new(@@credentials.config['location'])
|
126
109
|
original_resp = transporter.submit(basic_new_transaction, :rest)
|
127
110
|
|
128
111
|
req = basic_find_transaction(:transaction_tag => original_resp.transaction_tag)
|
129
112
|
resp = transporter.submit(req, :rest)
|
130
113
|
|
131
|
-
assert_equal
|
132
|
-
assert_equal
|
133
|
-
assert_match
|
114
|
+
assert_equal original_resp.exact_resp_code, resp.exact_resp_code
|
115
|
+
assert_equal original_resp.exact_message, resp.exact_message
|
116
|
+
assert_match original_resp.bank_message, resp.bank_message
|
134
117
|
assert_equal original_resp.transaction_tag, resp.transaction_tag
|
135
118
|
end
|
136
119
|
|
137
120
|
def test_soap_find
|
138
|
-
transporter = EWS::Transporter.new(
|
121
|
+
transporter = EWS::Transporter.new(@@credentials.config['location'])
|
139
122
|
original_resp = transporter.submit(basic_new_transaction, :soap)
|
140
123
|
|
141
124
|
req = basic_find_transaction(:transaction_tag => original_resp.transaction_tag)
|
142
125
|
resp = transporter.submit(req, :soap)
|
143
126
|
|
144
|
-
assert_equal
|
145
|
-
assert_equal
|
146
|
-
assert_match
|
127
|
+
assert_equal original_resp.exact_resp_code, resp.exact_resp_code
|
128
|
+
assert_equal original_resp.exact_message, resp.exact_message
|
129
|
+
assert_match original_resp.bank_message, resp.bank_message
|
147
130
|
assert_equal original_resp.transaction_tag, resp.transaction_tag
|
148
131
|
end
|
149
132
|
|
@@ -151,7 +134,7 @@ class RequestTest < Test::Unit::TestCase
|
|
151
134
|
request = {:nonsense => "this is nonsense"}
|
152
135
|
fake_response = EWS::Transaction::FakeResponse.valid(request)
|
153
136
|
|
154
|
-
transporter = EWS::Transporter.new(
|
137
|
+
transporter = EWS::Transporter.new(@@credentials.config['location'])
|
155
138
|
transporter.stubs(:submit).returns(fake_response)
|
156
139
|
|
157
140
|
response = transporter.submit(request)
|
@@ -163,10 +146,10 @@ class RequestTest < Test::Unit::TestCase
|
|
163
146
|
private
|
164
147
|
def basic_find_transaction(options = {})
|
165
148
|
params = {
|
166
|
-
:transaction_type => :transaction_details
|
149
|
+
:transaction_type => :transaction_details
|
167
150
|
}.merge(options)
|
168
151
|
|
169
|
-
::EWS::Transaction::Request.new(params.merge(
|
152
|
+
::EWS::Transaction::Request.new(params.merge(@@credentials.current_gateway))
|
170
153
|
end
|
171
154
|
|
172
155
|
def basic_new_transaction(options = {})
|
@@ -179,7 +162,7 @@ private
|
|
179
162
|
:reference_no => "987987",
|
180
163
|
}.merge(options)
|
181
164
|
|
182
|
-
::EWS::Transaction::Request.new(params.merge(
|
165
|
+
::EWS::Transaction::Request.new(params.merge(@@credentials.current_gateway))
|
183
166
|
end
|
184
167
|
|
185
168
|
end
|
@@ -10,9 +10,9 @@ class TransporterTest < Test::Unit::TestCase
|
|
10
10
|
:cc_number => "4111111111111111",
|
11
11
|
:cc_expiry => "1012",
|
12
12
|
:reference_no => "987987",
|
13
|
-
}.merge(
|
13
|
+
}.merge(@@credentials.current_gateway))
|
14
14
|
|
15
|
-
tr = ::EWS::Transporter.new(
|
15
|
+
tr = ::EWS::Transporter.new(@@credentials.config['location'])
|
16
16
|
|
17
17
|
# should raise an exception when transport_type is not one of :json, :rest or :soap
|
18
18
|
assert_raises(ArgumentError) {
|
@@ -28,10 +28,10 @@ class TransporterTest < Test::Unit::TestCase
|
|
28
28
|
:cc_number => "4111111111111111",
|
29
29
|
:cc_expiry => "1012",
|
30
30
|
:reference_no => "987987",
|
31
|
-
}.merge(
|
31
|
+
}.merge(@@credentials.current_gateway))
|
32
32
|
|
33
33
|
assert_nothing_raised {
|
34
|
-
tr = ::EWS::Transporter.new(
|
34
|
+
tr = ::EWS::Transporter.new(@@credentials.config['location'])
|
35
35
|
tr.submit(txn)
|
36
36
|
}
|
37
37
|
end
|
@@ -39,11 +39,11 @@ class TransporterTest < Test::Unit::TestCase
|
|
39
39
|
def test_returns_response_object_on_server_failure
|
40
40
|
req = ::EWS::Transaction::Request.new({
|
41
41
|
:transaction_type => :transaction_details
|
42
|
-
}.merge(
|
42
|
+
}.merge(@@credentials.current_gateway))
|
43
43
|
|
44
44
|
req.transaction_tag = 9000 # non-existent txn
|
45
45
|
|
46
|
-
tr = ::EWS::Transporter.new(
|
46
|
+
tr = ::EWS::Transporter.new(@@credentials.config['location'])
|
47
47
|
resp = tr.submit(req, :json)
|
48
48
|
|
49
49
|
assert_not_nil resp
|
@@ -14,8 +14,8 @@ class ValidatorTest < Test::Unit::TestCase
|
|
14
14
|
assert EWS::Transaction::Request.new(basic_params(:cc_number => 'a'*19)).valid?
|
15
15
|
assert !EWS::Transaction::Request.new(basic_params(:cc_number => 'a'*20)).valid?
|
16
16
|
|
17
|
-
assert EWS::Transaction::Request.new(basic_params(:cc_expiry => "
|
18
|
-
assert !EWS::Transaction::Request.new(basic_params(:cc_expiry => "
|
17
|
+
assert EWS::Transaction::Request.new(basic_params(:cc_expiry => "0913")).valid?
|
18
|
+
assert !EWS::Transaction::Request.new(basic_params(:cc_expiry => "09131")).valid?
|
19
19
|
|
20
20
|
assert EWS::Transaction::Request.new(basic_params(:cavv => 'a'*40)).valid?
|
21
21
|
assert !EWS::Transaction::Request.new(basic_params(:cavv => 'a'*41)).valid?
|
data/test/test_helper.rb
CHANGED
@@ -5,19 +5,9 @@ require 'lib/exact4r'
|
|
5
5
|
require 'ruby-debug'
|
6
6
|
require 'mocha'
|
7
7
|
|
8
|
-
|
9
|
-
# LOCATION = "https://api.e-xact.com/" unless defined?(LOCATION)
|
10
|
-
# EMERGIS_BASIC_AUTH = {:gateway_id => "A04052-01", :password => "2b1jvtds"} unless defined?(EMERGIS_BASIC_AUTH)
|
11
|
-
# CHASE_BASIC_AUTH = {:gateway_id => "A05296-01", :password => "exactbatchdemo"} unless defined?(CHASE_BASIC_AUTH)
|
12
|
-
# VITAL_BASIC_AUTH = {:gateway_id => "A05296-01", :password => "exactbatchdemo"} unless defined?(VITAL_BASIC_AUTH)
|
13
|
-
# MONERIS_BASIC_AUTH = {:gateway_id => "A00049-01", :password => "test1"} unless defined?(MONERIS_BASIC_AUTH)
|
8
|
+
require File.dirname(__FILE__) + '/credentials'
|
14
9
|
|
15
|
-
|
16
|
-
LOCATION = "http://ws.local/" unless defined?(LOCATION) # I am a Passenger...
|
17
|
-
EMERGIS_BASIC_AUTH = {:gateway_id => "AD0009-01", :password => "8L588rmd"} unless defined?(EMERGIS_BASIC_AUTH)
|
18
|
-
CHASE_BASIC_AUTH = {:gateway_id => "AD0008-01", :password => "7nfcpc7n"} unless defined?(CHASE_BASIC_AUTH)
|
19
|
-
VITAL_BASIC_AUTH = {:gateway_id => "AD0007-01", :password => "3uLi726f"} unless defined?(VITAL_BASIC_AUTH)
|
20
|
-
MONERIS_BASIC_AUTH = {:gateway_id => "AD0154-01", :password => "77hgy56y"} unless defined?(MONERIS_BASIC_AUTH)
|
10
|
+
@@credentials = Exact::Credentials.new
|
21
11
|
|
22
12
|
TEST_CARD_NUMBER = "4111111111111111" unless defined?(TEST_CARD_NUMBER)
|
23
13
|
TEST_CARD_EXPIRY = "0913" unless defined?(TEST_CARD_EXPIRY)
|
@@ -30,20 +20,20 @@ def cc_number_params
|
|
30
20
|
:cc_number => TEST_CARD_NUMBER,
|
31
21
|
:cc_expiry => TEST_CARD_EXPIRY,
|
32
22
|
:cardholder_name => TEST_CARD_HOLDER
|
33
|
-
}.merge(
|
23
|
+
}.merge(@@credentials.current_gateway)
|
34
24
|
end
|
35
25
|
|
36
26
|
def track1_params
|
37
27
|
{
|
38
28
|
:track1 => TEST_TRACK1
|
39
|
-
}.merge(
|
29
|
+
}.merge(@@credentials.current_gateway)
|
40
30
|
end
|
41
31
|
|
42
32
|
def track2_params
|
43
33
|
{
|
44
34
|
:track2 => TEST_TRACK2,
|
45
35
|
:cardholder_name => TEST_CARD_HOLDER
|
46
|
-
}.merge(
|
36
|
+
}.merge(@@credentials.current_gateway)
|
47
37
|
end
|
48
38
|
|
49
39
|
def assert_details_correct(request, response)
|
@@ -71,7 +61,7 @@ def basic_params(options = {})
|
|
71
61
|
:cardholder_name => "Simon Brown",
|
72
62
|
:cc_number => "4111111111111111",
|
73
63
|
:cc_expiry => "1012"
|
74
|
-
}.merge(
|
64
|
+
}.merge(@@credentials.current_gateway).merge(options)
|
75
65
|
end
|
76
66
|
|
77
67
|
# sample values for every request parameter
|
@@ -91,10 +81,10 @@ def sample_everything_params
|
|
91
81
|
:customer_ref => "REF-321",
|
92
82
|
:cvd_presence_ind => 2,
|
93
83
|
:ecommerce_flag => 9,
|
94
|
-
:gateway_id =>
|
84
|
+
:gateway_id => @@credentials.current_gateway[:gateway_id],
|
95
85
|
:language => 4,
|
96
86
|
:pan => "12345678900987654321",
|
97
|
-
:password =>
|
87
|
+
:password => @@credentials.current_gateway[:password],
|
98
88
|
:reference_3 => "REF-123",
|
99
89
|
:reference_no => "REF-456",
|
100
90
|
:secure_auth_required => 2,
|