exact4r 0.9 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,251 @@
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>&nbsp;&nbsp;
114
+ <a href="#M000002">send</a>&nbsp;&nbsp;
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 = &quot;https://api.e-xact.com/&quot;, 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">&quot;https://api.e-xact.com/&quot;</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">&quot;certs/exact.cer&quot;</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">&quot;certs/equifax_ca.cer&quot;</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">&quot;Request not supplied&quot;</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">&quot;Transport type #{transport_type} is not supported&quot;</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">&quot;#{transport_type}_to_response&quot;</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/doc/created.rid CHANGED
@@ -1 +1 @@
1
- Wed, 10 Jun 2009 12:23:07 +1000
1
+ Thu, 29 May 2008 16:31:55 -0700
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Sun Jul 20 11:24:33 +1000 2008</td>
59
+ <td>Thu May 29 14:10:27 -0700 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -71,45 +71,34 @@
71
71
  <div id="description">
72
72
  <h1>exact4r</h1>
73
73
  <p>
74
- A gem which provides access to E-xact&#8216;s Web Services API, allowing
75
- the submission of financial transactions via REST, JSON or SOAP.
74
+ Provides access to E-xact Web Services API, which allows the submission via
75
+ REST, JSON or SOAP.
76
76
  </p>
77
77
  <h2>Getting Started</h2>
78
- <p>
79
- To submit requests to our transaction processing service, you must first
80
- have a Gateway ID, and a password. Test logins are as follows:
81
- </p>
82
- <pre>
83
- Account 1: :gateway_id =&gt; &quot;A00049-01&quot;, :password =&gt; &quot;test1&quot;
84
- Account 2: :gateway_id =&gt; &quot;A00427-01&quot;, :password =&gt; &quot;testus&quot;
85
- </pre>
86
78
  <h1>1. Submit a transaction</h1>
87
79
  <pre>
88
- require 'rubygems'
89
- require 'exact4r'
90
-
91
80
  # build a purchase request
92
81
  request = EWS::Transaction::Request.new({
93
82
  :transaction_type =&gt; :purchase,
94
83
  :amount =&gt; 10.50,
95
84
  :cardholder_name =&gt; &quot;Simon Brown&quot;,
96
85
  :cc_number =&gt; &quot;4111111111111111&quot;,
97
- :cc_expiry =&gt; &quot;1012&quot;, # MUST be MMYY format
86
+ :cc_expiry =&gt; &quot;1005&quot;, # MUST be YYMM format
98
87
  :gateway_id =&gt; &quot;XXXXXXX&quot;, # which gateway to submit the request to
99
88
  :password =&gt; &quot;YYYYYY&quot; # your password for that gateway
100
89
  })
101
90
 
102
- transporter = EWS::Transporter.new
103
- response = transporter.submit(request) # submits using REST (XML) by default
91
+ transporter = EWS::Transaction::Transporter.new
92
+ response = transporter.send(request) # submits using REST (XML) by default
104
93
 
105
94
  # submit using JSON, or
106
- response = transporter.submit(request, :json)
95
+ response = transporter.send(request, :json)
107
96
 
108
97
  # submit using SOAP, or
109
- response = transporter.submit(request, :soap)
98
+ response = transporter.send(request, :soap)
110
99
 
111
100
  # submit explicitly via REST
112
- response = transporter.submit(request, :rest)
101
+ response = transporter.send(request, :rest)
113
102
 
114
103
  # The response object is independent of type of transport chosen.
115
104
  # We decode the payload into a regular object
@@ -121,22 +110,19 @@ have a Gateway ID, and a password. Test logins are as follows:
121
110
  </pre>
122
111
  <h1>2. Find information on an existing transaction</h1>
123
112
  <pre>
124
- require 'rubygems'
125
- require 'exact4r'
126
-
127
113
  # build a purchase request
128
114
  request = EWS::Transaction::Request.new({
129
115
  :transaction_type =&gt; :purchase,
130
116
  :amount =&gt; 10.50,
131
117
  :cardholder_name =&gt; &quot;Simon Brown&quot;,
132
118
  :cc_number =&gt; &quot;4111111111111111&quot;,
133
- :cc_expiry =&gt; &quot;1012&quot;, # MUST be MMYY format
119
+ :cc_expiry =&gt; &quot;1005&quot;, # MUST be YYMM format
134
120
  :gateway_id =&gt; &quot;XXXXXXX&quot;, # which gateway to submit the request to
135
121
  :password =&gt; &quot;YYYYYY&quot; # your password for that gateway
136
122
  })
137
123
 
138
- transporter = EWS::Transporter.new
139
- response = transporter.submit(request) # submits using REST (XML) by default
124
+ transporter = EWS::Transaction::Transporter.new
125
+ response = transporter.send(request) # submits using REST (XML) by default
140
126
 
