strikeiron_address_verification 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+ gem 'activesupport'
6
+ gem 'crack'
7
+ gem 'rest-client'
8
+ # Add dependencies to develop your gem here.
9
+ # Include everything needed to run rake, tests, features, etc.
10
+ group :development do
11
+ gem "rspec", "~> 2.8.0"
12
+ gem "rdoc", "~> 3.12"
13
+ gem "bundler", "~> 1.0.0"
14
+ gem "jeweler", "~> 1.8.4"
15
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,43 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.2.6)
5
+ i18n (~> 0.6)
6
+ multi_json (~> 1.0)
7
+ crack (0.3.1)
8
+ diff-lcs (1.1.3)
9
+ git (1.2.5)
10
+ i18n (0.6.0)
11
+ jeweler (1.8.4)
12
+ bundler (~> 1.0)
13
+ git (>= 1.2.5)
14
+ rake
15
+ rdoc
16
+ json (1.7.3)
17
+ mime-types (1.19)
18
+ multi_json (1.3.6)
19
+ rake (0.9.2.2)
20
+ rdoc (3.12)
21
+ json (~> 1.4)
22
+ rest-client (1.6.7)
23
+ mime-types (>= 1.16)
24
+ rspec (2.8.0)
25
+ rspec-core (~> 2.8.0)
26
+ rspec-expectations (~> 2.8.0)
27
+ rspec-mocks (~> 2.8.0)
28
+ rspec-core (2.8.0)
29
+ rspec-expectations (2.8.0)
30
+ diff-lcs (~> 1.1.2)
31
+ rspec-mocks (2.8.0)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ activesupport
38
+ bundler (~> 1.0.0)
39
+ crack
40
+ jeweler (~> 1.8.4)
41
+ rdoc (~> 3.12)
42
+ rest-client
43
+ rspec (~> 2.8.0)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Jon Turner
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = strikeiron_address_verification
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to strikeiron_address_verification
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2012 Jon Turner. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "strikeiron_address_verification"
18
+ gem.homepage = "http://github.com/jturner954/strikeiron_address_verification"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Strike Iron Address Verification}
21
+ gem.description = %Q{Strike Iron Address Verification}
22
+ gem.email = "jturner@saveology.com"
23
+ gem.authors = ["Jon Turner"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ task :default => :spec
35
+
36
+ require 'rdoc/task'
37
+ Rake::RDocTask.new do |rdoc|
38
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
39
+
40
+ rdoc.rdoc_dir = 'rdoc'
41
+ rdoc.title = "strikeiron_address_verification #{version}"
42
+ rdoc.rdoc_files.include('README*')
43
+ rdoc.rdoc_files.include('lib/**/*.rb')
44
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
File without changes
@@ -0,0 +1,7 @@
1
+ STRIKEIRON_ADDRESS_VERIFICATION_ON: 'true'
2
+ STRIKEIRON_ADDRESS_VERIFICATION_URL: 'http://ws.strikeiron.com/NAAddressVerification6/NorthAmericanAddressVerificationService/NorthAmericanAddressVerification'
3
+ STRIKEIRON_USERID: 'fkaram@elephantgroup.com'
4
+ STRIKEIRON_PW: 'ssellsat1i'
5
+ STRIKEIRON_TIMEOUT: '3'
6
+ STRIKEIRON_OPEN_TIMEOUT: '1'
7
+
@@ -0,0 +1,13 @@
1
+ require 'strikeiron_address_verification/address'
2
+ module STRIKEIRON_ADDRESS_VERIFICATION
3
+ class << self
4
+ attr_accessor :username
5
+ attr_accessor :password
6
+ attr_accessor :url
7
+ attr_accessor :timeout
8
+ attr_accessor :open_timeout
9
+ end
10
+ def self.configure(&block)
11
+ yield(self)
12
+ end
13
+ end
@@ -0,0 +1,89 @@
1
+ require 'rest-client'
2
+ require 'crack'
3
+ require 'active_support/core_ext/string'
4
+ #require 'active_support/core_ext/hash'
5
+ module STRIKEIRON_ADDRESS_VERIFICATION
6
+ class Address
7
+ attr_accessor :username, :password, :url, :timeout, :open_timeout
8
+ attr_accessor :street_address, :street_address_2, :city, :state, :zip_code, :status, :status_msg, :error, :request, :response
9
+ def initialize
10
+ @username = STRIKEIRON_ADDRESS_VERIFICATION.username
11
+ @password = STRIKEIRON_ADDRESS_VERIFICATION.password
12
+ @url = STRIKEIRON_ADDRESS_VERIFICATION.url
13
+ @timeout = STRIKEIRON_ADDRESS_VERIFICATION.timeout
14
+ @open_timeout = STRIKEIRON_ADDRESS_VERIFICATION.open_timeout
15
+ @street_address = @street_address_2 = @city = @state = @zip_code = @status = @status_msg = @request = @response = ''
16
+ end
17
+
18
+ def verify(args)
19
+ @street_address = args[:street_address] if args[:street_address]
20
+ @street_address_2 = args[:street_address_2] if args[:street_address_2]
21
+ @city = args[:city] if args[:city]
22
+ @state = args[:state] if args[:state]
23
+ @zip_code = args[:zip_code] if args[:zip_code]
24
+ process
25
+ end
26
+
27
+ def is_valid?
28
+ @is_valid || @error.present?
29
+ end
30
+
31
+ private
32
+
33
+ def process
34
+ begin
35
+ fire_request
36
+ hashed_response = Crack::XML.parse(@response)['WebServiceResponse']['NorthAmericanAddressVerificationResponse']['NorthAmericanAddressVerificationResult']
37
+ @status = hashed_response['ServiceStatus']['StatusNbr']
38
+ @status_msg = hashed_response['ServiceStatus']['StatusDescription']
39
+ @is_valid = is_address_valid?
40
+ rescue Exception => e
41
+ @error = e.message
42
+ end
43
+ end
44
+
45
+ def fire_request
46
+ # open_timeout: amount of time to open connection
47
+ # timeout: amount of time to wait for response
48
+ @response = RestClient::Request.execute(:method => :post, :url => STRIKEIRON_ADDRESS_VERIFICATION.url, :payload => prepare_payload, :headers => {}, :timeout => STRIKEIRON_ADDRESS_VERIFICATION.timeout, :open_timeout => STRIKEIRON_ADDRESS_VERIFICATION.open_timeout)
49
+ end
50
+
51
+ def is_address_valid?
52
+ @status != 304 && @status != 402
53
+ end
54
+
55
+ def prepare_payload
56
+ payload = {}
57
+ payload[:'LicenseInfo.RegisteredUser.UserID'] = STRIKEIRON_ADDRESS_VERIFICATION.username
58
+ payload[:'LicenseInfo.RegisteredUser.Password'] = STRIKEIRON_ADDRESS_VERIFICATION.password
59
+ payload[:'NorthAmericanAddressVerification.AddressLine1'] = @street_address
60
+ payload[:'NorthAmericanAddressVerification.AddressLine2'] = @street_address_2
61
+ payload[:'NorthAmericanAddressVerification.CityStateOrProvinceZIPOrPostalCode'] = "#{@city} #{@state} #{@zip_code}"
62
+ payload[:'NorthAmericanAddressVerification.Country'] = 'US'
63
+ payload[:'NorthAmericanAddressVerification.Casing'] = 'PROPER'
64
+ payload
65
+ end
66
+ end
67
+
68
+ end
69
+
70
+ # == Schema Information
71
+ #
72
+ # Table name: address_verifications
73
+ #
74
+ # id :integer not null, primary key
75
+ # order_id :integer
76
+ # street_address :string(255) default(""), not null
77
+ # street_address_2 :string(255) default("")
78
+ # city :string(255) default(""), not null
79
+ # state :string(255) default(""), not null
80
+ # zip_code :string(255) default(""), not null
81
+ # is_valid :boolean default(FALSE), not null
82
+ # status :integer
83
+ # status_msg :string(255)
84
+ # error :string(255)
85
+ # response :text
86
+ # created_at :datetime
87
+ # updated_at :datetime
88
+ #
89
+
@@ -0,0 +1,15 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'strikeiron_address_verification'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+ dev = File.join('config', 'development.yml')
12
+ YAML.load(File.open(dev)).each do |key, value|
13
+ ENV[key.to_s] = value
14
+ end if File.exists?(dev)
15
+ end
@@ -0,0 +1,60 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "StrikeironAddressVerification" do
4
+ describe "Address" do
5
+ before do
6
+ STRIKEIRON_ADDRESS_VERIFICATION.configure do |config|
7
+ config.username = invalid_username
8
+ config.password = invalid_password
9
+ config.url = invalid_url
10
+ config.timeout = 1
11
+ config.open_timeout = 1
12
+ end
13
+ end
14
+
15
+ let(:username) { ENV['STRIKEIRON_USERID'] }
16
+ let(:password) { ENV['STRIKEIRON_PW'] }
17
+ let(:url) { ENV['STRIKEIRON_ADDRESS_VERIFICATION_URL'] }
18
+ let(:timeout) { ENV['STRIKEIRON_TIMEOUT'] }
19
+ let(:open_timeout) { ENV['STRIKEIRON_OPEN_TIMEOUT'] }
20
+
21
+ let(:invalid_username) { "testusername" }
22
+ let(:invalid_password) { "testpassword" }
23
+ let(:invalid_url) { "http://www.invalidurl.com/" }
24
+
25
+ let(:address_options){
26
+ {
27
+ :street_address => '4701 Coconut Creek Parkway',
28
+ :street_address_2 => '',
29
+ :city => 'Margate',
30
+ :state => 'FL',
31
+ :zip_code => '33063'
32
+ }
33
+ }
34
+
35
+ subject { STRIKEIRON_ADDRESS_VERIFICATION::Address.new }
36
+
37
+ it "should initialize" do
38
+ subject.username.should == invalid_username
39
+ subject.password.should == invalid_password
40
+ subject.url.should == invalid_url
41
+ subject.street_address.should == ''
42
+ subject.street_address_2.should == ''
43
+ subject.city.should == ''
44
+ subject.state.should == ''
45
+ subject.zip_code.should == ''
46
+ subject.status.should == ''
47
+ subject.status_msg.should == ''
48
+ #subject.error.should == ''
49
+ subject.request.should == ''
50
+ subject.response.should == ''
51
+ end
52
+
53
+ it "should accept a verify request" do
54
+ subject.verify address_options
55
+ subject.is_valid?.should be
56
+ end
57
+
58
+
59
+ end
60
+ end
data/spec/test.rb ADDED
@@ -0,0 +1,286 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Atpay" do
4
+ describe "Payment" do
5
+ before do
6
+ ATPAY.configure do |config|
7
+ config.username = invalid_username
8
+ config.password = invalid_password
9
+ config.host = host
10
+ end
11
+ end
12
+ let(:successful_response){ File.open(File::dirname(__FILE__) << './lib/successful_response','r').read }
13
+ let(:username) { ENV['ATPAY_USERNAME'] }
14
+ let(:password) { ENV['ATPAY_PASSWORD'] }
15
+ let(:host) { ENV['ATPAY_HOST'] }
16
+ let(:account_id) { ENV['ATPAY_TEST_ACCOUNT_ID'] }
17
+ let(:sub_account_id) { ENV['ATPAY_TEST_SUB_ACCOUNT_ID'] }
18
+ let(:invalid_username) { "testusername" }
19
+ let(:invalid_password) { "testpassword" }
20
+
21
+ let(:test_name_on_card) { 'Test User' }
22
+ let(:test_card_number) { '4111111111111111' }
23
+ let(:test_cvv) { '400' }
24
+ let(:test_expiration_date) { '1013' }
25
+
26
+ let(:valid_name_on_card) { ENV['ATPAY_VALID_NAME_ON_CARD'] }
27
+ let(:valid_card_number) { ENV['ATPAY_VALID_CARD_NUMBER'] }
28
+ let(:valid_cvv) { ENV['ATPAY_VALID_CARD_CVV'] }
29
+ let(:valid_expiration_date) { ENV['ATPAY_VALID_CARD_EXPIRE_DATE'] }
30
+
31
+ let(:additional_params) {
32
+ {
33
+ :email => 'test@123.com',
34
+ :order_id => '4444444'
35
+ }
36
+ }
37
+ let(:free_text){
38
+ "Lead=3333; OPR=4000; AFF=1092; SKU=55555; EMAIL=test@123.com"
39
+ }
40
+ let(:payment_options) {
41
+ {
42
+ :name_on_card => test_name_on_card,
43
+ :number => test_card_number,
44
+ :cvv => test_cvv,
45
+ :expiration_date => test_expiration_date,
46
+ :email => 'test@123.com',
47
+ :order_id => '4444444',
48
+ :free_text => free_text,
49
+ :first_name => 'Jacob',
50
+ :last_name => 'Smith',
51
+ :email => 'test@123.com',
52
+ :address => '123 home rd',
53
+ :address2 => 'Suite 3',
54
+ :city => 'Hollywood',
55
+ :state => 'FL',
56
+ :zip => '33019',
57
+ :phone => '5554443434',
58
+ :ip_address => '10.10.10.22',
59
+ :amount => 10.00,
60
+ :account_id => account_id,
61
+ :sub_account_id => sub_account_id,
62
+ :service_expiry_method => '',
63
+ :service_expiry_method_additional_info => ''
64
+ }
65
+ }
66
+ let(:recurring_payment_options) {
67
+ {
68
+ :recurring_payment => true,
69
+ :name_on_card => test_name_on_card,
70
+ :number => test_card_number,
71
+ :cvv => test_cvv,
72
+ :expiration_date => test_expiration_date,
73
+ :email => 'test@123.com',
74
+ :order_id => '4444444',
75
+ :free_text => free_text,
76
+ :first_name => 'Jacob',
77
+ :last_name => 'Smith',
78
+ :email => 'test@123.com',
79
+ :address => '123 home rd',
80
+ :address2 => 'Suite 3',
81
+ :city => 'Hollywood',
82
+ :state => 'FL',
83
+ :zip => '33019',
84
+ :phone => '5554443434',
85
+ :ip_address => '127.0.0.1',
86
+ :amount => 0,
87
+ :recurring_amount => 0,
88
+ :base_amount => 0,
89
+ :first_installment_amount => 0,
90
+ :initial_pre_auth_amount => 0,
91
+ :first_installment_interval => 0,
92
+ :recurring_installment_interval_method => 'Daily',
93
+ :recurring_installment_interval_additional_info => '',
94
+ :account_id => account_id,
95
+ :sub_account_id => sub_account_id,
96
+ :service_expiry_method => '',
97
+ :service_expiry_method_additional_info => ''
98
+ }
99
+ }
100
+ subject { ATPAY::Payment.new }
101
+ it "should initialize" do
102
+ subject.username.should == invalid_username
103
+ subject.password.should == invalid_password
104
+ subject.host.should == host
105
+ subject.first_name.should == ''
106
+ subject.last_name.should == ''
107
+ subject.email.should == ''
108
+ subject.address.should == ''
109
+ subject.address2.should == ''
110
+ subject.city.should == ''
111
+ subject.state.should == ''
112
+ subject.zip.should == ''
113
+ subject.phone.should == ''
114
+ subject.ip_address.should == '127.0.0.1'
115
+ subject.name_on_card.should == ''
116
+ subject.number.should == ''
117
+ subject.credit_card_type.should == 'Empty'
118
+ subject.cvv.should == ''
119
+ subject.expiration_date.should == ''
120
+ subject.amount.should == 0
121
+ subject.free_text.should == ''
122
+ subject.recurring_payment.should be_false
123
+ subject.base_amount.should == 0
124
+ subject.first_installment_amount.should == 0
125
+ subject.initial_pre_auth_amount.should == 0
126
+ subject.first_installment_interval.should == 0
127
+ subject.recurring_amount.should == 0
128
+ subject.recurring_installment_interval_method.should == 'Daily'
129
+ subject.recurring_installment_interval_method_additional_info.should == ''
130
+ subject.account_id.should == ''
131
+ subject.sub_account_id.should == ''
132
+ subject.service_expiry_method.should == ''
133
+ subject.service_expiry_method_additional_info.should == ''
134
+ subject.request.should == ''
135
+ subject.response.should == ''
136
+ subject.success.should be_false
137
+ subject.transaction_id.should == ''
138
+ end
139
+ it "should accept a payment request" do
140
+ subject.charge payment_options
141
+ subject.recurring_payment.should be_false
142
+ end
143
+ it "should default to standard payment" do
144
+ subject.charge payment_options
145
+ subject.recurring_payment.should be_false
146
+ subject.name_on_card.should == test_name_on_card
147
+ subject.number.should == test_card_number
148
+ subject.cvv.should == test_cvv
149
+ subject.expiration_date.should == test_expiration_date
150
+ subject.credit_card_type.should == 'Visa'
151
+ subject.email.should == 'test@123.com'
152
+ subject.order_id.should == '4444444'
153
+ subject.free_text.should == free_text
154
+ subject.first_name.should == 'Jacob'
155
+ subject.last_name.should == 'Smith'
156
+ subject.email.should == 'test@123.com'
157
+ subject.address.should == '123 home rd'
158
+ subject.address2.should == 'Suite 3'
159
+ subject.city.should == 'Hollywood'
160
+ subject.state.should == 'FL'
161
+ subject.zip.should == '33019'
162
+ subject.phone.should == '5554443434'
163
+ subject.ip_address.should == '10.10.10.22'
164
+ subject.amount.should == 10.00
165
+ subject.account_id.should == account_id
166
+ subject.sub_account_id.should == sub_account_id
167
+ subject.service_expiry_method.should == ''
168
+ subject.service_expiry_method_additional_info.should == ''
169
+ end
170
+ it "should accept a reccuring payment request" do
171
+ subject.charge recurring_payment_options
172
+ subject.recurring_payment.should be_true
173
+ end
174
+ it "invalid username or password should deny access" do
175
+ subject.charge(payment_options).should be_false
176
+ subject.response.code.should == 401
177
+ subject.error.should == 'Access is denied due to invalid credentials'
178
+ subject.transaction_id.should == ''
179
+ end
180
+ end
181
+ describe "Payment with valid data" do
182
+ let(:username) { ENV['ATPAY_USERNAME'] }
183
+ let(:password) { ENV['ATPAY_PASSWORD'] }
184
+ let(:host) { ENV['ATPAY_HOST'] }
185
+ let(:account_id) { ENV['ATPAY_TEST_ACCOUNT_ID'] }
186
+ let(:sub_account_id) { ENV['ATPAY_TEST_SUB_ACCOUNT_ID'] }
187
+
188
+ let(:test_name_on_card) { 'Test User' }
189
+ let(:test_card_number) { '4111111111111111' }
190
+ let(:test_cvv) { '400' }
191
+ let(:test_expiration_date) { '10/2013' }
192
+
193
+ let(:valid_name_on_card) { ENV['ATPAY_VALID_NAME_ON_CARD'] }
194
+ let(:valid_card_number) { ENV['ATPAY_VALID_CARD_NUMBER'] }
195
+ let(:valid_cvv) { ENV['ATPAY_VALID_CARD_CVV'] }
196
+ let(:valid_expiration_date) { ENV['ATPAY_VALID_CARD_EXPIRE_DATE'] }
197
+
198
+ let(:additional_params) {
199
+ {
200
+ :email => 'test@123.com',
201
+ :order_id => '4444444'
202
+ }
203
+ }
204
+ let(:free_text){
205
+ "Lead=3333; OPR=4000; AFF=1092; SKU=55555; EMAIL=test@123.com"
206
+ }
207
+ let(:payment_options) {
208
+ {
209
+ :name_on_card => test_name_on_card,
210
+ :number => test_card_number,
211
+ :cvv => test_cvv,
212
+ :expiration_date => test_expiration_date,
213
+ :email => 'test@123.com',
214
+ :order_id => '4444444',
215
+ :free_text => free_text,
216
+ :first_name => 'Jacob',
217
+ :last_name => 'Smith',
218
+ :email => 'test@123.com',
219
+ :address => '123 home rd',
220
+ :address2 => 'Suite 3',
221
+ :city => 'Hollywood',
222
+ :state => 'FL',
223
+ :zip => '33019',
224
+ :phone => '5554443434',
225
+ :ip_address => '10.10.10.22',
226
+ :amount => 10.00,
227
+ :account_id => account_id,
228
+ :sub_account_id => sub_account_id,
229
+ :service_expiry_method => 'NoEndDate',
230
+ :service_expiry_method_additional_info => ''
231
+ }
232
+ }
233
+ let(:recurring_payment_options) {
234
+ {
235
+ :recurring_payment => true,
236
+ :name_on_card => test_name_on_card,
237
+ :number => test_card_number,
238
+ :cvv => test_cvv,
239
+ :expiration_date => test_expiration_date,
240
+ :email => 'test@123.com',
241
+ :order_id => '4444444',
242
+ :free_text => free_text,
243
+ :first_name => 'Jacob',
244
+ :last_name => 'Smith',
245
+ :email => 'test@123.com',
246
+ :address => '123 home rd',
247
+ :address2 => 'Suite 3',
248
+ :city => 'Hollywood',
249
+ :state => 'FL',
250
+ :zip => '33019',
251
+ :phone => '5554443434',
252
+ :ip_address => '127.0.0.1',
253
+ :amount => 0,
254
+ :recurring_amount => 0,
255
+ :base_amount => 0,
256
+ :first_installment_amount => 0,
257
+ :initial_pre_auth_amount => 0,
258
+ :first_installment_interval => 0,
259
+ :recurring_installment_interval_method => 'Daily',
260
+ :recurring_installment_interval_additional_info => '',
261
+ :account_id => account_id,
262
+ :sub_account_id => sub_account_id,
263
+ :service_expiry_method => 'NoEndDate',
264
+ :service_expiry_method_additional_info => ''
265
+ }
266
+ }
267
+ before do
268
+ ATPAY.configure do |config|
269
+ config.username = username
270
+ config.password = password
271
+ config.host = host
272
+ end
273
+ end
274
+ subject { ATPAY::Payment.new }
275
+ it "valid request should return true with a transaction_id" do
276
+ payment_options[:name_on_card] = valid_name_on_card
277
+ payment_options[:number] = valid_card_number
278
+ payment_options[:cvv] = valid_cvv
279
+ payment_options[:expiration_date] = valid_expiration_date
280
+ response = subject.charge(payment_options)
281
+ response.should be_true
282
+ subject.transaction_id.should_not == ''
283
+ subject.error.should == ''
284
+ end
285
+ end
286
+ end
@@ -0,0 +1,73 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "strikeiron_address_verification"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jon Turner"]
12
+ s.date = "2012-06-28"
13
+ s.description = "Strike Iron Address Verification"
14
+ s.email = "jturner@saveology.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "config/development.example.yaml",
29
+ "config/development.yaml",
30
+ "lib/strikeiron_address_verification.rb",
31
+ "lib/strikeiron_address_verification/address.rb",
32
+ "spec/spec_helper.rb",
33
+ "spec/strikeiron_address_verification_spec.rb",
34
+ "spec/test.rb",
35
+ "strikeiron_address_verification.gemspec"
36
+ ]
37
+ s.homepage = "http://github.com/jturner954/strikeiron_address_verification"
38
+ s.licenses = ["MIT"]
39
+ s.require_paths = ["lib"]
40
+ s.rubygems_version = "1.8.15"
41
+ s.summary = "Strike Iron Address Verification"
42
+
43
+ if s.respond_to? :specification_version then
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
48
+ s.add_runtime_dependency(%q<crack>, [">= 0"])
49
+ s.add_runtime_dependency(%q<rest-client>, [">= 0"])
50
+ s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
51
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
52
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
53
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
54
+ else
55
+ s.add_dependency(%q<activesupport>, [">= 0"])
56
+ s.add_dependency(%q<crack>, [">= 0"])
57
+ s.add_dependency(%q<rest-client>, [">= 0"])
58
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
59
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
60
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
61
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
62
+ end
63
+ else
64
+ s.add_dependency(%q<activesupport>, [">= 0"])
65
+ s.add_dependency(%q<crack>, [">= 0"])
66
+ s.add_dependency(%q<rest-client>, [">= 0"])
67
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
68
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
69
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
70
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
71
+ end
72
+ end
73
+
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: strikeiron_address_verification
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jon Turner
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-28 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: &2168751080 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2168751080
25
+ - !ruby/object:Gem::Dependency
26
+ name: crack
27
+ requirement: &2168750500 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *2168750500
36
+ - !ruby/object:Gem::Dependency
37
+ name: rest-client
38
+ requirement: &2168749940 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *2168749940
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &2168749420 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 2.8.0
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2168749420
58
+ - !ruby/object:Gem::Dependency
59
+ name: rdoc
60
+ requirement: &2168748820 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '3.12'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2168748820
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: &2168748220 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 1.0.0
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *2168748220
80
+ - !ruby/object:Gem::Dependency
81
+ name: jeweler
82
+ requirement: &2168747560 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: 1.8.4
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *2168747560
91
+ description: Strike Iron Address Verification
92
+ email: jturner@saveology.com
93
+ executables: []
94
+ extensions: []
95
+ extra_rdoc_files:
96
+ - LICENSE.txt
97
+ - README.rdoc
98
+ files:
99
+ - .document
100
+ - .rspec
101
+ - Gemfile
102
+ - Gemfile.lock
103
+ - LICENSE.txt
104
+ - README.rdoc
105
+ - Rakefile
106
+ - VERSION
107
+ - config/development.example.yaml
108
+ - config/development.yaml
109
+ - lib/strikeiron_address_verification.rb
110
+ - lib/strikeiron_address_verification/address.rb
111
+ - spec/spec_helper.rb
112
+ - spec/strikeiron_address_verification_spec.rb
113
+ - spec/test.rb
114
+ - strikeiron_address_verification.gemspec
115
+ homepage: http://github.com/jturner954/strikeiron_address_verification
116
+ licenses:
117
+ - MIT
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ segments:
129
+ - 0
130
+ hash: -3924847419987601698
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 1.8.15
140
+ signing_key:
141
+ specification_version: 3
142
+ summary: Strike Iron Address Verification
143
+ test_files: []