exact4r 0.9.1 → 0.9.2
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 +6 -1
- data/README +71 -3
- data/Rakefile +8 -7
- data/VERSION +1 -1
- data/doc/classes/EWS/Transaction/FakeResponse.html +451 -0
- data/doc/classes/EWS/Transaction/Request.html +61 -80
- data/doc/classes/EWS/Transaction/Response.html +206 -14
- data/doc/classes/EWS/Transaction/Validator.html +182 -0
- data/doc/classes/EWS/Transporter.html +269 -0
- data/doc/classes/REXML/Document.html +176 -0
- data/doc/classes/REXML/Entity.html +150 -0
- data/doc/classes/REXML.html +112 -0
- data/doc/created.rid +1 -1
- data/doc/files/CHANGELOG.html +156 -0
- data/doc/files/LICENCE.html +109 -0
- data/doc/files/README.html +164 -23
- data/doc/files/VERSION.html +107 -0
- data/doc/files/lib/ews/transaction/fake_response_rb.html +101 -0
- data/doc/files/lib/ews/transaction/mapping_rb.html +1 -1
- data/doc/files/lib/ews/transaction/request_rb.html +8 -1
- data/doc/files/lib/ews/transaction/response_rb.html +1 -1
- data/doc/files/lib/ews/transaction/validator_rb.html +101 -0
- data/doc/files/lib/ews/{transaction/transporter_rb.html → transporter_rb.html} +3 -3
- data/doc/files/lib/exact4r_rb.html +6 -2
- data/doc/fr_class_index.html +6 -1
- data/doc/fr_file_index.html +6 -1
- data/doc/fr_method_index.html +22 -7
- data/lib/ews/transaction/mapping.rb +41 -40
- data/lib/ews/transaction/request.rb +3 -4
- data/lib/ews/transaction/response.rb +5 -0
- data/lib/ews/transaction/validator.rb +44 -34
- data/lib/ews/transporter.rb +3 -3
- data/lib/exact4r.rb +1 -1
- data/test/exhaustive/forced_post_test.rb +75 -0
- data/test/exhaustive/online_debit_purchase_test.rb +66 -0
- data/test/exhaustive/online_debit_refund_test.rb +66 -0
- data/test/exhaustive/pre_auth_completion_test.rb +99 -0
- data/test/exhaustive/pre_auth_only_test.rb +68 -0
- data/test/exhaustive/pre_auth_test.rb +68 -0
- data/test/exhaustive/purchase_correction_test.rb +79 -0
- data/test/exhaustive/purchase_test.rb +68 -0
- data/test/exhaustive/recurring_seed_pre_auth_test.rb +68 -0
- data/test/exhaustive/recurring_seed_purchase_test.rb +68 -0
- data/test/exhaustive/refund_correction_test.rb +79 -0
- data/test/exhaustive/refund_test.rb +68 -0
- data/test/exhaustive/secure_storage_test.rb +75 -0
- data/test/exhaustive/tagged_online_debit_refund_test.rb +168 -0
- data/test/exhaustive/tagged_pre_auth_completion_test.rb +119 -0
- data/test/exhaustive/tagged_pre_auth_test.rb +116 -0
- data/test/exhaustive/tagged_purchase_test.rb +116 -0
- data/test/exhaustive/tagged_refund_test.rb +144 -0
- data/test/exhaustive/transaction_details_test.rb +86 -0
- data/test/exhaustive/void_test.rb +75 -0
- data/{spec/avs_spec.rb → test/general/avs_test.rb} +33 -44
- data/test/general/json_encoding_test.rb +62 -0
- data/test/general/request_test.rb +185 -0
- data/test/general/rest_encoding_test.rb +174 -0
- data/test/general/soap_encoding_test.rb +211 -0
- data/test/general/transporter_test.rb +54 -0
- data/test/general/validator_test.rb +150 -0
- data/test/samples/rest.dodgy.response.xml +60 -0
- data/test/samples/rest.everything.response.xml +67 -0
- data/test/samples/rest.response.xml +60 -0
- data/test/samples/soap.deserialization.fault.xml +10 -0
- data/test/samples/soap.dodgy.response.xml +95 -0
- data/test/samples/soap.everything.response.xml +75 -0
- data/test/samples/soap.generalfailure.fault.xml +13 -0
- data/test/samples/soap.nulltransaction.fault.xml +14 -0
- data/test/samples/soap.response.xml +95 -0
- data/test/test_helper.rb +115 -0
- metadata +52 -12
- data/doc/classes/EWS/Transaction/Transporter.html +0 -251
- data/pkg/exact4r-0.5.gem +0 -0
- data/spec/mapping_spec.rb +0 -126
- data/spec/request_spec.rb +0 -154
- data/spec/spec_helper.rb +0 -55
- data/spec/transporter_spec.rb +0 -43
- data/spec/validator_spec.rb +0 -150
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.9.
|
4
|
+
version: 0.9.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: 2009-
|
12
|
+
date: 2009-09-15 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -47,16 +47,26 @@ files:
|
|
47
47
|
- ./certs/equifax_ca.cer
|
48
48
|
- ./certs/exact.cer
|
49
49
|
- ./CHANGELOG
|
50
|
+
- ./doc/classes/EWS/Transaction/FakeResponse.html
|
50
51
|
- ./doc/classes/EWS/Transaction/Request.html
|
51
52
|
- ./doc/classes/EWS/Transaction/Response.html
|
52
|
-
- ./doc/classes/EWS/Transaction/
|
53
|
+
- ./doc/classes/EWS/Transaction/Validator.html
|
54
|
+
- ./doc/classes/EWS/Transporter.html
|
55
|
+
- ./doc/classes/REXML/Document.html
|
56
|
+
- ./doc/classes/REXML/Entity.html
|
57
|
+
- ./doc/classes/REXML.html
|
53
58
|
- ./doc/created.rid
|
59
|
+
- ./doc/files/CHANGELOG.html
|
60
|
+
- ./doc/files/lib/ews/transaction/fake_response_rb.html
|
54
61
|
- ./doc/files/lib/ews/transaction/mapping_rb.html
|
55
62
|
- ./doc/files/lib/ews/transaction/request_rb.html
|
56
63
|
- ./doc/files/lib/ews/transaction/response_rb.html
|
57
|
-
- ./doc/files/lib/ews/transaction/
|
64
|
+
- ./doc/files/lib/ews/transaction/validator_rb.html
|
65
|
+
- ./doc/files/lib/ews/transporter_rb.html
|
58
66
|
- ./doc/files/lib/exact4r_rb.html
|
67
|
+
- ./doc/files/LICENCE.html
|
59
68
|
- ./doc/files/README.html
|
69
|
+
- ./doc/files/VERSION.html
|
60
70
|
- ./doc/fr_class_index.html
|
61
71
|
- ./doc/fr_file_index.html
|
62
72
|
- ./doc/fr_method_index.html
|
@@ -70,15 +80,45 @@ files:
|
|
70
80
|
- ./lib/ews/transporter.rb
|
71
81
|
- ./lib/exact4r.rb
|
72
82
|
- ./LICENCE
|
73
|
-
- ./pkg/exact4r-0.5.gem
|
74
83
|
- ./Rakefile
|
75
84
|
- ./README
|
76
|
-
- ./
|
77
|
-
- ./
|
78
|
-
- ./
|
79
|
-
- ./
|
80
|
-
- ./
|
81
|
-
- ./
|
85
|
+
- ./test/exhaustive/forced_post_test.rb
|
86
|
+
- ./test/exhaustive/online_debit_purchase_test.rb
|
87
|
+
- ./test/exhaustive/online_debit_refund_test.rb
|
88
|
+
- ./test/exhaustive/pre_auth_completion_test.rb
|
89
|
+
- ./test/exhaustive/pre_auth_only_test.rb
|
90
|
+
- ./test/exhaustive/pre_auth_test.rb
|
91
|
+
- ./test/exhaustive/purchase_correction_test.rb
|
92
|
+
- ./test/exhaustive/purchase_test.rb
|
93
|
+
- ./test/exhaustive/recurring_seed_pre_auth_test.rb
|
94
|
+
- ./test/exhaustive/recurring_seed_purchase_test.rb
|
95
|
+
- ./test/exhaustive/refund_correction_test.rb
|
96
|
+
- ./test/exhaustive/refund_test.rb
|
97
|
+
- ./test/exhaustive/secure_storage_test.rb
|
98
|
+
- ./test/exhaustive/tagged_online_debit_refund_test.rb
|
99
|
+
- ./test/exhaustive/tagged_pre_auth_completion_test.rb
|
100
|
+
- ./test/exhaustive/tagged_pre_auth_test.rb
|
101
|
+
- ./test/exhaustive/tagged_purchase_test.rb
|
102
|
+
- ./test/exhaustive/tagged_refund_test.rb
|
103
|
+
- ./test/exhaustive/transaction_details_test.rb
|
104
|
+
- ./test/exhaustive/void_test.rb
|
105
|
+
- ./test/general/avs_test.rb
|
106
|
+
- ./test/general/json_encoding_test.rb
|
107
|
+
- ./test/general/request_test.rb
|
108
|
+
- ./test/general/rest_encoding_test.rb
|
109
|
+
- ./test/general/soap_encoding_test.rb
|
110
|
+
- ./test/general/transporter_test.rb
|
111
|
+
- ./test/general/validator_test.rb
|
112
|
+
- ./test/samples/rest.dodgy.response.xml
|
113
|
+
- ./test/samples/rest.everything.response.xml
|
114
|
+
- ./test/samples/rest.response.xml
|
115
|
+
- ./test/samples/soap.deserialization.fault.xml
|
116
|
+
- ./test/samples/soap.dodgy.response.xml
|
117
|
+
- ./test/samples/soap.everything.response.xml
|
118
|
+
- ./test/samples/soap.generalfailure.fault.xml
|
119
|
+
- ./test/samples/soap.nulltransaction.fault.xml
|
120
|
+
- ./test/samples/soap.response.xml
|
121
|
+
- ./test/test_helper.rb
|
82
122
|
- ./VERSION
|
83
123
|
- CHANGELOG
|
84
124
|
- LICENCE
|
@@ -111,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
151
|
requirements: []
|
112
152
|
|
113
153
|
rubyforge_project: exact4r
|
114
|
-
rubygems_version: 1.3.
|
154
|
+
rubygems_version: 1.3.5
|
115
155
|
signing_key:
|
116
156
|
specification_version: 3
|
117
157
|
summary: E-xact Web Services Client Library.
|
@@ -1,251 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: EWS::Transaction::Transporter</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">EWS::Transaction::Transporter</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../files/lib/ews/transaction/transporter_rb.html">
|
59
|
-
lib/ews/transaction/transporter.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
Object
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
<div id="description">
|
82
|
-
<p>
|
83
|
-
A <a href="Transporter.html">Transporter</a> is responsible for
|
84
|
-
communicating with the E-xact Web Service in whichever dialect is chosen by
|
85
|
-
the user. The available options are:
|
86
|
-
</p>
|
87
|
-
<pre>
|
88
|
-
:json REST with JSON payload
|
89
|
-
:rest REST with XML payload
|
90
|
-
:soap SOAP
|
91
|
-
</pre>
|
92
|
-
<p>
|
93
|
-
The <a href="Transporter.html">Transporter</a> will connect to the service,
|
94
|
-
using SSL if required, and will encode Reqests to <a
|
95
|
-
href="Transporter.html#M000002">send</a> to the service, and decode
|
96
|
-
Responses received from the service.
|
97
|
-
</p>
|
98
|
-
<p>
|
99
|
-
Once configured to connect to a particular service, it can be used
|
100
|
-
repeatedly to <a href="Transporter.html#M000002">send</a> as many
|
101
|
-
transactions as required.
|
102
|
-
</p>
|
103
|
-
|
104
|
-
</div>
|
105
|
-
|
106
|
-
|
107
|
-
</div>
|
108
|
-
|
109
|
-
<div id="method-list">
|
110
|
-
<h3 class="section-bar">Methods</h3>
|
111
|
-
|
112
|
-
<div class="name-list">
|
113
|
-
<a href="#M000001">new</a>
|
114
|
-
<a href="#M000002">send</a>
|
115
|
-
</div>
|
116
|
-
</div>
|
117
|
-
|
118
|
-
</div>
|
119
|
-
|
120
|
-
|
121
|
-
<!-- if includes -->
|
122
|
-
|
123
|
-
<div id="section">
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
<!-- if method_list -->
|
133
|
-
<div id="methods">
|
134
|
-
<h3 class="section-bar">Public Class methods</h3>
|
135
|
-
|
136
|
-
<div id="method-M000001" class="method-detail">
|
137
|
-
<a name="M000001"></a>
|
138
|
-
|
139
|
-
<div class="method-heading">
|
140
|
-
<a href="#M000001" class="method-signature">
|
141
|
-
<span class="method-name">new</span><span class="method-args">(url = "https://api.e-xact.com/", options = {})</span>
|
142
|
-
</a>
|
143
|
-
</div>
|
144
|
-
|
145
|
-
<div class="method-description">
|
146
|
-
<p>
|
147
|
-
Initialize a <a href="Transporter.html">Transporter</a>.
|
148
|
-
</p>
|
149
|
-
<p>
|
150
|
-
You can specify the URL you would like the <a
|
151
|
-
href="Transporter.html">Transporter</a> to connect to, although it defaults
|
152
|
-
to <a href="https://api.e-xact.com">api.e-xact.com</a>, the location of our
|
153
|
-
web service.
|
154
|
-
</p>
|
155
|
-
<p>
|
156
|
-
You can also specify a hash of options as follows:
|
157
|
-
</p>
|
158
|
-
<pre>
|
159
|
-
:server_cert the path to the server's certificate
|
160
|
-
:issuer_cert the path to the certificate of the issuer of the server certificate
|
161
|
-
:transport_type the default transport_type for this transporter
|
162
|
-
</pre>
|
163
|
-
<p>
|
164
|
-
The default certificates are those required to connect to <a
|
165
|
-
href="https://api.e-xact.com">api.e-xact.com</a> and the default
|
166
|
-
<tt>transport_type</tt> is <tt>:rest</tt>. The default
|
167
|
-
<tt>transport_type</tt> can be overridden on a per-transaction basis, if
|
168
|
-
you choose to do so, by specifying it as a parameter to the <tt><a
|
169
|
-
href="Transporter.html#M000002">send</a></tt> method.
|
170
|
-
</p>
|
171
|
-
<p><a class="source-toggle" href="#"
|
172
|
-
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
173
|
-
<div class="method-source-code" id="M000001-source">
|
174
|
-
<pre>
|
175
|
-
<span class="ruby-comment cmt"># File lib/ews/transaction/transporter.rb, line 34</span>
|
176
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">url</span> = <span class="ruby-value str">"https://api.e-xact.com/"</span>, <span class="ruby-identifier">options</span> = {})
|
177
|
-
<span class="ruby-ivar">@url</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">url</span>)
|
178
|
-
<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-value str">"certs/exact.cer"</span>
|
179
|
-
<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-value str">"certs/equifax_ca.cer"</span>
|
180
|
-
<span class="ruby-ivar">@transport_type</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:issuer_cert</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">:rest</span>
|
181
|
-
<span class="ruby-keyword kw">end</span>
|
182
|
-
</pre>
|
183
|
-
</div>
|
184
|
-
</div>
|
185
|
-
</div>
|
186
|
-
|
187
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
188
|
-
|
189
|
-
<div id="method-M000002" class="method-detail">
|
190
|
-
<a name="M000002"></a>
|
191
|
-
|
192
|
-
<div class="method-heading">
|
193
|
-
<a href="#M000002" class="method-signature">
|
194
|
-
<span class="method-name">send</span><span class="method-args">(request, transport_type = nil)</span>
|
195
|
-
</a>
|
196
|
-
</div>
|
197
|
-
|
198
|
-
<div class="method-description">
|
199
|
-
<p>
|
200
|
-
Send a transaction request to the server
|
201
|
-
</p>
|
202
|
-
<table>
|
203
|
-
<tr><td valign="top"><tt>request</tt>:</td><td>the <a href="Request.html">Request</a> object to encode for transmission to
|
204
|
-
the server
|
205
|
-
|
206
|
-
</td></tr>
|
207
|
-
<tr><td valign="top"><tt>transport_type</tt>:</td><td>(optional) the transport type to use for this transaction only. If it not
|
208
|
-
specified, the default transport type for this <a
|
209
|
-
href="Transporter.html">Transporter</a> will be used
|
210
|
-
|
211
|
-
</td></tr>
|
212
|
-
</table>
|
213
|
-
<p><a class="source-toggle" href="#"
|
214
|
-
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
215
|
-
<div class="method-source-code" id="M000002-source">
|
216
|
-
<pre>
|
217
|
-
<span class="ruby-comment cmt"># File lib/ews/transaction/transporter.rb, line 45</span>
|
218
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">transport_type</span> = <span class="ruby-keyword kw">nil</span>)
|
219
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Request not supplied"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">nil?</span>
|
220
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">valid?</span>
|
221
|
-
|
222
|
-
<span class="ruby-identifier">transport_type</span> <span class="ruby-operator">||=</span> <span class="ruby-ivar">@transport_type</span>
|
223
|
-
|
224
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-node">"Transport type #{transport_type} is not supported"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@@transport_types</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">transport_type</span>
|
225
|
-
|
226
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">request</span>.<span class="ruby-identifier">is_find_transaction?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">transport_type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:soap</span>
|
227
|
-
<span class="ruby-identifier">content</span> = <span class="ruby-identifier">post</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">transport_type</span>)
|
228
|
-
<span class="ruby-keyword kw">else</span>
|
229
|
-
<span class="ruby-identifier">content</span> = <span class="ruby-identifier">get</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">transport_type</span>)
|
230
|
-
<span class="ruby-keyword kw">end</span>
|
231
|
-
|
232
|
-
<span class="ruby-constant">EWS</span><span class="ruby-operator">::</span><span class="ruby-constant">Transaction</span><span class="ruby-operator">::</span><span class="ruby-constant">Mapping</span>.<span class="ruby-identifier">send</span> <span class="ruby-node">"#{transport_type}_to_response"</span>, <span class="ruby-identifier">content</span>
|
233
|
-
<span class="ruby-keyword kw">end</span>
|
234
|
-
</pre>
|
235
|
-
</div>
|
236
|
-
</div>
|
237
|
-
</div>
|
238
|
-
|
239
|
-
|
240
|
-
</div>
|
241
|
-
|
242
|
-
|
243
|
-
</div>
|
244
|
-
|
245
|
-
|
246
|
-
<div id="validator-badges">
|
247
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
248
|
-
</div>
|
249
|
-
|
250
|
-
</body>
|
251
|
-
</html>
|
data/pkg/exact4r-0.5.gem
DELETED
Binary file
|
data/spec/mapping_spec.rb
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
-
|
3
|
-
describe "Mapping TO formats" do
|
4
|
-
|
5
|
-
it "should generate a JSON payload" do
|
6
|
-
r = EWS::Transaction::Request.new(basic_params)
|
7
|
-
|
8
|
-
json = EWS::Transaction::Mapping.request_to_json(r)
|
9
|
-
|
10
|
-
res = ActiveSupport::JSON.decode(json)
|
11
|
-
res["amount"].should == "10.13"
|
12
|
-
res["cardholder_name"].should == "Simon Brown"
|
13
|
-
res["cc_number"].should == "4111111111111111"
|
14
|
-
res["cc_expiry"].should == "1012"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should generate a REST payload" do
|
18
|
-
r = EWS::Transaction::Request.new(basic_params)
|
19
|
-
|
20
|
-
rest = EWS::Transaction::Mapping.request_to_rest(r)
|
21
|
-
|
22
|
-
xml = REXML::Document.new(rest)
|
23
|
-
txn = REXML::XPath.first(xml, "//Transaction")
|
24
|
-
REXML::XPath.first(txn, "Card_Number").text.should == "4111111111111111"
|
25
|
-
REXML::XPath.first(txn, "CardHoldersName").text.should == "Simon Brown"
|
26
|
-
REXML::XPath.first(txn, "Transaction_Type").text.should == "00"
|
27
|
-
REXML::XPath.first(txn, "Expiry_Date").text.should == "1012"
|
28
|
-
REXML::XPath.first(txn, "DollarAmount").text.should == "10.13"
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should generate a SOAP payload" do
|
32
|
-
r = EWS::Transaction::Request.new(basic_params)
|
33
|
-
|
34
|
-
soap = EWS::Transaction::Mapping.request_to_soap(r)
|
35
|
-
|
36
|
-
xml = REXML::Document.new(soap)
|
37
|
-
txn = REXML::XPath.first(xml, "//SendAndCommitSource")
|
38
|
-
REXML::XPath.first(txn, "Card_Number").text.should == "4111111111111111"
|
39
|
-
REXML::XPath.first(txn, "CardHoldersName").text.should == "Simon Brown"
|
40
|
-
REXML::XPath.first(txn, "Transaction_Type").text.should == "00"
|
41
|
-
REXML::XPath.first(txn, "Expiry_Date").text.should == "1012"
|
42
|
-
REXML::XPath.first(txn, "DollarAmount").text.should == "10.13"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "Mapping FROM formats" do
|
47
|
-
|
48
|
-
it "should parse a JSON payload" do
|
49
|
-
payload = <<PAYLOAD
|
50
|
-
{"bank_message": "APPROVED", "transaction_type": "00", "transaction_tag": 2238, "exact_message": "Transaction Normal"}
|
51
|
-
PAYLOAD
|
52
|
-
|
53
|
-
r = EWS::Transaction::Mapping.json_to_response(payload)
|
54
|
-
|
55
|
-
r.exact_message.should == "Transaction Normal"
|
56
|
-
r.error_description.should be_nil
|
57
|
-
r.bank_message.should == "APPROVED"
|
58
|
-
r.transaction_tag.should == 2238
|
59
|
-
r.transaction_type.should == "00"
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should parse a REST payload" do
|
63
|
-
payload = <<PAYLOAD
|
64
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
65
|
-
<TransactionResult>
|
66
|
-
<Error_Description></Error_Description>
|
67
|
-
<Bank_Message>APPROVED</Bank_Message>
|
68
|
-
<Transaction_Tag>2239</Transaction_Tag>
|
69
|
-
<EXact_Message>Transaction Normal</EXact_Message>
|
70
|
-
<Transaction_Type>00</Transaction_Type>
|
71
|
-
</TransactionResult>
|
72
|
-
PAYLOAD
|
73
|
-
|
74
|
-
r = EWS::Transaction::Mapping.rest_to_response(payload)
|
75
|
-
|
76
|
-
r.exact_message.should == "Transaction Normal"
|
77
|
-
r.error_description.should be_nil
|
78
|
-
r.bank_message.should == "APPROVED"
|
79
|
-
r.transaction_tag.should == 2239
|
80
|
-
r.transaction_type.should == "00"
|
81
|
-
end
|
82
|
-
|
83
|
-
it "should parse a SOAP Fault payload with <details>" do
|
84
|
-
payload = <<PAYLOAD
|
85
|
-
<?xml version="1.0" encoding="utf-8"?>
|
86
|
-
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
87
|
-
<soap:Body>
|
88
|
-
<soap:Fault>
|
89
|
-
<faultcode>soap:Server</faultcode>
|
90
|
-
<faultstring>System.Web.Services.Protocols.SoapException: Setup Error at rpc-enc.Service.SendAndCommit(Transaction Transaction) in C:\Documents and Settings\defaultuser\VSWebCache\secure2.exact.com\vplug-in\transaction\rpc-enc\Service.asmx.vb:line 99</faultstring>
|
91
|
-
<faultactor>http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Service.asmx</faultactor>
|
92
|
-
<detail>
|
93
|
-
<error number="500" description="Internal Server Error. An unknown error occurred." xmlns="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc"/>
|
94
|
-
</detail>
|
95
|
-
</soap:Fault>
|
96
|
-
</soap:Body>
|
97
|
-
</soap:Envelope>
|
98
|
-
PAYLOAD
|
99
|
-
|
100
|
-
r = EWS::Transaction::Mapping.soap_to_response(payload)
|
101
|
-
|
102
|
-
r.error_number.should == 500
|
103
|
-
r.error_description.should == "Internal Server Error. An unknown error occurred."
|
104
|
-
r.should_not be_approved
|
105
|
-
end
|
106
|
-
|
107
|
-
it "should throw an exception when a SOAP Fault contains no details" do
|
108
|
-
payload = <<PAYLOAD
|
109
|
-
<?xml version="1.0" encoding="utf-8"?>
|
110
|
-
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
111
|
-
<soap:Body>
|
112
|
-
<soap:Fault>
|
113
|
-
<faultcode>soap:Client</faultcode>
|
114
|
-
<faultstring>Server was unable to read request. --> There is an error in XML document (1, 406). --> <SendAndCommit xmlns='http://secure2.exact.com/vplug-in/transaction/rpc-enc/'> was not expected.</faultstring>
|
115
|
-
<detail />
|
116
|
-
</soap:Fault>
|
117
|
-
</soap:Body>
|
118
|
-
</soap:Envelope>
|
119
|
-
PAYLOAD
|
120
|
-
|
121
|
-
lambda {
|
122
|
-
EWS::Transaction::Mapping.soap_to_response(payload)
|
123
|
-
}.should raise_error
|
124
|
-
end
|
125
|
-
|
126
|
-
end
|
data/spec/request_spec.rb
DELETED
@@ -1,154 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
-
|
3
|
-
describe "Request" do
|
4
|
-
|
5
|
-
it "should allow construction from empty hash" do
|
6
|
-
r = EWS::Transaction::Request.new
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should assign values" do
|
10
|
-
r = EWS::Transaction::Request.new(basic_params)
|
11
|
-
|
12
|
-
r.amount.should == "10.13"
|
13
|
-
r.cardholder_name.should == "Simon Brown"
|
14
|
-
r.cc_number.should == "4111111111111111"
|
15
|
-
r.cc_expiry.should == "1012"
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should raise an error with invalid tranasction_type" do
|
19
|
-
lambda {
|
20
|
-
EWS::Transaction::Request.new(basic_params(:transaction_type => "00"))
|
21
|
-
}.should_not raise_error
|
22
|
-
|
23
|
-
lambda {
|
24
|
-
EWS::Transaction::Request.new(basic_params(:transaction_type => :purchase))
|
25
|
-
}.should_not raise_error
|
26
|
-
|
27
|
-
lambda {
|
28
|
-
EWS::Transaction::Request.new(basic_params(:transaction_type => nil))
|
29
|
-
}.should raise_error
|
30
|
-
|
31
|
-
lambda {
|
32
|
-
EWS::Transaction::Request.new(basic_params(:transaction_type => ""))
|
33
|
-
}.should raise_error
|
34
|
-
|
35
|
-
lambda {
|
36
|
-
EWS::Transaction::Request.new(basic_params(:transaction_type => "barry"))
|
37
|
-
}.should raise_error
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "Submitting New Requests" do
|
42
|
-
|
43
|
-
before :all do
|
44
|
-
@transporter = EWS::Transporter.new(LOCATION)
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should work without a specified transport_type" do
|
48
|
-
txn = basic_new_transaction
|
49
|
-
resp = @transporter.submit(txn)
|
50
|
-
|
51
|
-
resp.exact_resp_code.should == "00"
|
52
|
-
resp.exact_message.should == "Transaction Normal"
|
53
|
-
resp.transaction_approved.should == 1
|
54
|
-
resp.bank_message.downcase.should match(/approved/)
|
55
|
-
resp.transaction_tag.should_not be_nil
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should support JSON" do
|
59
|
-
txn = basic_new_transaction
|
60
|
-
resp = @transporter.submit(txn, :json)
|
61
|
-
|
62
|
-
resp.exact_resp_code.should == "00"
|
63
|
-
resp.exact_message.should == "Transaction Normal"
|
64
|
-
resp.transaction_approved.should == 1
|
65
|
-
resp.bank_message.downcase.should match(/approved/)
|
66
|
-
resp.transaction_tag.should_not be_nil
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should support REST" do
|
70
|
-
txn = basic_new_transaction
|
71
|
-
resp = @transporter.submit(txn, :rest)
|
72
|
-
|
73
|
-
resp.exact_resp_code.should == "00"
|
74
|
-
resp.exact_message.should == "Transaction Normal"
|
75
|
-
resp.transaction_approved.should == 1
|
76
|
-
resp.bank_message.downcase.should match(/approved/)
|
77
|
-
resp.transaction_tag.should_not be_nil
|
78
|
-
end
|
79
|
-
|
80
|
-
it "should support SOAP" do
|
81
|
-
txn = basic_new_transaction
|
82
|
-
resp = @transporter.submit(txn, :soap)
|
83
|
-
|
84
|
-
resp.exact_resp_code.should == "00"
|
85
|
-
resp.exact_message.should == "Transaction Normal"
|
86
|
-
resp.transaction_approved.should == 1
|
87
|
-
resp.bank_message.downcase.should match(/approved/)
|
88
|
-
resp.transaction_tag.should_not be_nil
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "Submitting Find Requests" do
|
93
|
-
|
94
|
-
before :each do
|
95
|
-
@transporter = EWS::Transporter.new(LOCATION)
|
96
|
-
|
97
|
-
ct = basic_new_transaction
|
98
|
-
@transaction_tag = @transporter.submit(ct, :json).transaction_tag
|
99
|
-
@ft = basic_find_transaction(:transaction_tag => @transaction_tag)
|
100
|
-
end
|
101
|
-
|
102
|
-
it "should work without a specified transport_type" do
|
103
|
-
resp = @transporter.submit(@ft)
|
104
|
-
|
105
|
-
resp.exact_resp_code.should == "00"
|
106
|
-
resp.exact_message.should == "Transaction Normal"
|
107
|
-
resp.bank_message.downcase.should match(/approved/)
|
108
|
-
resp.transaction_tag.should == @transaction_tag
|
109
|
-
end
|
110
|
-
|
111
|
-
it "should support JSON" do
|
112
|
-
resp = @transporter.submit(@ft, :json)
|
113
|
-
|
114
|
-
resp.cc_number == "4111111111111"
|
115
|
-
resp.exact_resp_code.should == "00"
|
116
|
-
resp.exact_message.should == "Transaction Normal"
|
117
|
-
resp.bank_message.downcase.should match(/approved/)
|
118
|
-
resp.transaction_tag.should == @transaction_tag
|
119
|
-
end
|
120
|
-
|
121
|
-
it "should support REST" do
|
122
|
-
resp = @transporter.submit(@ft, :rest)
|
123
|
-
|
124
|
-
resp.cc_number == "4111111111111"
|
125
|
-
resp.exact_resp_code.should == "00"
|
126
|
-
resp.exact_message.should == "Transaction Normal"
|
127
|
-
resp.bank_message.downcase.should match(/approved/)
|
128
|
-
resp.transaction_tag.should == @transaction_tag
|
129
|
-
end
|
130
|
-
|
131
|
-
it "should support SOAP" do
|
132
|
-
resp = @transporter.submit(@ft, :soap)
|
133
|
-
|
134
|
-
resp.cc_number == "4111111111111"
|
135
|
-
resp.exact_resp_code.should == "00"
|
136
|
-
resp.exact_message.should == "Transaction Normal"
|
137
|
-
resp.bank_message.downcase.should match(/approved/)
|
138
|
-
resp.transaction_tag.should == @transaction_tag
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
describe "Fake requests" do
|
143
|
-
it "should stub sending" do
|
144
|
-
request = {:nonsense => "this is nonsense"}
|
145
|
-
fake_response = EWS::Transaction::FakeResponse.valid(request)
|
146
|
-
transporter = EWS::Transporter.new(LOCATION)
|
147
|
-
transporter.stubs(:submit).returns(fake_response)
|
148
|
-
|
149
|
-
response = transporter.submit(request)
|
150
|
-
response.should == fake_response
|
151
|
-
response.should be_approved
|
152
|
-
response.exact_message.should == "Transaction Normal"
|
153
|
-
end
|
154
|
-
end
|