141
127
  # you need to know the transaction tag of the transaction you are looking for
142
128
  find_request = EWS::Transaction::Request.new({
@@ -146,20 +132,15 @@ have a Gateway ID, and a password. Test logins are as follows:
146
132
  :password =&gt; &quot;YYYYYY&quot;
147
133
  })
148
134
 
149
- find_response = transporter.submit(find_request, :json) # again, can choose your transport type as before
135
+ find_response = transporter.send(find_request, :json) # again, can choose your transport type as before
150
136
  find_response.cc_number # 4111111111111111
151
137
  find_response.amount # 10.50
152
138
  </pre>
153
139
  <h1>3. Re-using a Transporter</h1>
154
140
  <pre>
155
- require 'rubygems'
156
- require 'exact4r'
157
-
158
141
  # The transporter object can be re-used across multiple transactions, so set it up once
159
142
  # and forget about it.
160
- # In this example, we will continue to use E-xact's default web-service URL, but we
161
- # will specify a default transport_type of :soap
162
- transporter = EWS::Transporter.new(&quot;https://api.e-xact.com/&quot;, {:transaction_type =&gt; :soap})
143
+ transporter = EWS::Transaction::Transporter.new
163
144
 
164
145
  # now let's submit do a recurring seed purchase...
165
146
  rsp_req = EWS::Transaction::Request.new({
@@ -167,12 +148,12 @@ have a Gateway ID, and a password. Test logins are as follows:
167
148
  :amount =&gt; 12.00,
168
149
  :cardholder_name =&gt; &quot;Simon Brown&quot;,
169
150
  :cc_number =&gt; &quot;4111111111111111&quot;,
170
- :cc_expiry =&gt; &quot;1012&quot;,
151
+ :cc_expiry =&gt; &quot;1005&quot;,
171
152
  :gateway_id =&gt; &quot;XXXXXX&quot;,
172
153
  :password =&gt; &quot;YYYYYY&quot;
173
154
  })
174
155
 
175
- rsp_resp = transporter.submit(rsp_req)
156
+ rsp_resp = transporter.send(rsp_req, :json)
176
157
  raise &quot;Seed Purchase failed&quot; unless rsp_resp.approved?
177
158
 
178
159
  # ...then do multiple refunds against it
@@ -180,12 +161,12 @@ have a Gateway ID, and a password. Test logins are as follows:
180
161
  rf_req = EWS::Transaction::Request.new({
181
162
  :transaction_type =&gt; :tagged_refund,
182
163
  :transaction_tag =&gt; rsp_resp.transaction_tag, # need to know which transaction we're refunding against...
183
- :authorization_num =&gt; rsp_resp.authorization_num, # and its authorization_num
164
+ :auth_number =&gt; rsp_resp.auth_number, # and its auth_number
184
165
  :amount =&gt; 1.00, # refund a dollar at a time
185
166
  :gateway_id =&gt; &quot;XXXXXX&quot;,
186
167
  :password =&gt; &quot;YYYYYY&quot;
187
168
  })
188
- rf_resp = transporter.submit(rf_req)
169
+ rf_resp = transporter.send(rf_req, :json)
189
170
  raise &quot;Refund failed: #{rf_resp.exact_resp_code}, #{rf_resp.exact_message}&quot; unless rf_resp.approved?
190
171
  end
191
172
  </pre>
@@ -197,6 +178,12 @@ spec
197
178
  Run all test in spec/ folder (default)
198
179
  </pre>
199
180
  <p>
181
+ rcov
182
+ </p>
183
+ <pre>
184
+ Run all test and generate coverage report in coverage/
185
+ </pre>
186
+ <p>
200
187
  rdoc
201
188
  </p>
202
189
  <pre>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Mar 02 16:24:56 +1100 2009</td>
59
+ <td>Thu May 29 14:10:27 -0700 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Thu Jul 31 16:52:55 +1000 2008</td>
59
+ <td>Thu May 29 14:10:27 -0700 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -69,13 +69,6 @@
69
69
  <div id="contextContent">
70
70
 
71
71
 
72
- <div id="requires-list">
73
- <h3 class="section-bar">Required files</h3>
74
-
75
- <div class="name-list">
76
- ews/transaction/validator&nbsp;&nbsp;
77
- </div>
78
- </div>
79
72
 
80
73
  </div>
81
74
 
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Jul 14 18:50:47 +1000 2008</td>
59
+ <td>Thu May 29 14:10:27 -0700 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -8,7 +8,7 @@
8
8
  <title>File: transporter.rb</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
12
12
  <script type="text/javascript">
13
13
  // <![CDATA[
14
14
 
@@ -51,12 +51,12 @@
51
51
  <table class="header-table">
52
52
  <tr class="top-aligned-row">
53
53
  <td><strong>Path:</strong></td>
54
- <td>lib/ews/transporter.rb
54
+ <td>lib/ews/transaction/transporter.rb
55
55
  </td>
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Wed Jun 10 12:04:40 +1000 2009</td>
59
+ <td>Thu May 29 14:35:29 -0700 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Sun Oct 12 14:18:51 +1100 2008</td>
59
+ <td>Thu May 29 14:10:27 -0700 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -78,9 +78,7 @@
78
78
  ews/transaction/mapping&nbsp;&nbsp;
79
79
  ews/transaction/request&nbsp;&nbsp;
80
80
  ews/transaction/response&nbsp;&nbsp;
81
- ews/transaction/validator&nbsp;&nbsp;
82
- ews/transporter&nbsp;&nbsp;
83
- ews/transaction/fake_response&nbsp;&nbsp;
81
+ ews/transaction/transporter&nbsp;&nbsp;
84
82
  </div>
85
83
  </div>
86
84
 
@@ -20,11 +20,9 @@
20
20
  <div id="index">
21
21
  <h1 class="section-bar">Classes</h1>
22
22
  <div id="index-entries">
23
- <a href="classes/EWS/Transaction/FakeResponse.html">EWS::Transaction::FakeResponse</a><br />
24
23
  <a href="classes/EWS/Transaction/Request.html">EWS::Transaction::Request</a><br />
25
24
  <a href="classes/EWS/Transaction/Response.html">EWS::Transaction::Response</a><br />
26
- <a href="classes/EWS/Transaction/Validator.html">EWS::Transaction::Validator</a><br />
27
- <a href="classes/EWS/Transporter.html">EWS::Transporter</a><br />
25
+ <a href="classes/EWS/Transaction/Transporter.html">EWS::Transaction::Transporter</a><br />
28
26
  </div>
29
27
  </div>
30
28
  </body>
@@ -20,16 +20,11 @@
20
20
  <div id="index">
21
21
  <h1 class="section-bar">Files</h1>
22
22
  <div id="index-entries">
23
- <a href="files/CHANGELOG.html">CHANGELOG</a><br />
24
- <a href="files/LICENCE.html">LICENCE</a><br />
25
23
  <a href="files/README.html">README</a><br />
26
- <a href="files/VERSION.html">VERSION</a><br />
27
- <a href="files/lib/ews/transaction/fake_response_rb.html">lib/ews/transaction/fake_response.rb</a><br />
28
24
  <a href="files/lib/ews/transaction/mapping_rb.html">lib/ews/transaction/mapping.rb</a><br />
29
25
  <a href="files/lib/ews/transaction/request_rb.html">lib/ews/transaction/request.rb</a><br />
30
26
  <a href="files/lib/ews/transaction/response_rb.html">lib/ews/transaction/response.rb</a><br />
31
- <a href="files/lib/ews/transaction/validator_rb.html">lib/ews/transaction/validator.rb</a><br />
32
- <a href="files/lib/ews/transporter_rb.html">lib/ews/transporter.rb</a><br />
27
+ <a href="files/lib/ews/transaction/transporter_rb.html">lib/ews/transaction/transporter.rb</a><br />
33
28
  <a href="files/lib/exact4r_rb.html">lib/exact4r.rb</a><br />
34
29
  </div>
35
30
  </div>
@@ -20,24 +20,13 @@
20
20
  <div id="index">
21
21
  <h1 class="section-bar">Methods</h1>
22
22
  <div id="index-entries">
23
- <a href="classes/EWS/Transaction/Response.html#M000013">approved? (EWS::Transaction::Response)</a><br />
24
- <a href="classes/EWS/Transaction/FakeResponse.html#M000003">declined (EWS::Transaction::FakeResponse)</a><br />
25
- <a href="classes/EWS/Transaction/FakeResponse.html#M000006">invalid_amount (EWS::Transaction::FakeResponse)</a><br />
26
- <a href="classes/EWS/Transaction/FakeResponse.html#M000008">invalid_auth_num (EWS::Transaction::FakeResponse)</a><br />
27
- <a href="classes/EWS/Transaction/FakeResponse.html#M000012">invalid_avs (EWS::Transaction::FakeResponse)</a><br />
28
- <a href="classes/EWS/Transaction/FakeResponse.html#M000007">invalid_cardholder_name (EWS::Transaction::FakeResponse)</a><br />
29
- <a href="classes/EWS/Transaction/FakeResponse.html#M000005">invalid_cc_expiry (EWS::Transaction::FakeResponse)</a><br />
30
- <a href="classes/EWS/Transaction/FakeResponse.html#M000004">invalid_cc_number (EWS::Transaction::FakeResponse)</a><br />
31
- <a href="classes/EWS/Transaction/FakeResponse.html#M000009">invalid_cc_verification_str (EWS::Transaction::FakeResponse)</a><br />
32
- <a href="classes/EWS/Transaction/FakeResponse.html#M000011">invalid_reference_no (EWS::Transaction::FakeResponse)</a><br />
33
- <a href="classes/EWS/Transaction/FakeResponse.html#M000010">invalid_transaction_code (EWS::Transaction::FakeResponse)</a><br />
34
- <a href="classes/EWS/Transaction/Request.html#M000016">is_find_transaction? (EWS::Transaction::Request)</a><br />
35
- <a href="classes/EWS/Transporter.html#M000017">new (EWS::Transporter)</a><br />
36
- <a href="classes/EWS/Transaction/Request.html#M000014">new (EWS::Transaction::Request)</a><br />
37
- <a href="classes/EWS/Transporter.html#M000018">submit (EWS::Transporter)</a><br />
38
- <a href="classes/EWS/Transaction/Request.html#M000015">transaction_type= (EWS::Transaction::Request)</a><br />
39
- <a href="classes/EWS/Transaction/FakeResponse.html#M000002">valid (EWS::Transaction::FakeResponse)</a><br />
40
- <a href="classes/EWS/Transaction/Validator.html#M000001">valid? (EWS::Transaction::Validator)</a><br />
23
+ <a href="classes/EWS/Transaction/Response.html#M000003">approved? (EWS::Transaction::Response)</a><br />
24
+ <a href="classes/EWS/Transaction/Request.html#M000006">is_find_transaction? (EWS::Transaction::Request)</a><br />
25
+ <a href="classes/EWS/Transaction/Transporter.html#M000001">new (EWS::Transaction::Transporter)</a><br />
26
+ <a href="classes/EWS/Transaction/Request.html#M000004">new (EWS::Transaction::Request)</a><br />
27
+ <a href="classes/EWS/Transaction/Transporter.html#M000002">send (EWS::Transaction::Transporter)</a><br />
28
+ <a href="classes/EWS/Transaction/Request.html#M000005">transaction_type= (EWS::Transaction::Request)</a><br />
29
+ <a href="classes/EWS/Transaction/Request.html#M000007">valid? (EWS::Transaction::Request)</a><br />
41
30
  </div>
42
31
  </div>
43
32
  </body>
@@ -50,9 +50,24 @@ module EWS # :nodoc:
50
50
  # yeah, it's ugly, but otherwise RDoc won't pick them up
51
51
  attr_accessor :errors
52
52
  attr_accessor :gateway_id, :password, :transaction_type, :amount, :surcharge_amount, :cc_number, :transaction_tag, :track1, :track2, :pan, :authorization_num, :cc_expiry, :cardholder_name
53
- 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
53
+ attr_accessor :cc_verification_str2, :cvd_presence_ind, :tax1_amount, :tax1_number, :tax2_amount, :tax2_number, :secure_auth_required, :secure_auth_result
54
+
55
+ # AVS - Address Verification,
56
+ attr_accessor :cc_verification_str1
57
+ [:avs_test_flag, :avs_street_address, :avs_unit_no, :avs_po_box, :avs_postal_code].each { |m|
58
+ class_eval <<-METHOD_EOS
59
+ def #{m.to_s}
60
+ @#{m.to_s}
61
+ end
62
+ def #{m.to_s}=(v)
63
+ @#{m.to_s} = v
64
+ calculate_verification_str1
65
+ end
66
+ METHOD_EOS
67
+ }
68
+
54
69
  attr_accessor :ecommerce_flag, :xid, :cavv, :cavv_algorithm, :reference_no, :customer_ref, :reference_3, :language, :client_ip, :client_email, :zip_code
55
-
70
+
56
71
  # Initialize a Request with a hash of values
57
72
  def initialize(hash = {})
58
73
  hash.each {|k,v| self.send "#{k.to_s}=", v}
@@ -104,7 +119,21 @@ module EWS # :nodoc:
104
119
  :secure_storage_eft => '61',
105
120
  :transaction_details => 'CR'
106
121
  }.freeze unless defined?(@@transaction_codes)
107
-
122
+
123
+ # Calculate verification str1, callback method invoked after the avs_*= methods
124
+ def calculate_verification_str1
125
+ self.cc_verification_str1 = ''
126
+ self.cc_verification_str1 << (self.avs_test_flag || '')
127
+ unless self.avs_street_address.nil?
128
+ self.cc_verification_str1 << (self.avs_street_address || '')
129
+ self.cc_verification_str1 << (self.avs_unit_no || '')
130
+ else
131
+ self.cc_verification_str1 << (self.avs_po_box || '')
132
+ end
133
+ unless self.avs_postal_code.nil?
134
+ self.cc_verification_str1 << '|' << self.avs_postal_code
135
+ end
136
+ end
108
137
  end
109
138
  end
110
- end
139
+ end
Binary file