exact4r 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/README +7 -0
- data/VERSION +1 -1
- data/doc/classes/EWS/Transaction/Transporter.html +3 -3
- data/doc/created.rid +1 -1
- data/doc/files/CHANGELOG.html +6 -2
- data/doc/files/VERSION.html +2 -2
- data/doc/files/lib/ews/transaction/request_rb.html +1 -1
- data/doc/files/lib/ews/transaction/transporter_rb.html +1 -1
- data/lib/ews/transaction/response.rb +5 -1
- data/lib/ews/transaction/transporter.rb +47 -57
- data/output.log +368 -0
- data/spec/request_spec.rb +7 -4
- data/spec/spec_helper.rb +4 -4
- data/spec/transporter_spec.rb +1 -42
- metadata +3 -3
- data/spec/donncha.rb +0 -46
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== v0.5.2
|
2
|
+
Updated Transporter to play nicely with mod_security
|
3
|
+
Stripped trailing '/'s from URLs
|
4
|
+
Transporter ow re-uses connection
|
5
|
+
Updated RDoc with test login details
|
6
|
+
|
1
7
|
== v0.5.1
|
2
8
|
Added CHANGELOG, LICENCE & VERSION
|
3
9
|
Ensured README etc. were included in gem and displayed as default in RDoc
|
data/README
CHANGED
@@ -4,6 +4,13 @@ of financial transactions via REST, JSON or SOAP.
|
|
4
4
|
|
5
5
|
== Getting Started
|
6
6
|
|
7
|
+
To submit requests to our transaction processing service, you must first have a Gateway ID,
|
8
|
+
and a password. Test logins are as follows:
|
9
|
+
|
10
|
+
Account 1: :gateway_id => "A00049-01", :password => "test1"
|
11
|
+
Account 2: :gateway_id => "A00427-01", :password => "testus"
|
12
|
+
|
13
|
+
|
7
14
|
=1. Submit a transaction
|
8
15
|
|
9
16
|
require 'rubygems'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
@@ -136,7 +136,7 @@ repeatedly to send as many transactions as required.
|
|
136
136
|
|
137
137
|
<div class="method-heading">
|
138
138
|
<a href="#M000001" class="method-signature">
|
139
|
-
<span class="method-name">new</span><span class="method-args">(url = "
|
139
|
+
<span class="method-name">new</span><span class="method-args">(url = "http://api.dev.e-xact.com/", options = {})</span>
|
140
140
|
</a>
|
141
141
|
</div>
|
142
142
|
|
@@ -171,12 +171,12 @@ method.
|
|
171
171
|
<div class="method-source-code" id="M000001-source">
|
172
172
|
<pre>
|
173
173
|
<span class="ruby-comment cmt"># File lib/ews/transaction/transporter.rb, line 34</span>
|
174
|
-
34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">url</span> = <span class="ruby-value str">"
|
174
|
+
34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">url</span> = <span class="ruby-value str">"http://api.dev.e-xact.com/"</span>, <span class="ruby-identifier">options</span> = {})
|
175
175
|
35: <span class="ruby-ivar">@url</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">url</span>)
|
176
176
|
36: <span class="ruby-identifier">base</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>)
|
177
177
|
37: <span class="ruby-ivar">@server_cert</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:server_cert</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">base</span><span class="ruby-operator">+</span><span class="ruby-value str">"/../../../certs/exact.cer"</span>
|
178
178
|
38: <span class="ruby-ivar">@issuer_cert</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:issuer_cert</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">base</span><span class="ruby-operator">+</span><span class="ruby-value str">"/../../../certs/equifax_ca.cer"</span>
|
179
|
-
39: <span class="ruby-ivar">@transport_type</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:
|
179
|
+
39: <span class="ruby-ivar">@transport_type</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:transport_type</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">:rest</span>
|
180
180
|
40: <span class="ruby-keyword kw">end</span>
|
181
181
|
</pre>
|
182
182
|
</div>
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Fri, 30 May 2008
|
1
|
+
Fri, 30 May 2008 18:19:20 +1000
|
data/doc/files/CHANGELOG.html
CHANGED
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Fri May 30
|
59
|
+
<td>Fri May 30 18:19:07 +1000 2008</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -69,7 +69,11 @@
|
|
69
69
|
<div id="contextContent">
|
70
70
|
|
71
71
|
<div id="description">
|
72
|
-
<h2>v0.5.
|
72
|
+
<h2>v0.5.2</h2>
|
73
|
+
<pre>
|
74
|
+
Updated Transporter to play nicely with mod_security
|
75
|
+
</pre>
|
76
|
+
<h2>v0.5.1</h2>
|
73
77
|
<pre>
|
74
78
|
Added CHANGELOG, LICENCE & VERSION
|
75
79
|
Ensured README etc. were included in gem and displayed as default in RDoc
|
data/doc/files/VERSION.html
CHANGED
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Fri May 30
|
59
|
+
<td>Fri May 30 18:19:10 +1000 2008</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -70,7 +70,7 @@
|
|
70
70
|
|
71
71
|
<div id="description">
|
72
72
|
<p>
|
73
|
-
0.5.
|
73
|
+
0.5.2
|
74
74
|
</p>
|
75
75
|
|
76
76
|
</div>
|
@@ -2,13 +2,17 @@ module EWS # :nodoc:
|
|
2
2
|
module Transaction # :nodoc:
|
3
3
|
|
4
4
|
# This class encapsulates all the data returned from the E-xact Web Service.
|
5
|
-
class Response
|
5
|
+
class Response
|
6
6
|
|
7
7
|
attr_accessor :logon_message, :error_number, :error_description, :transaction_error, :transaction_approved
|
8
8
|
attr_accessor :exact_resp_code, :exact_message, :bank_resp_code, :bank_message, :bank_resp_code_2
|
9
9
|
attr_accessor :sequence_no, :avs, :cvv2, :retrieval_ref_no, :cavv_response
|
10
10
|
attr_accessor :merchant_name, :merchant_address, :merchant_city, :merchant_province, :merchant_country, :merchant_postal, :merchant_url, :CTR
|
11
11
|
|
12
|
+
attr_accessor :gateway_id, :password, :transaction_type, :amount, :surcharge_amount, :cc_number, :transaction_tag, :track1, :track2, :pan, :auth_number, :cc_expiry, :cardholder_name
|
13
|
+
attr_accessor :cc_verification_str1, :cc_verification_str2, :cvd_presence_ind, :tax1_amount, :tax1_number, :tax2_amount, :tax2_number, :secure_auth_required, :secure_auth_result
|
14
|
+
attr_accessor :ecommerce_flag, :xid, :cavv, :cavv_algorithm, :reference_no, :customer_ref, :reference_3, :language, :client_ip, :client_email, :user_name
|
15
|
+
|
12
16
|
# Indicates whether or not the transaction was approved
|
13
17
|
def approved?
|
14
18
|
self.transaction_approved == 1
|
@@ -6,7 +6,7 @@ module EWS # :nodoc:
|
|
6
6
|
# A Transporter is responsible for communicating with the E-xact Web Service in
|
7
7
|
# whichever dialect is chosen by the user. The available options are:
|
8
8
|
# :json REST with JSON payload
|
9
|
-
# :rest REST with XML payload
|
9
|
+
# :rest REST with XML payload (default)
|
10
10
|
# :soap SOAP
|
11
11
|
#
|
12
12
|
# The Transporter will connect to the service, using SSL if required, and will
|
@@ -19,95 +19,85 @@ module EWS # :nodoc:
|
|
19
19
|
|
20
20
|
# Initialize a Transporter.
|
21
21
|
#
|
22
|
-
# You can specify the URL you would like the Transporter to connect to,
|
23
|
-
#
|
24
|
-
# service.
|
22
|
+
# You can specify the URL you would like the Transporter to connect to, although it defaults
|
23
|
+
# to https://api.e-xact.com, the location of our transaction processing web service.
|
25
24
|
#
|
26
25
|
# You can also specify a hash of options as follows:
|
27
26
|
# :server_cert the path to the server's certificate
|
28
27
|
# :issuer_cert the path to the certificate of the issuer of the server certificate
|
29
|
-
# :transport_type the default transport_type for this transporter
|
28
|
+
# :transport_type the default transport_type for this transporter (defaults to :rest)
|
30
29
|
#
|
31
30
|
# The default certificates are those required to connect to https://api.e-xact.com and the
|
32
31
|
# default <tt>transport_type</tt> is <tt>:rest</tt>. The default <tt>transport_type</tt> can be overridden on a per-transaction
|
33
32
|
# basis, if you choose to do so, by specifying it as a parameter to the <tt>send</tt> method.
|
34
33
|
def initialize(url = "https://api.e-xact.com/", options = {})
|
35
|
-
@url = URI.parse(url)
|
34
|
+
@url = URI.parse(url.gsub(/\/$/,''))
|
36
35
|
base = File.dirname(__FILE__)
|
37
36
|
@server_cert = options[:server_cert] || base+"/../../../certs/exact.cer"
|
38
37
|
@issuer_cert = options[:issuer_cert] || base+"/../../../certs/equifax_ca.cer"
|
39
|
-
@transport_type = options[:
|
38
|
+
@transport_type = options[:transport_type] || :rest
|
40
39
|
end
|
41
40
|
|
42
41
|
# Send a transaction request to the server
|
43
42
|
#
|
44
|
-
# <tt>
|
45
|
-
# <tt>transport_type</tt>:: (optional) the transport type to use for this transaction only. If it not specified, the
|
46
|
-
def submit(
|
47
|
-
raise "Request not supplied" if
|
48
|
-
return false unless
|
43
|
+
# <tt>transaction</tt>:: the Request object to encode for transmission to the server
|
44
|
+
# <tt>transport_type</tt>:: (optional) the transport type to use for this transaction only. If it is not specified, the Transporter's transport type will be used
|
45
|
+
def submit(transaction, transport_type = nil)
|
46
|
+
raise "Request not supplied" if transaction.nil?
|
47
|
+
return false unless transaction.valid?
|
49
48
|
|
50
49
|
transport_type ||= @transport_type
|
51
50
|
|
52
51
|
raise "Transport type #{transport_type} is not supported" unless @@transport_types.include? transport_type
|
53
52
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
EWS::Transaction::Mapping.send "#{transport_type}_to_response", content
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
def post(request, transport_type)
|
66
|
-
# build the request
|
67
|
-
req = Net::HTTP::Post.new(@url.path + "transaction.#{@@transport_types[transport_type]}")
|
68
|
-
req.basic_auth(request.gateway_id, request.password)
|
69
|
-
if transport_type == :soap
|
70
|
-
# add the SOAPAction header
|
71
|
-
soapaction = (request.is_find_transaction?) ? "TransactionInfo" : "SendAndCommit"
|
72
|
-
req.add_field "soapaction", "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/#{soapaction}"
|
73
|
-
end
|
74
|
-
req.content_type = (transport_type == :json) ? "application/json" : "application/xml"
|
75
|
-
req.body = EWS::Transaction::Mapping.send "request_to_#{transport_type.to_s}", request
|
53
|
+
transport_details = @@transport_types[transport_type]
|
54
|
+
|
55
|
+
request = build_http_request(transaction, transport_type, transport_details[:suffix])
|
56
|
+
request.basic_auth(transaction.gateway_id, transaction.password)
|
57
|
+
request["User-Agent"] = "Ruby"
|
58
|
+
request.content_type = "#{transport_details[:content_type]}; charset=UTF-8"
|
76
59
|
|
77
|
-
response = get_connection.request(
|
60
|
+
response = get_connection.request(request)
|
78
61
|
|
79
62
|
case response
|
80
|
-
when Net::HTTPSuccess then response.body
|
63
|
+
when Net::HTTPSuccess then EWS::Transaction::Mapping.send "#{transport_type}_to_response", response.body
|
81
64
|
else
|
82
65
|
response.error!
|
83
66
|
end
|
84
|
-
end
|
85
67
|
|
86
|
-
|
87
|
-
# build the request
|
88
|
-
req = Net::HTTP::Get.new(@url.path + "transaction/#{request.transaction_tag}.#{@@transport_types[transport_type]}")
|
89
|
-
req.basic_auth(request.gateway_id, request.password)
|
90
|
-
req.content_type = (transport_type == :json) ? "application/json" : "application/xml"
|
68
|
+
end
|
91
69
|
|
92
|
-
|
70
|
+
private
|
93
71
|
|
94
|
-
|
95
|
-
|
72
|
+
def build_http_request(transaction, transport_type, request_suffix)
|
73
|
+
req = nil
|
74
|
+
if !transaction.is_find_transaction? or transport_type == :soap
|
75
|
+
req = Net::HTTP::Post.new(@url.path + "/transaction.#{request_suffix}")
|
76
|
+
if transport_type == :soap
|
77
|
+
# add the SOAPAction header
|
78
|
+
soapaction = (transaction.is_find_transaction?) ? "TransactionInfo" : "SendAndCommit"
|
79
|
+
req.add_field "soapaction", "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/#{soapaction}"
|
80
|
+
end
|
81
|
+
req.body = EWS::Transaction::Mapping.send "request_to_#{transport_type.to_s}", transaction
|
96
82
|
else
|
97
|
-
|
83
|
+
req = Net::HTTP::Get.new(@url.path + "/transaction/#{transaction.transaction_tag}.#{request_suffix}")
|
98
84
|
end
|
85
|
+
req
|
99
86
|
end
|
100
|
-
|
87
|
+
|
101
88
|
def get_connection
|
102
|
-
connection
|
103
|
-
connection
|
89
|
+
# re-use the connection if it's available
|
90
|
+
return @connection unless @connection.nil?
|
91
|
+
|
92
|
+
@connection = Net::HTTP.new(@url.host, @url.port)
|
93
|
+
@connection.set_debug_output $stdout if $DEBUG
|
104
94
|
if @url.scheme == 'https'
|
105
|
-
connection.use_ssl = true
|
106
|
-
connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
107
|
-
connection.ca_file = @issuer_cert
|
108
|
-
connection.verify_callback = method(:validate_certificate)
|
95
|
+
@connection.use_ssl = true
|
96
|
+
@connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
97
|
+
@connection.ca_file = @issuer_cert
|
98
|
+
@connection.verify_callback = method(:validate_certificate)
|
109
99
|
end
|
110
|
-
connection
|
100
|
+
@connection
|
111
101
|
end
|
112
102
|
|
113
103
|
def validate_certificate(is_ok, ctx)
|
@@ -120,9 +110,9 @@ module EWS # :nodoc:
|
|
120
110
|
|
121
111
|
# what transport types we support, and their corresponding suffixes
|
122
112
|
@@transport_types = {
|
123
|
-
:rest => "xml",
|
124
|
-
:json => "json",
|
125
|
-
:soap => "xmlsoap"
|
113
|
+
:rest => {:suffix => "xml", :content_type => "application/xml"},
|
114
|
+
:json => {:suffix => "json", :content_type => "application/json"},
|
115
|
+
:soap => {:suffix => "xmlsoap", :content_type => "application/xml"}
|
126
116
|
}
|
127
117
|
|
128
118
|
end
|
data/output.log
ADDED
@@ -0,0 +1,368 @@
|
|
1
|
+
Index: VERSION
|
2
|
+
===================================================================
|
3
|
+
--- VERSION (revision 6047)
|
4
|
+
+++ VERSION (working copy)
|
5
|
+
@@ -1 +1 @@
|
6
|
+
-0.5.1
|
7
|
+
|
8
|
+
+0.5.2
|
9
|
+
|
10
|
+
Index: lib/ews/transaction/response.rb
|
11
|
+
===================================================================
|
12
|
+
--- lib/ews/transaction/response.rb (revision 6043)
|
13
|
+
+++ lib/ews/transaction/response.rb (working copy)
|
14
|
+
@@ -2,13 +2,17 @@
|
15
|
+
module Transaction # :nodoc:
|
16
|
+
|
17
|
+
# This class encapsulates all the data returned from the E-xact Web Service.
|
18
|
+
- class Response < EWS::Transaction::Request
|
19
|
+
+ class Response
|
20
|
+
|
21
|
+
attr_accessor :logon_message, :error_number, :error_description, :transaction_error, :transaction_approved
|
22
|
+
attr_accessor :exact_resp_code, :exact_message, :bank_resp_code, :bank_message, :bank_resp_code_2
|
23
|
+
attr_accessor :sequence_no, :avs, :cvv2, :retrieval_ref_no, :cavv_response
|
24
|
+
attr_accessor :merchant_name, :merchant_address, :merchant_city, :merchant_province, :merchant_country, :merchant_postal, :merchant_url, :CTR
|
25
|
+
|
26
|
+
+ attr_accessor :gateway_id, :password, :transaction_type, :amount, :surcharge_amount, :cc_number, :transaction_tag, :track1, :track2, :pan, :auth_number, :cc_expiry, :cardholder_name
|
27
|
+
+ attr_accessor :cc_verification_str1, :cc_verification_str2, :cvd_presence_ind, :tax1_amount, :tax1_number, :tax2_amount, :tax2_number, :secure_auth_required, :secure_auth_result
|
28
|
+
+ attr_accessor :ecommerce_flag, :xid, :cavv, :cavv_algorithm, :reference_no, :customer_ref, :reference_3, :language, :client_ip, :client_email, :user_name
|
29
|
+
+
|
30
|
+
# Indicates whether or not the transaction was approved
|
31
|
+
def approved?
|
32
|
+
self.transaction_approved == 1
|
33
|
+
Index: lib/ews/transaction/transporter.rb
|
34
|
+
===================================================================
|
35
|
+
--- lib/ews/transaction/transporter.rb (revision 6047)
|
36
|
+
+++ lib/ews/transaction/transporter.rb (working copy)
|
37
|
+
@@ -6,7 +6,7 @@
|
38
|
+
# A Transporter is responsible for communicating with the E-xact Web Service in
|
39
|
+
# whichever dialect is chosen by the user. The available options are:
|
40
|
+
# :json REST with JSON payload
|
41
|
+
- # :rest REST with XML payload
|
42
|
+
+ # :rest REST with XML payload (default)
|
43
|
+
# :soap SOAP
|
44
|
+
#
|
45
|
+
# The Transporter will connect to the service, using SSL if required, and will
|
46
|
+
@@ -19,95 +19,85 @@
|
47
|
+
|
48
|
+
# Initialize a Transporter.
|
49
|
+
#
|
50
|
+
- # You can specify the URL you would like the Transporter to connect to,
|
51
|
+
- # although it defaults to https://api.e-xact.com, the location of our web
|
52
|
+
- # service.
|
53
|
+
+ # You can specify the URL you would like the Transporter to connect to, although it defaults
|
54
|
+
+ # to https://api.e-xact.com, the location of our transaction processing web service.
|
55
|
+
#
|
56
|
+
# You can also specify a hash of options as follows:
|
57
|
+
# :server_cert the path to the server's certificate
|
58
|
+
# :issuer_cert the path to the certificate of the issuer of the server certificate
|
59
|
+
- # :transport_type the default transport_type for this transporter
|
60
|
+
+ # :transport_type the default transport_type for this transporter (defaults to :rest)
|
61
|
+
#
|
62
|
+
# The default certificates are those required to connect to https://api.e-xact.com and the
|
63
|
+
# default <tt>transport_type</tt> is <tt>:rest</tt>. The default <tt>transport_type</tt> can be overridden on a per-transaction
|
64
|
+
# basis, if you choose to do so, by specifying it as a parameter to the <tt>send</tt> method.
|
65
|
+
def initialize(url = "https://api.e-xact.com/", options = {})
|
66
|
+
- @url = URI.parse(url)
|
67
|
+
+ @url = URI.parse(url.gsub(/\/$/,''))
|
68
|
+
base = File.dirname(__FILE__)
|
69
|
+
@server_cert = options[:server_cert] || base+"/../../../certs/exact.cer"
|
70
|
+
@issuer_cert = options[:issuer_cert] || base+"/../../../certs/equifax_ca.cer"
|
71
|
+
- @transport_type = options[:issuer_cert] || :rest
|
72
|
+
+ @transport_type = options[:transport_type] || :rest
|
73
|
+
end
|
74
|
+
|
75
|
+
# Send a transaction request to the server
|
76
|
+
#
|
77
|
+
- # <tt>request</tt>:: the Request object to encode for transmission to the server
|
78
|
+
- # <tt>transport_type</tt>:: (optional) the transport type to use for this transaction only. If it not specified, the default transport type for this Transporter will be used
|
79
|
+
- def submit(request, transport_type = nil)
|
80
|
+
- raise "Request not supplied" if request.nil?
|
81
|
+
- return false unless request.valid?
|
82
|
+
+ # <tt>transaction</tt>:: the Request object to encode for transmission to the server
|
83
|
+
+ # <tt>transport_type</tt>:: (optional) the transport type to use for this transaction only. If it is not specified, the Transporter's transport type will be used
|
84
|
+
+ def submit(transaction, transport_type = nil)
|
85
|
+
+ raise "Request not supplied" if transaction.nil?
|
86
|
+
+ return false unless transaction.valid?
|
87
|
+
|
88
|
+
transport_type ||= @transport_type
|
89
|
+
|
90
|
+
raise "Transport type #{transport_type} is not supported" unless @@transport_types.include? transport_type
|
91
|
+
|
92
|
+
- if !request.is_find_transaction? or transport_type == :soap
|
93
|
+
- content = post(request, transport_type)
|
94
|
+
- else
|
95
|
+
- content = get(request, transport_type)
|
96
|
+
- end
|
97
|
+
+ transport_details = @@transport_types[transport_type]
|
98
|
+
+
|
99
|
+
+ request = build_http_request(transaction, transport_type, transport_details[:suffix])
|
100
|
+
+ request.basic_auth(transaction.gateway_id, transaction.password)
|
101
|
+
+ request["User-Agent"] = "Ruby"
|
102
|
+
+ request.content_type = "#{transport_details[:content_type]}; charset=UTF-8"
|
103
|
+
|
104
|
+
- EWS::Transaction::Mapping.send "#{transport_type}_to_response", content
|
105
|
+
- end
|
106
|
+
+ response = get_connection.request(request)
|
107
|
+
|
108
|
+
- private
|
109
|
+
-
|
110
|
+
- def post(request, transport_type)
|
111
|
+
- # build the request
|
112
|
+
- req = Net::HTTP::Post.new(@url.path + "transaction.#{@@transport_types[transport_type]}")
|
113
|
+
- req.basic_auth(request.gateway_id, request.password)
|
114
|
+
- if transport_type == :soap
|
115
|
+
- # add the SOAPAction header
|
116
|
+
- soapaction = (request.is_find_transaction?) ? "TransactionInfo" : "SendAndCommit"
|
117
|
+
- req.add_field "soapaction", "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/#{soapaction}"
|
118
|
+
- end
|
119
|
+
- req.content_type = (transport_type == :json) ? "application/json" : "application/xml"
|
120
|
+
- req.body = EWS::Transaction::Mapping.send "request_to_#{transport_type.to_s}", request
|
121
|
+
-
|
122
|
+
- response = get_connection.request(req)
|
123
|
+
-
|
124
|
+
case response
|
125
|
+
- when Net::HTTPSuccess then response.body
|
126
|
+
+ when Net::HTTPSuccess then EWS::Transaction::Mapping.send "#{transport_type}_to_response", response.body
|
127
|
+
else
|
128
|
+
response.error!
|
129
|
+
end
|
130
|
+
+
|
131
|
+
end
|
132
|
+
|
133
|
+
- def get(request, transport_type)
|
134
|
+
- # build the request
|
135
|
+
- req = Net::HTTP::Get.new(@url.path + "transaction/#{request.transaction_tag}.#{@@transport_types[transport_type]}")
|
136
|
+
- req.basic_auth(request.gateway_id, request.password)
|
137
|
+
- req.content_type = (transport_type == :json) ? "application/json" : "application/xml"
|
138
|
+
+ private
|
139
|
+
|
140
|
+
- response = get_connection.request(req)
|
141
|
+
-
|
142
|
+
- case response
|
143
|
+
- when Net::HTTPSuccess then response.body
|
144
|
+
+ def build_http_request(transaction, transport_type, request_suffix)
|
145
|
+
+ req = nil
|
146
|
+
+ if !transaction.is_find_transaction? or transport_type == :soap
|
147
|
+
+ req = Net::HTTP::Post.new(@url.path + "/transaction.#{request_suffix}")
|
148
|
+
+ if transport_type == :soap
|
149
|
+
+ # add the SOAPAction header
|
150
|
+
+ soapaction = (transaction.is_find_transaction?) ? "TransactionInfo" : "SendAndCommit"
|
151
|
+
+ req.add_field "soapaction", "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/#{soapaction}"
|
152
|
+
+ end
|
153
|
+
+ req.body = EWS::Transaction::Mapping.send "request_to_#{transport_type.to_s}", transaction
|
154
|
+
else
|
155
|
+
- response.error!
|
156
|
+
+ req = Net::HTTP::Get.new(@url.path + "/transaction/#{transaction.transaction_tag}.#{request_suffix}")
|
157
|
+
end
|
158
|
+
+ req
|
159
|
+
end
|
160
|
+
-
|
161
|
+
+
|
162
|
+
def get_connection
|
163
|
+
- connection = Net::HTTP.new(@url.host, @url.port)
|
164
|
+
- connection.set_debug_output $stdout if $DEBUG
|
165
|
+
+ # re-use the connection if it's available
|
166
|
+
+ return @connection unless @connection.nil?
|
167
|
+
+
|
168
|
+
+ @connection = Net::HTTP.new(@url.host, @url.port)
|
169
|
+
+ @connection.set_debug_output $stdout if $DEBUG
|
170
|
+
if @url.scheme == 'https'
|
171
|
+
- connection.use_ssl = true
|
172
|
+
- connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
173
|
+
- connection.ca_file = @issuer_cert
|
174
|
+
- connection.verify_callback = method(:validate_certificate)
|
175
|
+
+ @connection.use_ssl = true
|
176
|
+
+ @connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
177
|
+
+ @connection.ca_file = @issuer_cert
|
178
|
+
+ @connection.verify_callback = method(:validate_certificate)
|
179
|
+
end
|
180
|
+
- connection
|
181
|
+
+ @connection
|
182
|
+
end
|
183
|
+
|
184
|
+
def validate_certificate(is_ok, ctx)
|
185
|
+
@@ -120,9 +110,9 @@
|
186
|
+
|
187
|
+
# what transport types we support, and their corresponding suffixes
|
188
|
+
@@transport_types = {
|
189
|
+
- :rest => "xml",
|
190
|
+
- :json => "json",
|
191
|
+
- :soap => "xmlsoap"
|
192
|
+
+ :rest => {:suffix => "xml", :content_type => "application/xml"},
|
193
|
+
+ :json => {:suffix => "json", :content_type => "application/json"},
|
194
|
+
+ :soap => {:suffix => "xmlsoap", :content_type => "application/xml"}
|
195
|
+
}
|
196
|
+
|
197
|
+
end
|
198
|
+
Index: CHANGELOG
|
199
|
+
===================================================================
|
200
|
+
--- CHANGELOG (revision 6047)
|
201
|
+
+++ CHANGELOG (working copy)
|
202
|
+
@@ -1,3 +1,9 @@
|
203
|
+
+== v0.5.2
|
204
|
+
+ Updated Transporter to play nicely with mod_security
|
205
|
+
+ Stripped trailing '/'s from URLs
|
206
|
+
+ Now re-use same connection
|
207
|
+
+ Updated RDoc with test login details
|
208
|
+
+
|
209
|
+
== v0.5.1
|
210
|
+
Added CHANGELOG, LICENCE & VERSION
|
211
|
+
Ensured README etc. were included in gem and displayed as default in RDoc
|
212
|
+
Index: spec/transporter_spec.rb
|
213
|
+
===================================================================
|
214
|
+
--- spec/transporter_spec.rb (revision 6047)
|
215
|
+
+++ spec/transporter_spec.rb (working copy)
|
216
|
+
@@ -14,49 +14,8 @@
|
217
|
+
|
218
|
+
lambda {
|
219
|
+
tr = ::EWS::Transaction::Transporter.new
|
220
|
+
- tr.submit(txn, json)
|
221
|
+
+ tr.submit(txn)
|
222
|
+
}.should_not raise_error(RuntimeError)
|
223
|
+
end
|
224
|
+
|
225
|
+
-
|
226
|
+
end
|
227
|
+
-
|
228
|
+
-describe "Transporter finding transactions" do
|
229
|
+
-
|
230
|
+
- before :each do
|
231
|
+
- txn = basic_new_transaction
|
232
|
+
- @tr = ::EWS::Transaction::Transporter.new
|
233
|
+
- r = @tr.submit(txn, :json)
|
234
|
+
- @transaction_tag = r.transaction_tag
|
235
|
+
- end
|
236
|
+
-
|
237
|
+
- it "should support all transport types" do
|
238
|
+
- [:json, :rest, :soap].each do |type|
|
239
|
+
- txn = basic_find_transaction(:transaction_tag => @transaction_tag)
|
240
|
+
- resp = @tr.submit(txn, type)
|
241
|
+
-
|
242
|
+
- resp.transaction_tag.should == @transaction_tag
|
243
|
+
- resp.cc_number == "4111111111111"
|
244
|
+
- resp.exact_resp_code.should == "00"
|
245
|
+
- resp.exact_message.should == "Transaction Normal"
|
246
|
+
- resp.bank_message.should == "APPROVED"
|
247
|
+
- end
|
248
|
+
- end
|
249
|
+
-
|
250
|
+
-end
|
251
|
+
-
|
252
|
+
-describe "Transporter creating and finding transactions" do
|
253
|
+
-
|
254
|
+
- it "should support all transport types" do
|
255
|
+
- [:json, :rest, :soap].each do |type|
|
256
|
+
- tr = ::EWS::Transaction::Transporter.new
|
257
|
+
- new_txn = tr.submit(basic_new_transaction, type)
|
258
|
+
- new_txn.transaction_tag.should_not be_nil
|
259
|
+
-
|
260
|
+
- found_txn = tr.submit(basic_find_transaction(:transaction_tag => new_txn.transaction_tag), :json)
|
261
|
+
- found_txn.should_not be_nil
|
262
|
+
- found_txn.transaction_tag.should == new_txn.transaction_tag
|
263
|
+
- end
|
264
|
+
- end
|
265
|
+
-
|
266
|
+
-end
|
267
|
+
|
268
|
+
Index: spec/request_spec.rb
|
269
|
+
===================================================================
|
270
|
+
--- spec/request_spec.rb (revision 6047)
|
271
|
+
+++ spec/request_spec.rb (working copy)
|
272
|
+
@@ -70,7 +70,7 @@
|
273
|
+
|
274
|
+
resp.exact_resp_code.should == "00"
|
275
|
+
resp.exact_message.should == "Transaction Normal"
|
276
|
+
- resp.bank_message.should == "APPROVED"
|
277
|
+
+ resp.bank_message.downcase.should match(/approved/)
|
278
|
+
resp.transaction_tag.should_not be_nil
|
279
|
+
end
|
280
|
+
|
281
|
+
@@ -81,7 +81,7 @@
|
282
|
+
|
283
|
+
resp.exact_resp_code.should == "00"
|
284
|
+
resp.exact_message.should == "Transaction Normal"
|
285
|
+
- resp.bank_message.should == "APPROVED"
|
286
|
+
+ resp.bank_message.downcase.should match(/approved/)
|
287
|
+
resp.transaction_tag.should_not be_nil
|
288
|
+
end
|
289
|
+
end
|
290
|
+
@@ -95,6 +95,9 @@
|
291
|
+
|
292
|
+
txn = basic_new_transaction
|
293
|
+
@transaction_tag = @transporter.submit(txn, :json).transaction_tag
|
294
|
+
+ puts "Sleeping for replication: #{REPLICATION_TIME}s"
|
295
|
+
+ sleep(REPLICATION_TIME) # need time for replication to take place on the host
|
296
|
+
+ puts "Awake"
|
297
|
+
end
|
298
|
+
|
299
|
+
it "should work without a specified transport_type" do
|
300
|
+
@@ -103,7 +106,7 @@
|
301
|
+
|
302
|
+
resp.exact_resp_code.should == "00"
|
303
|
+
resp.exact_message.should == "Transaction Normal"
|
304
|
+
- resp.bank_message.should == "APPROVED"
|
305
|
+
+ resp.bank_message.downcase.should match(/approved/)
|
306
|
+
resp.transaction_tag.should_not be_nil
|
307
|
+
end
|
308
|
+
|
309
|
+
@@ -116,7 +119,7 @@
|
310
|
+
resp.cc_number == "4111111111111"
|
311
|
+
resp.exact_resp_code.should == "00"
|
312
|
+
resp.exact_message.should == "Transaction Normal"
|
313
|
+
- resp.bank_message.should == "APPROVED"
|
314
|
+
+ resp.bank_message.downcase.should match(/approved/)
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
Index: spec/spec_helper.rb
|
319
|
+
===================================================================
|
320
|
+
--- spec/spec_helper.rb (revision 6048)
|
321
|
+
+++ spec/spec_helper.rb (working copy)
|
322
|
+
@@ -3,6 +3,8 @@
|
323
|
+
require 'spec'
|
324
|
+
require 'lib/exact4r'
|
325
|
+
|
326
|
+
+REPLICATION_TIME = 20
|
327
|
+
+
|
328
|
+
def basic_params(options = {})
|
329
|
+
{
|
330
|
+
:transaction_type => :purchase,
|
331
|
+
@@ -18,8 +20,7 @@
|
332
|
+
def basic_find_transaction(options = {})
|
333
|
+
params = {
|
334
|
+
:transaction_type => :transaction_details,
|
335
|
+
- :gateway_id => "AD0008-01",
|
336
|
+
- :password => "7nfcpc7n"
|
337
|
+
+ :gateway_id => "A00049-01", :password => "test1"
|
338
|
+
}.merge(options)
|
339
|
+
|
340
|
+
::EWS::Transaction::Request.new(params)
|
341
|
+
@@ -33,8 +34,7 @@
|
342
|
+
:cc_number => "4111111111111111",
|
343
|
+
:cc_expiry => "1005",
|
344
|
+
:reference_no => "987987",
|
345
|
+
- :gateway_id => "AD0008-01",
|
346
|
+
- :password => "7nfcpc7n"
|
347
|
+
+ :gateway_id => "A00049-01", :password => "test1"
|
348
|
+
}.merge(options)
|
349
|
+
|
350
|
+
::EWS::Transaction::Request.new(params)
|
351
|
+
Index: README
|
352
|
+
===================================================================
|
353
|
+
--- README (revision 6047)
|
354
|
+
+++ README (working copy)
|
355
|
+
@@ -4,6 +4,13 @@
|
356
|
+
|
357
|
+
== Getting Started
|
358
|
+
|
359
|
+
+To submit requests to our transaction processing service, you must first have a Gateway ID,
|
360
|
+
+and a password. Test logins are as follows:
|
361
|
+
+
|
362
|
+
+ Account 1: :gateway_id => "A00049-01", :password => "test1"
|
363
|
+
+ Account 2: :gateway_id => "A00427-01", :password => "testus"
|
364
|
+
+
|
365
|
+
+
|
366
|
+
=1. Submit a transaction
|
367
|
+
|
368
|
+
require 'rubygems'
|
data/spec/request_spec.rb
CHANGED
@@ -70,7 +70,7 @@ describe "Submitting New Requests" do
|
|
70
70
|
|
71
71
|
resp.exact_resp_code.should == "00"
|
72
72
|
resp.exact_message.should == "Transaction Normal"
|
73
|
-
resp.bank_message.should
|
73
|
+
resp.bank_message.downcase.should match(/approved/)
|
74
74
|
resp.transaction_tag.should_not be_nil
|
75
75
|
end
|
76
76
|
|
@@ -81,7 +81,7 @@ describe "Submitting New Requests" do
|
|
81
81
|
|
82
82
|
resp.exact_resp_code.should == "00"
|
83
83
|
resp.exact_message.should == "Transaction Normal"
|
84
|
-
resp.bank_message.should
|
84
|
+
resp.bank_message.downcase.should match(/approved/)
|
85
85
|
resp.transaction_tag.should_not be_nil
|
86
86
|
end
|
87
87
|
end
|
@@ -95,6 +95,9 @@ describe "Submitting Find Requests" do
|
|
95
95
|
|
96
96
|
txn = basic_new_transaction
|
97
97
|
@transaction_tag = @transporter.submit(txn, :json).transaction_tag
|
98
|
+
puts "Sleeping for replication: #{REPLICATION_TIME}s"
|
99
|
+
sleep(REPLICATION_TIME) # need time for replication to take place on the host
|
100
|
+
puts "Awake"
|
98
101
|
end
|
99
102
|
|
100
103
|
it "should work without a specified transport_type" do
|
@@ -103,7 +106,7 @@ describe "Submitting Find Requests" do
|
|
103
106
|
|
104
107
|
resp.exact_resp_code.should == "00"
|
105
108
|
resp.exact_message.should == "Transaction Normal"
|
106
|
-
resp.bank_message.should
|
109
|
+
resp.bank_message.downcase.should match(/approved/)
|
107
110
|
resp.transaction_tag.should_not be_nil
|
108
111
|
end
|
109
112
|
|
@@ -116,7 +119,7 @@ describe "Submitting Find Requests" do
|
|
116
119
|
resp.cc_number == "4111111111111"
|
117
120
|
resp.exact_resp_code.should == "00"
|
118
121
|
resp.exact_message.should == "Transaction Normal"
|
119
|
-
resp.bank_message.should
|
122
|
+
resp.bank_message.downcase.should match(/approved/)
|
120
123
|
end
|
121
124
|
end
|
122
125
|
|
data/spec/spec_helper.rb
CHANGED
@@ -3,6 +3,8 @@ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
|
3
3
|
require 'spec'
|
4
4
|
require 'lib/exact4r'
|
5
5
|
|
6
|
+
REPLICATION_TIME = 20
|
7
|
+
|
6
8
|
def basic_params(options = {})
|
7
9
|
{
|
8
10
|
:transaction_type => :purchase,
|
@@ -18,8 +20,7 @@ end
|
|
18
20
|
def basic_find_transaction(options = {})
|
19
21
|
params = {
|
20
22
|
:transaction_type => :transaction_details,
|
21
|
-
:gateway_id => "
|
22
|
-
:password => "7nfcpc7n"
|
23
|
+
:gateway_id => "A00049-01", :password => "test1"
|
23
24
|
}.merge(options)
|
24
25
|
|
25
26
|
::EWS::Transaction::Request.new(params)
|
@@ -33,8 +34,7 @@ def basic_new_transaction(options = {})
|
|
33
34
|
:cc_number => "4111111111111111",
|
34
35
|
:cc_expiry => "1005",
|
35
36
|
:reference_no => "987987",
|
36
|
-
:gateway_id => "
|
37
|
-
:password => "7nfcpc7n"
|
37
|
+
:gateway_id => "A00049-01", :password => "test1"
|
38
38
|
}.merge(options)
|
39
39
|
|
40
40
|
::EWS::Transaction::Request.new(params)
|
data/spec/transporter_spec.rb
CHANGED
@@ -14,49 +14,8 @@ describe "Transporter creating transactions" do
|
|
14
14
|
|
15
15
|
lambda {
|
16
16
|
tr = ::EWS::Transaction::Transporter.new
|
17
|
-
tr.submit(txn
|
17
|
+
tr.submit(txn)
|
18
18
|
}.should_not raise_error(RuntimeError)
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "Transporter finding transactions" do
|
25
|
-
|
26
|
-
before :each do
|
27
|
-
txn = basic_new_transaction
|
28
|
-
@tr = ::EWS::Transaction::Transporter.new
|
29
|
-
r = @tr.submit(txn, :json)
|
30
|
-
@transaction_tag = r.transaction_tag
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should support all transport types" do
|
34
|
-
[:json, :rest, :soap].each do |type|
|
35
|
-
txn = basic_find_transaction(:transaction_tag => @transaction_tag)
|
36
|
-
resp = @tr.submit(txn, type)
|
37
|
-
|
38
|
-
resp.transaction_tag.should == @transaction_tag
|
39
|
-
resp.cc_number == "4111111111111"
|
40
|
-
resp.exact_resp_code.should == "00"
|
41
|
-
resp.exact_message.should == "Transaction Normal"
|
42
|
-
resp.bank_message.should == "APPROVED"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
21
|
end
|
47
|
-
|
48
|
-
describe "Transporter creating and finding transactions" do
|
49
|
-
|
50
|
-
it "should support all transport types" do
|
51
|
-
[:json, :rest, :soap].each do |type|
|
52
|
-
tr = ::EWS::Transaction::Transporter.new
|
53
|
-
new_txn = tr.submit(basic_new_transaction, type)
|
54
|
-
new_txn.transaction_tag.should_not be_nil
|
55
|
-
|
56
|
-
found_txn = tr.submit(basic_find_transaction(:transaction_tag => new_txn.transaction_tag), :json)
|
57
|
-
found_txn.should_not be_nil
|
58
|
-
found_txn.transaction_tag.should == new_txn.transaction_tag
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exact4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- E-xact Transactions Ltd.
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-05-
|
12
|
+
date: 2008-05-31 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -81,10 +81,10 @@ files:
|
|
81
81
|
- ./lib/ews/transaction/transporter.rb
|
82
82
|
- ./lib/exact4r.rb
|
83
83
|
- ./LICENCE
|
84
|
+
- ./output.log
|
84
85
|
- ./Rakefile
|
85
86
|
- ./README
|
86
87
|
- ./spec
|
87
|
-
- ./spec/donncha.rb
|
88
88
|
- ./spec/mapping_spec.rb
|
89
89
|
- ./spec/request_spec.rb
|
90
90
|
- ./spec/spec_helper.rb
|
data/spec/donncha.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# require File.dirname(__FILE__) + "/spec_helper"
|
2
|
-
#
|
3
|
-
# describe "smaple" do
|
4
|
-
# it "should work" do
|
5
|
-
# r1 = {"requested_aci": 0, "trfid": 12715148, "sequence_no": "212", "auth_number": "ET3442", "abuff_length": 6, "currency_str": "USD", "trace_no": "028001", "bank_resp_code": "000", "returned_aci": 0, "tx_state": 0, "cc_number": "4111111111111111", "sys": 0, "cavv_response": 0, "txflag1": 0, "trans_no": "01", "bank_message": "APPROVED", "transaction_type": "00", "input_method": 0, "time_received": "2008/05/28 20:34:42 +0000", "retrieval_ref_no": "05283442", "cc_expiry": "1005", "transaction_id": 0, "credit_card_type": "Visa", "txflag2": 0, "gateway_id": "AD0008-01", "crc": 0, "ecommerce_flag": 0, "time_sent": "2008/05/28 20:34:42 +0000", "auth_source_code": "5", "cardholder_name": "Simon Brown", "transaction_tag": 2384, "enc": 2, "terminal_ptr": 16459632, "reversal_ind": "O", "exact_resp_code": "00", "amount": "1013", "terminal_id": "001", "cvd_presence_ind": 0, "transaction_approved": 1, "optional": "~uVisa", "transaction_tag2": 0, "processing_centre": 1, "exact_message": "Transaction Normal", "sub": 0, "cmd": 65418, "len": 493, "pid": 333}
|
6
|
-
# r2 = {"requested_aci": 0, "trfid": 0 , "sequence_no": "212", "auth_number": "ET3442", "abuff_length": 0, "bank_resp_code": "000", "returned_aci": 0, "tx_state": 0, "cc_number": "4111111111111111", "sys": 0, "cavv_response": 0, "txflag1": 0, "bank_message": "APPROVED", "transaction_type": "00", "input_method": 0, "time_received": "2008/05/28 20:34:41 +0000", "cc_expiry": "1005", "transaction_id": 0, "txflag2": 0, "gateway_id": "AD0008-01", "crc": 0, "ecommerce_flag": 0, "time_sent": "1899/12/30 00:00:00 +0000", "cardholder_name": "Simon Brown", "transaction_tag": 2384, "enc": 2, "terminal_ptr": 0, "exact_resp_code": "00", "amount": "1013", "terminal_id": "001", "cvd_presence_ind": 0, "transaction_approved": 1, "transaction_tag2": 2384, "processing_centre": 5, "exact_message": "Transaction Normalumber", "sub": 0, "cmd": 65418, "len": 487, "pid": 345}
|
7
|
-
# end
|
8
|
-
# end
|
9
|
-
|
10
|
-
require 'net/https'
|
11
|
-
|
12
|
-
def validate_certificate(is_ok, ctx)
|
13
|
-
# Only check the server certificate, not the issuer.
|
14
|
-
unless (ctx.current_cert.subject.to_s == ctx.current_cert.issuer.to_s)
|
15
|
-
is_ok &&= File.open("certs/exact.cer").read == ctx.current_cert.to_pem
|
16
|
-
end
|
17
|
-
is_ok
|
18
|
-
end
|
19
|
-
|
20
|
-
# @url = URI.parse("https://olb.au.virginmoney.com/esis/Login/SrvPage")
|
21
|
-
@url = URI.parse("https://pos.e-xact.com/")
|
22
|
-
|
23
|
-
# https://olb.au.virginmoney.com/esis/Login/SrvPage
|
24
|
-
begin
|
25
|
-
connection = Net::HTTP.new(@url.host, @url.port)
|
26
|
-
#
|
27
|
-
if @url.scheme == 'https'
|
28
|
-
connection.use_ssl = true
|
29
|
-
connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
30
|
-
connection.ca_file = "certs/equifax_ca.cer"
|
31
|
-
connection.verify_callback = method(:validate_certificate)
|
32
|
-
end
|
33
|
-
|
34
|
-
req = Net::HTTP::Get.new(@url.path)
|
35
|
-
|
36
|
-
response = connection.request(req)
|
37
|
-
rescue => e
|
38
|
-
puts e.message
|
39
|
-
puts e.backtrace
|
40
|
-
end
|
41
|
-
# puts response
|
42
|
-
# case response
|
43
|
-
# when Net::HTTPSuccess then response.body
|
44
|
-
# else
|
45
|
-
# response.error!
|
46
|
-
# end
|