exact4r 1.0 → 1.1

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
+ == v1.1
2
+ Removed debugger statement. Sorry!
3
+
1
4
  == v1.0
2
5
  Added support for Batch Query and Batch Close transactions.
3
6
 
data/Rakefile CHANGED
@@ -27,7 +27,7 @@ namespace :test do
27
27
  desc 'Run all tests against Chase processor and Production web service. Use LOCATION to specify web service URL.'
28
28
  task :chase do
29
29
  ENV['PROCESSOR'] = 'chase'
30
- ENV['LOCATION'] = 'PROD'
30
+ ENV['LOCATION'] = 'PROD' if ENV['LOCATION'].nil?
31
31
  begin
32
32
  Rake::Task[:'test:processor'].execute
33
33
  rescue
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0
1
+ 1.1
data/after.log ADDED
@@ -0,0 +1,4 @@
1
+ (in /Volumes/Exact/WebService/exact4r)
2
+ Loaded suite /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
3
+ Started
4
+ .................................................................
@@ -31,8 +31,6 @@ module EWS # :nodoc:
31
31
  @url = URI.parse(url.gsub(/\/$/,''))
32
32
  @transport_type = options[:transport_type] || :rest
33
33
 
34
- debugger
35
-
36
34
  @@issuer_cert ||= File.dirname(__FILE__)+"/../../certs/equifax_ca.cer"
37
35
  @@server_cert ||= File.new(File.dirname(__FILE__)+"/../../certs/exact.cer").read
38
36
  end
@@ -54,7 +52,7 @@ module EWS # :nodoc:
54
52
  request = build_http_request(transaction, transport_type, transport_details[:suffix])
55
53
  request.basic_auth(transaction.gateway_id, transaction.password)
56
54
  request.add_field "Accept", transport_details[:content_type]
57
- request.add_field "User-Agent", "exact4r v1.0"
55
+ request.add_field "User-Agent", "exact4r v1.1"
58
56
  request.add_field "Content-type", "#{transport_details[:content_type]}; charset=UTF-8"
59
57
 
60
58
  response = get_connection.request(request)
data/test/credentials.rb CHANGED
@@ -4,7 +4,8 @@ module Exact
4
4
  attr_accessor :config
5
5
 
6
6
  def initialize
7
- load_configuration(ENV['LOCATION'])
7
+ location = ENV['LOCATION'] || 'DEV'
8
+ load_configuration(location)
8
9
  end
9
10
 
10
11
  # obtain the credentials for the processor specified by
data/test/credentials.yml CHANGED
@@ -1,37 +1,19 @@
1
1
  DEV:
2
2
  location: http://ws.local/
3
3
  tsys:
4
- :gateway_id: AD0007-01
5
- :password: 3uLi726f
6
- emergis:
7
- :gateway_id: AD0009-01
8
- :password: 8L588rmd
9
- moneris:
10
- :gateway_id: AD0154-01
11
- :password: 77hgy56y
12
- chase:
13
- :gateway_id: AD0008-01
14
- :password: 7nfcpc7n
15
- chase_batch:
16
- :gateway_id: AD0021-02
17
- :password: 22ra7k69
18
-
19
- QA:
20
- location: http://api.qa.e-xact.com/
21
- tsys:
22
- :gateway_id: A04766-01
4
+ :gateway_id: AD0156-01
23
5
  :password: 4apitest
24
6
  emergis:
25
- :gateway_id: A04763-01
7
+ :gateway_id: AD0155-01
26
8
  :password: 4apitest
27
9
  moneris:
28
- :gateway_id: A04760-01
10
+ :gateway_id: AD0154-01
29
11
  :password: 4apitest
30
12
  chase:
31
- :gateway_id: A04757-02
13
+ :gateway_id: AD0157-01
32
14
  :password: 4apitest
33
15
  chase_batch:
34
- :gateway_id: A04757-01
16
+ :gateway_id: AD0158-01
35
17
  :password: 4apitest
36
18
 
37
19
  PROD:
@@ -45,15 +45,16 @@ class BatchQueryCloseTest < Test::Unit::TestCase
45
45
 
46
46
  response = @transporter.submit(request, :json)
47
47
  assert_response_approved response
48
- assert_equal "BATINQ", response.authorization_num
48
+
49
+ batch_no = response.authorization_num
49
50
 
50
51
  response = @transporter.submit(request, :rest)
51
52
  assert_response_approved response
52
- assert_equal "BATINQ", response.authorization_num
53
+ assert_equal batch_no, response.authorization_num
53
54
 
54
55
  response = @transporter.submit(request, :soap)
55
56
  assert_response_approved response
56
- assert_equal "BATINQ", response.authorization_num
57
+ assert_equal batch_no, response.authorization_num
57
58
  end
58
59
 
59
60
  def test_close_json
@@ -66,7 +67,7 @@ class BatchQueryCloseTest < Test::Unit::TestCase
66
67
 
67
68
  response = @transporter.submit(request, :json)
68
69
  assert_response_approved response
69
- assert_equal "BATCLS", response.authorization_num
70
+ assert_not_nil response.authorization_num
70
71
  end
71
72
 
72
73
  def test_close_rest
@@ -79,7 +80,7 @@ class BatchQueryCloseTest < Test::Unit::TestCase
79
80
 
80
81
  response = @transporter.submit(request, :rest)
81
82
  assert_response_approved response
