exact4r 0.8 → 0.9

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 CHANGED
@@ -1,3 +1,6 @@
1
+ == v0.9
2
+ Fixed incorrect decoding of boolean attributes from SOAP response
3
+
1
4
  == v0.8
2
5
  Added User-Agent string to HTTP requests
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8
1
+ 0.9
data/after.log CHANGED
@@ -1,6 +1,6 @@
1
1
  (in /Volumes/Exact/WebService/exact4r)
2
2
  ..............[].[].[].[]..........
3
3
 
4
- Finished in 106.243974 seconds
4
+ Finished in 82.478117 seconds
5
5
 
6
6
  27 examples, 0 failures
data/before.log ADDED
@@ -0,0 +1,17 @@
1
+ (in /Volumes/Exact/WebService/exact4r)
2
+ ..............[].[].[].[]F....F....
3
+
4
+ 1)
5
+ 'Submitting Find Requests should support SOAP' FAILED
6
+ expected: "00",
7
+ got: nil (using ==)
8
+ ./spec/request_spec.rb:138:
9
+
10
+ 2)
11
+ 'Transporter creating transactions should throw an exception when parsing a response to sending nonsense SOAP' FAILED
12
+ expected Exception but nothing was raised
13
+ ./spec/transporter_spec.rb:38:
14
+
15
+ Finished in 82.424866 seconds
16
+
17
+ 27 examples, 2 failures
@@ -224,7 +224,7 @@ transport type will be used
224
224
  52: <span class="ruby-identifier">request</span> = <span class="ruby-identifier">build_http_request</span>(<span class="ruby-identifier">transaction</span>, <span class="ruby-identifier">transport_type</span>, <span class="ruby-identifier">transport_details</span>[<span class="ruby-identifier">:suffix</span>])
225
225
  53: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">basic_auth</span>(<span class="ruby-identifier">transaction</span>.<span class="ruby-identifier">gateway_id</span>, <span class="ruby-identifier">transaction</span>.<span class="ruby-identifier">password</span>)
226
226
  54: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">add_field</span> <span class="ruby-value str">&quot;Accept&quot;</span>, <span class="ruby-identifier">transport_details</span>[<span class="ruby-identifier">:content_type</span>]
227
- 55: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">add_field</span> <span class="ruby-value str">&quot;User-Agent&quot;</span>, <span class="ruby-value str">&quot;Ruby&quot;</span>
227
+ 55: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">add_field</span> <span class="ruby-value str">&quot;User-Agent&quot;</span>, <span class="ruby-value str">&quot;exact4r v0.7&quot;</span>
228
228
  56: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">add_field</span> <span class="ruby-value str">&quot;Content-type&quot;</span>, <span class="ruby-node">&quot;#{transport_details[:content_type]}; charset=UTF-8&quot;</span>
229
229
  57:
230
230
  58: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">get_connection</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">request</span>)
data/doc/created.rid CHANGED
@@ -1 +1 @@
1
- Tue, 10 Mar 2009 12:04:48 +1100
1
+ Wed, 10 Jun 2009 12:23:07 +1000
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Tue Mar 10 11:58:52 +1100 2009</td>
59
+ <td>Wed Jun 10 12:21:52 +1000 2009</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.7</h2>
72
+ <h2>v0.8</h2>
73
+ <pre>
74
+ Added User-Agent string to HTTP requests
75
+ </pre>
76
+ <h2>v0.7</h2>
73
77
  <pre>
74
78
  Updated with latest certificates for api.e-xact.com
75
79
  Fixed SOAP namespace issue
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Tue Mar 10 11:59:06 +1100 2009</td>
59
+ <td>Wed Jun 10 12:21:24 +1000 2009</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.7
73
+ 0.8
74
74
  </p>
75
75
 
76
76
  </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>Fri Feb 27 15:24:14 +1100 2009</td>
59
+ <td>Wed Jun 10 12:04:40 +1000 2009</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -158,19 +158,20 @@ module EWS # :nodoc:
158
158
  root.elements.to_a.each do |node|
159
159
  gwlib_prop_name = XML_RESPONSE_TAGS_TO_ATTRS[node.name.to_sym]
160
160
  unless gwlib_prop_name.nil?
161
- # todo: should notiy this somehow??
162
- value = (ATTR_FORMATS.include?(gwlib_prop_name)) ? node.text.send("to_#{ATTR_FORMATS[gwlib_prop_name]}") : node.text
161
+ value = case gwlib_prop_name
162
+ when :transaction_approved, :transaction_error
163
+ (node.text == "true") ? 1 : 0
164
+ when :transaction_tag
165
+ node.text.to_i
166
+ else
167
+ node.text
168
+ end
169
+
163
170
  response.send "#{gwlib_prop_name}=", value
164
171
  end
165
172
  end
166
173
  end
167
174
 
