./test/exhaustive/transaction_details_test.rb in exact4r-0.9.3 vs ./test/exhaustive/transaction_details_test.rb in exact4r-1.0
- old
+ new
@@ -1,23 +1,23 @@
require File.dirname(__FILE__) + "/../test_helper"
class TransactionDetailsTest < Test::Unit::TestCase
def setup
- @transporter = EWS::Transporter.new(LOCATION)
+ @transporter = EWS::Transporter.new(@@credentials.config['location'])
end
def test_mandatory
request = EWS::Transaction::Request.new(:transaction_type => :transaction_details)
assert !request.valid?
assert_equal "gateway_id must be supplied", request.errors[:gateway_id]
- request.gateway_id = EMERGIS_BASIC_AUTH[:gateway_id]
+ request.gateway_id = @@credentials.current_gateway[:gateway_id]
assert !request.valid?
assert_equal "password must be supplied", request.errors[:password]
- request.password = EMERGIS_BASIC_AUTH[:password]
+ request.password = @@credentials.current_gateway[:password]
assert !request.valid?
assert_equal "transaction_tag must be supplied", request.errors[:transaction_tag]
request.transaction_tag = 1234
assert request.valid?
@@ -33,34 +33,36 @@
assert pre_response.approved?
request = EWS::Transaction::Request.new({
:transaction_type => :transaction_details,
:transaction_tag => pre_response.transaction_tag
- }.merge(EMERGIS_BASIC_AUTH))
+ }.merge(@@credentials.current_gateway))
assert request.valid?, request.errors.inspect
assert_details_match_original_response pre_response, @transporter.submit(request, :json)
assert_details_match_original_response pre_response, @transporter.submit(request, :rest)
assert_details_match_original_response pre_response, @transporter.submit(request, :soap)
end
def test_debit_transaction_details
+ return unless @@credentials.chase?
+
# do initial purchase
pre_request = EWS::Transaction::Request.new({
:transaction_type => :idebit_purchase,
:amount => 10.1,
:pan => TEST_CARD_NUMBER,
:cardholder_name => TEST_CARD_HOLDER
- }.merge(CHASE_BASIC_AUTH))
+ }.merge(@@credentials.current_gateway))
assert pre_request.valid?, pre_request.errors.inspect
pre_response = @transporter.submit(pre_request, :json)
assert pre_response.approved?
request = EWS::Transaction::Request.new({
:transaction_type => :transaction_details,
:transaction_tag => pre_response.transaction_tag
- }.merge(CHASE_BASIC_AUTH))
+ }.merge(@@credentials.current_gateway))
assert request.valid?, request.errors.inspect
assert_details_match_original_response pre_response, @transporter.submit(request, :json)
assert_details_match_original_response pre_response, @transporter.submit(request, :rest)
assert_details_match_original_response pre_response, @transporter.submit(request, :soap)