82
- assert_equal "BATCLS", response.authorization_num
83
+ assert_not_nil response.authorization_num
83
84
  end
84
85
 
85
86
  def test_close_soap
@@ -92,7 +93,7 @@ class BatchQueryCloseTest < Test::Unit::TestCase
92
93
 
93
94
  response = @transporter.submit(request, :soap)
94
95
  assert_response_approved response
95
- assert_equal "BATCLS", response.authorization_num
96
+ assert_not_nil response.authorization_num
96
97
  end
97
98
 
98
99
  def test_cant_close_already_closed_batch
@@ -103,7 +104,7 @@ class BatchQueryCloseTest < Test::Unit::TestCase
103
104
 
104
105
  response = submit_batch_close
105
106
  assert !response.approved?
106
- assert_nil response.bank_resp_code
107
+ assert_nil response.authorization_num
107
108
  assert_equal "BAT ALREADY RELS", response.bank_message
108
109
  end
109
110
 
@@ -114,7 +115,8 @@ class BatchQueryCloseTest < Test::Unit::TestCase
114
115
  def test_summation
115
116
  return unless @@credentials.chase?
116
117
 
117
- submit_batch_close # ensure we're starting a new batch
118
+ # ensure we're starting a new batch
119
+ submit_batch_close
118
120
 
119
121
  submit_purchase(:amount => 10.00)
120
122
  submit_purchase(:amount => 15.29)
@@ -133,32 +135,42 @@ class BatchQueryCloseTest < Test::Unit::TestCase
133
135
 
134
136
  response = submit_batch_query
135
137
  assert_response_approved response
136
- assert_equal "BATINQ", response.authorization_num
137
138
  assert_equal "<CR|5|344751><AE|4|111399>", response.bank_message
138
139
 
140
+ batch_no = response.authorization_num
141
+
139
142
  # now close the batch
140
143
  response = submit_batch_close
141
144
  assert_response_approved response
142
- assert_equal "BATCLS", response.authorization_num
145
+ assert_equal batch_no, response.authorization_num
143
146
  assert_equal "<CR|5|344751><AE|4|111399>", response.bank_message
144
147
  end
145
148
 
146
149
  def test_large_summation
147
150
  return unless @@credentials.chase?
148
151
 
149
- submit_batch_close # ensure we're starting a new batch
152
+ # ensure we're starting a new batch
153
+ submit_batch_close
150
154
 
151
155
  10.times { submit_purchase(:amount => 99999.0) }
152
156
 
157
+ # query the batch
158
+ response = submit_batch_query
159
+ assert_response_approved response
160
+ assert_equal "<CR|10|99999000>", response.bank_message
161
+
162
+ batch_no = response.authorization_num
163
+
164
+ # submit another query
153
165
  response = submit_batch_query
154
166
  assert_response_approved response
155
- assert_equal "BATINQ", response.authorization_num
167
+ assert_equal batch_no, response.authorization_num
156
168
  assert_equal "<CR|10|99999000>", response.bank_message
157
169
 
158
170
  # now close the batch
159
171
  response = submit_batch_close
160
172
  assert_response_approved response
161
- assert_equal "BATCLS", response.authorization_num
173
+ assert_equal batch_no, response.authorization_num
162
174
  assert_equal "<CR|10|99999000>", response.bank_message
163
175
  end
164
176
 
@@ -31,6 +31,8 @@ class AvsTest < Test::Unit::TestCase
31
31
  end
32
32
 
33
33
  def test_encodes_for_paymentech
34
+ return unless @@credentials.chase?
35
+
34
36
  tx_params = basic_params.merge(:avs_test_flag => nil,
35
37
  :avs_street_address => '1234567LOUGHEEDHIGHW',
36
38
  :avs_unit_no => nil,
@@ -55,6 +57,8 @@ class AvsTest < Test::Unit::TestCase
55
57
  end
56
58
 
57
59
  def test_space_with_numerals_for_tsys
60
+ return unless @@credentials.tsys?
61
+
58
62
  transporter = EWS::Transporter.new(@@credentials.config['location'])
59
63
 
60
64
  # should put space between numeral and zip code for Tsys
@@ -122,7 +122,7 @@ class ValidatorTest < Test::Unit::TestCase
122
122
  assert !EWS::Transaction::Request.new(basic_params(:cc_number => "4111111111111112")).valid?
123
123
 
124
124
  # validation: card expiry (should be in MMYY format)
125
- assert EWS::Transaction::Request.new(basic_params(:cc_expiry => "1009")).valid?
125
+ assert EWS::Transaction::Request.new(basic_params(:cc_expiry => "0913")).valid?
126
126
  assert !EWS::Transaction::Request.new(basic_params(:cc_expiry => nil)).valid?
127
127
  assert !EWS::Transaction::Request.new(basic_params(:cc_expiry => "")).valid?
128
128
  assert !EWS::Transaction::Request.new(basic_params(:cc_expiry => "708")).valid?
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: "1.0"
4
+ version: "1.1"
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-10-20 00:00:00 +11:00
12
+ date: 2010-01-28 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -44,6 +44,7 @@ extra_rdoc_files:
44
44
  - README
45
45
  - VERSION
46
46
  files:
47
+ - ./after.log
47
48
  - ./certs/equifax_ca.cer
48
49
  - ./certs/exact.cer
49
50
  - ./CHANGELOG