exact4r 1.4 → 1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/VERSION +1 -1
- data/after.log +17 -0
- data/lib/ews/transporter.rb +10 -2
- data/test/exhaustive/referenced_void_test.rb +2 -2
- data/test/exhaustive/transaction_details_test.rb +66 -10
- metadata +4 -4
- data/pkg/exact4r-1.2.gem +0 -0
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.5
|
data/after.log
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
(in /Users/donch/Development/Exact/WebService/exact4r)
|
2
|
+
Loaded suite /usr/local/rvm/gems/ruby-1.8.7-p249@global/gems/rake-0.8.7/lib/rake/rake_test_loader
|
3
|
+
Started
|
4
|
+
....................................................................................................................................................F..............
|
5
|
+
Finished in 579.15838 seconds.
|
6
|
+
|
7
|
+
1) Failure:
|
8
|
+
test_encodes_parameters(TransactionDetailsTest)
|
9
|
+
[./test/exhaustive/transaction_details_test.rb:93:in `test_encodes_parameters'
|
10
|
+
./test/exhaustive/transaction_details_test.rb:91:in `each'
|
11
|
+
./test/exhaustive/transaction_details_test.rb:91:in `test_encodes_parameters'
|
12
|
+
/usr/local/rvm/gems/ruby-1.8.7-p249@rpm/gems/mocha-0.9.8/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:19:in `__send__'
|
13
|
+
/usr/local/rvm/gems/ruby-1.8.7-p249@rpm/gems/mocha-0.9.8/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:19:in `run']:
|
14
|
+
<"4111111111111111"> expected but was
|
15
|
+
<nil>.
|
16
|
+
|
17
|
+
163 tests, 2705 assertions, 1 failures, 0 errors
|
data/lib/ews/transporter.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'net/https'
|
2
|
+
require 'uri'
|
2
3
|
require File.dirname(__FILE__) + '/certificate_helper'
|
3
4
|
|
4
5
|
module EWS # :nodoc:
|
@@ -55,7 +56,7 @@ module EWS # :nodoc:
|
|
55
56
|
request = build_http_request(transaction, transport_type, transport_details[:suffix])
|
56
57
|
request.basic_auth(transaction.gateway_id, transaction.password)
|
57
58
|
request.add_field "Accept", transport_details[:content_type]
|
58
|
-
request.add_field "User-Agent", "exact4r v1.
|
59
|
+
request.add_field "User-Agent", "exact4r v1.5"
|
59
60
|
request.add_field "Content-type", "#{transport_details[:content_type]}; charset=UTF-8"
|
60
61
|
|
61
62
|
response = get_connection.request(request)
|
@@ -94,7 +95,14 @@ private
|
|
94
95
|
end
|
95
96
|
req.body = EWS::Transaction::Mapping.send "request_to_#{transport_type.to_s}", transaction
|
96
97
|
else
|
97
|
-
|
98
|
+
param_str = ""
|
99
|
+
escaping_regex = Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")
|
100
|
+
params = [:authorization_num, :reference_no].collect do |attr_name|
|
101
|
+
value = transaction.send(attr_name)
|
102
|
+
value.blank? ? nil : "#{attr_name}=" + URI.escape(value, escaping_regex)
|
103
|
+
end.compact
|
104
|
+
param_str = "?"+params.join('&') unless params.empty?
|
105
|
+
req = Net::HTTP::Get.new(@url.path + "/transaction/#{transaction.transaction_tag}.#{request_suffix}"+param_str)
|
98
106
|
end
|
99
107
|
req
|
100
108
|
end
|
@@ -14,8 +14,8 @@ class ReferencedVoidTest < Test::Unit::TestCase
|
|
14
14
|
request = EWS::Transaction::Request.new(cc_number_params.merge({
|
15
15
|
:transaction_type => :purchase,
|
16
16
|
:amount => 11.25,
|
17
|
-
:reference_no => "reference_no_#{rand(
|
18
|
-
:customer_ref => "customer_ref_#{rand(
|
17
|
+
:reference_no => "reference_no_#{rand(1000)}",
|
18
|
+
:customer_ref => "customer_ref_#{rand(1000)}"
|
19
19
|
}))
|
20
20
|
assert request.valid?, request.errors.inspect
|
21
21
|
|
@@ -38,9 +38,63 @@ class TransactionDetailsTest < Test::Unit::TestCase
|
|
38
38
|
}.merge(@@credentials.current_gateway))
|
39
39
|
assert request.valid?, request.errors.inspect
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
[:json, :rest, :soap].each do |encoding|
|
42
|
+
response = @transporter.submit(request, encoding)
|
43
|
+
assert_equal "############1111", response.cc_number
|
44
|
+
assert_details_match_original_response pre_response, response, encoding
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_supplying_auth_num_decrypts_cc_number
|
49
|
+
# do initial purchase
|
50
|
+
pre_request = EWS::Transaction::Request.new(cc_number_params.merge(:transaction_type => :purchase))
|
51
|
+
pre_request.amount = 10.1
|
52
|
+
assert pre_request.valid?, pre_request.errors.inspect
|
53
|
+
|
54
|
+
pre_response = @transporter.submit(pre_request, :json)
|
55
|
+
assert pre_response.approved?
|
56
|
+
|
57
|
+
request = EWS::Transaction::Request.new({
|
58
|
+
:transaction_type => :transaction_details,
|
59
|
+
:transaction_tag => pre_response.transaction_tag,
|
60
|
+
:authorization_num => pre_response.authorization_num
|
61
|
+
}.merge(@@credentials.current_gateway))
|
62
|
+
assert request.valid?, request.errors.inspect
|
63
|
+
|
64
|
+
[:json, :rest, :soap].each do |encoding|
|
65
|
+
response = @transporter.submit(request, encoding)
|
66
|
+
assert_equal "4111111111111111", response.cc_number
|
67
|
+
assert_details_match_original_response pre_response, response, encoding
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_encodes_parameters
|
72
|
+
# do initial purchase
|
73
|
+
pre_request = EWS::Transaction::Request.new(cc_number_params.merge({
|
74
|
+
:transaction_type => :purchase,
|
75
|
+
:reference_no => "barry&=x=jones"
|
76
|
+
}))
|
77
|
+
pre_request.amount = 10.1
|
78
|
+
assert pre_request.valid?, pre_request.errors.inspect
|
79
|
+
|
80
|
+
pre_response = @transporter.submit(pre_request, :json)
|
81
|
+
assert pre_response.approved?
|
82
|
+
|
83
|
+
request = EWS::Transaction::Request.new({
|
84
|
+
:transaction_type => :transaction_details,
|
85
|
+
:transaction_tag => pre_response.transaction_tag,
|
86
|
+
:authorization_num => pre_response.authorization_num,
|
87
|
+
:reference_no => "barry&=x=jones"
|
88
|
+
}.merge(@@credentials.current_gateway))
|
89
|
+
assert request.valid?, request.errors.inspect
|
90
|
+
|
91
|
+
[:json, :rest, :soap].each do |encoding|
|
92
|
+
response = @transporter.submit(request, encoding)
|
93
|
+
assert_not_nil response, "should not be nil for #{encoding}"
|
94
|
+
assert response.approved?, "#{encoding}: #{response.error_number} / #{response.error_description} / #{response.exact_message}"
|
95
|
+
assert_equal "4111111111111111", response.cc_number, "should match for #{encoding}"
|
96
|
+
assert_details_match_original_response pre_response, response, encoding
|
97
|
+
end
|
44
98
|
end
|
45
99
|
|
46
100
|
def test_debit_transaction_details
|
@@ -64,17 +118,19 @@ class TransactionDetailsTest < Test::Unit::TestCase
|
|
64
118
|
}.merge(@@credentials.current_gateway))
|
65
119
|
assert request.valid?, request.errors.inspect
|
66
120
|
|
67
|
-
|
68
|
-
|
69
|
-
|
121
|
+
[:json, :rest, :soap].each do |encoding|
|
122
|
+
response = @transporter.submit(request, encoding)
|
123
|
+
assert_equal "############1111", response.cc_number
|
124
|
+
assert_details_match_original_response pre_response, response, encoding
|
125
|
+
end
|
70
126
|
end
|
71
127
|
|
72
|
-
def assert_details_match_original_response(original_response, details_response)
|
73
|
-
# exclude: client_ip, pan
|
128
|
+
def assert_details_match_original_response(original_response, details_response, encoding)
|
129
|
+
# exclude: client_ip, pan, cc_number
|
74
130
|
[:logon_message, :error_number, :error_description, :transaction_error, :transaction_approved, :exact_resp_code, :exact_message,
|
75
131
|
:bank_resp_code, :bank_message, :bank_resp_code_2, :sequence_no, :avs, :cvv2, :retrieval_ref_no, :cavv_response, :merchant_name,
|
76
132
|
:merchant_address, :merchant_city, :merchant_province, :merchant_country, :merchant_postal, :merchant_url, :gateway_id, :password,
|
77
|
-
:transaction_type, :amount, :surcharge_amount, :
|
133
|
+
:transaction_type, :amount, :surcharge_amount, :transaction_tag, :track1, :track2, :authorization_num, :cc_expiry,
|
78
134
|
:cardholder_name, :cc_verification_str1, :cc_verification_str2, :cvd_presence_ind, :tax1_amount, :tax1_number, :tax2_amount,
|
79
135
|
:tax2_number, :secure_auth_required, :secure_auth_result, :ecommerce_flag, :xid, :cavv, :cavv_algorithm, :reference_no, :customer_ref,
|
80
136
|
:reference_3, :language, :client_email, :user_name, :zip_code].each do |attr_name|
|
@@ -82,7 +138,7 @@ class TransactionDetailsTest < Test::Unit::TestCase
|
|
82
138
|
|
83
139
|
o_value = original_response.send(attr_name).to_s
|
84
140
|
d_value = details_response.send(attr_name).to_s
|
85
|
-
assert_equal o_value, d_value, "#{attr_name}: #{o_value} / #{d_value}"
|
141
|
+
assert_equal o_value, d_value, "Encoding: #{encoding} - #{attr_name}: #{o_value} / #{d_value}"
|
86
142
|
end
|
87
143
|
end
|
88
144
|
private :assert_details_match_original_response
|
metadata
CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
8
|
-
version: "1.
|
7
|
+
- 5
|
8
|
+
version: "1.5"
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- E-xact Transactions Ltd.
|
@@ -13,7 +13,7 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2010-
|
16
|
+
date: 2010-11-02 00:00:00 +11:00
|
17
17
|
default_executable:
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
@@ -56,6 +56,7 @@ extra_rdoc_files:
|
|
56
56
|
- README
|
57
57
|
- VERSION
|
58
58
|
files:
|
59
|
+
- ./after.log
|
59
60
|
- ./certs/e-xact.com.crt
|
60
61
|
- ./certs/equifax_ca.cer
|
61
62
|
- ./certs/exact.cer
|
@@ -71,7 +72,6 @@ files:
|
|
71
72
|
- ./lib/ews/transporter.rb
|
72
73
|
- ./lib/exact4r.rb
|
73
74
|
- ./LICENCE
|
74
|
-
- ./pkg/exact4r-1.2.gem
|
75
75
|
- ./Rakefile
|
76
76
|
- ./README
|
77
77
|
- ./test/credentials.rb
|
data/pkg/exact4r-1.2.gem
DELETED
Binary file
|