168
- # type-conversion from strings for certain attributes
169
- ATTR_FORMATS = {
170
- :transaction_tag => "i",
171
- :transaction_approved => "i"
172
- }
173
-
174
175
  REQUEST_ENVELOPE_NAMESPACES = {
175
176
  "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema",
176
177
  "xmlns:soap" => "http://schemas.xmlsoap.org/soap/envelope/",
@@ -52,7 +52,7 @@ module EWS # :nodoc:
52
52
  request = build_http_request(transaction, transport_type, transport_details[:suffix])
53
53
  request.basic_auth(transaction.gateway_id, transaction.password)
54
54
  request.add_field "Accept", transport_details[:content_type]
55
- request.add_field "User-Agent", "exact4r v0.7"
55
+ request.add_field "User-Agent", "exact4r v0.9"
56
56
  request.add_field "Content-type", "#{transport_details[:content_type]}; charset=UTF-8"
57
57
 
58
58
  response = get_connection.request(request)
data/qa.log ADDED
@@ -0,0 +1,14 @@
1
+ (in /Volumes/Exact/WebService/exact4r)
2
+ ..............[].[].[].[]F.........
3
+
4
+ 1)
5
+ RuntimeError in 'Submitting Find Requests should support SOAP'
6
+ Malformed XML Request.
7
+ ./spec/../lib/ews/transaction/mapping.rb:133:in `soap_to_response'
8
+ ./spec/../lib/ews/transporter.rb:66:in `send'
9
+ ./spec/../lib/ews/transporter.rb:66:in `submit'
10
+ ./spec/request_spec.rb:135:
11
+
12
+ Finished in 102.726155 seconds
13
+
14
+ 27 examples, 1 failure
data/spec/request_spec.rb CHANGED
@@ -50,6 +50,7 @@ describe "Submitting New Requests" do
50
50
 
51
51
  resp.exact_resp_code.should == "00"
52
52
  resp.exact_message.should == "Transaction Normal"
53
+ resp.transaction_approved.should == 1
53
54
  resp.bank_message.downcase.should match(/approved/)
54
55
  resp.transaction_tag.should_not be_nil
55
56
  end
@@ -60,6 +61,7 @@ describe "Submitting New Requests" do
60
61
 
61
62
  resp.exact_resp_code.should == "00"
62
63
  resp.exact_message.should == "Transaction Normal"
64
+ resp.transaction_approved.should == 1
63
65
  resp.bank_message.downcase.should match(/approved/)
64
66
  resp.transaction_tag.should_not be_nil
65
67
  end
@@ -70,6 +72,7 @@ describe "Submitting New Requests" do
70
72
 
71
73
  resp.exact_resp_code.should == "00"
72
74
  resp.exact_message.should == "Transaction Normal"
75
+ resp.transaction_approved.should == 1
73
76
  resp.bank_message.downcase.should match(/approved/)
74
77
  resp.transaction_tag.should_not be_nil
75
78
  end
@@ -80,6 +83,7 @@ describe "Submitting New Requests" do
80
83
 
81
84
  resp.exact_resp_code.should == "00"
82
85
  resp.exact_message.should == "Transaction Normal"
86
+ resp.transaction_approved.should == 1
83
87
  resp.bank_message.downcase.should match(/approved/)
84
88
  resp.transaction_tag.should_not be_nil
85
89
  end
data/spec/spec_helper.rb CHANGED
@@ -7,13 +7,13 @@ require 'ruby-debug'
7
7
  REPLICATION_TIME = 20
8
8
 
9
9
  # address & authentication for testing against api.e-xact.com
10
- LOCATION = "https://api.e-xact.com/"
11
- BASIC_AUTH = {:gateway_id => "A00049-01", :password => "test1"}
10
+ # LOCATION = "https://api.e-xact.com/"
11
+ # BASIC_AUTH = {:gateway_id => "A00049-01", :password => "test1"}
12
12
 
13
13
  # address & authentication for local testing
14
- # LOCATION = "http://ws.local/" # I am a Passenger...
14
+ LOCATION = "http://ws.local/" # I am a Passenger...
15
15
  # LOCATION = "http://localhost:3000/" # old skool
16
- # BASIC_AUTH = {:gateway_id => "AD0008-01", :password => "7nfcpc7n"}
16
+ BASIC_AUTH = {:gateway_id => "AD0008-01", :password => "7nfcpc7n"}
17
17
 
18
18
  Spec::Runner.configure do |config|
19
19
  include EWS::Transaction
@@ -30,14 +30,14 @@ describe "Transporter creating transactions" do
30
30
  resp.error_description.should == "Not Found"
31
31
  end
32
32
 
33
- it "should throw an exception when parsing a response to sending nonsense SOAP" do
33
+ it "should correctly decode error when sending nonsense SOAP" do
34
34
  req = basic_find_transaction
35
35
 
36
36
  EWS::Transaction::Mapping.stubs(:request_to_soap).returns("Complete and utter rubbish. It's not even XML!!")
37
37
  tr = ::EWS::Transporter.new(LOCATION)
38
- lambda {
39
- tr.submit(req, :soap)
40
- }.should raise_error
38
+ r = tr.submit(req, :soap)
39
+ r.error_number.should == 401
40
+ r.error_description.should == "Malformed XML Request."
41
41
  end
42
42
 
43
43
  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.8"
4
+ version: "0.9"
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-06-10 00:00:00 +10:00
12
+ date: 2009-07-08 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -45,6 +45,7 @@ extra_rdoc_files:
45
45
  - VERSION
46
46
  files:
47
47
  - ./after.log
48
+ - ./before.log
48
49
  - ./certs
49
50
  - ./certs/equifax_ca.cer
50
51
  - ./certs/exact.cer
@@ -90,6 +91,7 @@ files:
90
91
  - ./lib/ews/transporter.rb
91
92
  - ./lib/exact4r.rb
92
93
  - ./LICENCE
94
+ - ./qa.log
93
95
  - ./Rakefile
94
96
  - ./README
95
97
  - ./spec