./test/test_helper.rb in exact4r-0.9.3 vs ./test/test_helper.rb in exact4r-1.0
- old
+ new
@@ -3,23 +3,13 @@
require 'test/unit'
require 'lib/exact4r'
require 'ruby-debug'
require 'mocha'
-# address & authentication for testing against api.e-xact.com
-# LOCATION = "https://api.e-xact.com/" unless defined?(LOCATION)
-# EMERGIS_BASIC_AUTH = {:gateway_id => "A04052-01", :password => "2b1jvtds"} unless defined?(EMERGIS_BASIC_AUTH)
-# CHASE_BASIC_AUTH = {:gateway_id => "A05296-01", :password => "exactbatchdemo"} unless defined?(CHASE_BASIC_AUTH)
-# VITAL_BASIC_AUTH = {:gateway_id => "A05296-01", :password => "exactbatchdemo"} unless defined?(VITAL_BASIC_AUTH)
-# MONERIS_BASIC_AUTH = {:gateway_id => "A00049-01", :password => "test1"} unless defined?(MONERIS_BASIC_AUTH)
+require File.dirname(__FILE__) + '/credentials'
-# address & authentication for local testing
-LOCATION = "http://ws.local/" unless defined?(LOCATION) # I am a Passenger...
-EMERGIS_BASIC_AUTH = {:gateway_id => "AD0009-01", :password => "8L588rmd"} unless defined?(EMERGIS_BASIC_AUTH)
-CHASE_BASIC_AUTH = {:gateway_id => "AD0008-01", :password => "7nfcpc7n"} unless defined?(CHASE_BASIC_AUTH)
-VITAL_BASIC_AUTH = {:gateway_id => "AD0007-01", :password => "3uLi726f"} unless defined?(VITAL_BASIC_AUTH)
-MONERIS_BASIC_AUTH = {:gateway_id => "AD0154-01", :password => "77hgy56y"} unless defined?(MONERIS_BASIC_AUTH)
+@@credentials = Exact::Credentials.new
TEST_CARD_NUMBER = "4111111111111111" unless defined?(TEST_CARD_NUMBER)
TEST_CARD_EXPIRY = "0913" unless defined?(TEST_CARD_EXPIRY)
TEST_CARD_HOLDER = "Simon Jones" unless defined?(TEST_CARD_HOLDER)
TEST_TRACK1 = "%B4111111111111111^Jones/Simon ^1309101063510010000000306000000?" unless defined?(TEST_TRACK1)
@@ -28,24 +18,24 @@
def cc_number_params
{
:cc_number => TEST_CARD_NUMBER,
:cc_expiry => TEST_CARD_EXPIRY,
:cardholder_name => TEST_CARD_HOLDER
- }.merge(EMERGIS_BASIC_AUTH)
+ }.merge(@@credentials.current_gateway)
end
def track1_params
{
:track1 => TEST_TRACK1
- }.merge(EMERGIS_BASIC_AUTH)
+ }.merge(@@credentials.current_gateway)
end
def track2_params
{
:track2 => TEST_TRACK2,
:cardholder_name => TEST_CARD_HOLDER
- }.merge(EMERGIS_BASIC_AUTH)
+ }.merge(@@credentials.current_gateway)
end
def assert_details_correct(request, response)
assert_not_nil response, "response should not be nil"
assert response.approved?, "#{response.error_number} / #{response.error_description} / #{response.exact_message} / #{response.bank_message}"
@@ -69,11 +59,11 @@
:transaction_type => :purchase,
:amount => "10.13",
:cardholder_name => "Simon Brown",
:cc_number => "4111111111111111",
:cc_expiry => "1012"
- }.merge(EMERGIS_BASIC_AUTH).merge(options)
+ }.merge(@@credentials.current_gateway).merge(options)
end
# sample values for every request parameter
def sample_everything_params
{
@@ -89,13 +79,13 @@
:client_email => "simon@example.com",
:client_ip => "127.0.0.1",
:customer_ref => "REF-321",
:cvd_presence_ind => 2,
:ecommerce_flag => 9,
- :gateway_id => EMERGIS_BASIC_AUTH[:gateway_id],
+ :gateway_id => @@credentials.current_gateway[:gateway_id],
:language => 4,
:pan => "12345678900987654321",
- :password => EMERGIS_BASIC_AUTH[:password],
+ :password => @@credentials.current_gateway[:password],
:reference_3 => "REF-123",
:reference_no => "REF-456",
:secure_auth_required => 2,
:secure_auth_result => 5,
:surcharge_amount => 11.34,
\ No newline at end of file