Skip to content
Browse files

Use basic SkipJack host for all non-authorization transactions. Fix s…

…tatus method
  • Loading branch information...
1 parent 2dc4fb2 commit a3d18bd755595ba78b897237a116bafc464bed55 Cody Fauser committed Oct 8, 2009
Showing with 59 additions and 4 deletions.
  1. +1 −0 CHANGELOG
  2. +2 −4 lib/active_merchant/billing/gateways/skip_jack.rb
  3. +56 −0 test/unit/gateways/skip_jack_test.rb
View
1 CHANGELOG
@@ -1,5 +1,6 @@
= ActiveMerchant CHANGELOG
+* Use basic SkipJack host for all non-authorization transactions. Fix status method [cody]
* Strip non alpha numeric chars out of MerchantWare order number [cody]
* Parse complete response of Authorize.net CIM gateway [Patrick Joyce]
* Update to PayPal Sandbox URL for testing Payflow Pro Express Checkout. See Express Checkout for Payflow Pro guide [cody]
View
6 lib/active_merchant/billing/gateways/skip_jack.rb
@@ -245,9 +245,7 @@ def credit(money, identification, options = {})
end
def status(order_id)
- post = { }
- post[:szOrderNumber] = :order_id
- commit(:get_status, nil, post)
+ commit(:get_status, nil, :szOrderNumber => order_id)
end
private
@@ -278,7 +276,7 @@ def commit(action, money, parameters)
def url_for(action)
result = test? ? TEST_HOST : LIVE_HOST
- result += advanced? ? ADVANCED_PATH : BASIC_PATH
+ result += advanced? && action == :authorization ? ADVANCED_PATH : BASIC_PATH
result += "?#{ACTIONS[action]}"
end
View
56 test/unit/gateways/skip_jack_test.rb
@@ -116,24 +116,65 @@ def test_basic_test_url
assert_equal "https://developer.skipjackic.com/scripts/evolvcc.dll?AuthorizeAPI", @gateway.send(:url_for, :authorization)
end
+ def test_basic_test_url_non_authorization
+ @gateway.stubs(:test?).returns(true)
+ @gateway.stubs(:advanced?).returns(false)
+ assert_equal "https://developer.skipjackic.com/scripts/evolvcc.dll?SJAPI_TransactionChangeStatusRequest", @gateway.send(:url_for, :change_status)
+ end
+
def test_advanced_test_url
@gateway.stubs(:test?).returns(true)
@gateway.stubs(:advanced?).returns(true)
assert_equal "https://developer.skipjackic.com/evolvcc/evolvcc.aspx?AuthorizeAPI", @gateway.send(:url_for, :authorization)
end
+ def test_advanced_test_url_non_authorization
+ @gateway.stubs(:test?).returns(true)
+ @gateway.stubs(:advanced?).returns(true)
+ assert_equal "https://developer.skipjackic.com/scripts/evolvcc.dll?SJAPI_TransactionChangeStatusRequest", @gateway.send(:url_for, :change_status)
+ end
+
def test_basic_live_url
@gateway.stubs(:test?).returns(false)
@gateway.stubs(:advanced?).returns(false)
assert_equal "https://www.skipjackic.com/scripts/evolvcc.dll?AuthorizeAPI", @gateway.send(:url_for, :authorization)
end
+ def test_basic_live_url_non_authorization
+ @gateway.stubs(:test?).returns(false)
+ @gateway.stubs(:advanced?).returns(false)
+ assert_equal "https://www.skipjackic.com/scripts/evolvcc.dll?SJAPI_TransactionChangeStatusRequest", @gateway.send(:url_for, :change_status)
+ end
+
def test_advanced_live_url
@gateway.stubs(:test?).returns(false)
@gateway.stubs(:advanced?).returns(true)
assert_equal "https://www.skipjackic.com/evolvcc/evolvcc.aspx?AuthorizeAPI", @gateway.send(:url_for, :authorization)
end
+ def test_advanced_live_url_non_authorization
+ @gateway.stubs(:test?).returns(false)
+ @gateway.stubs(:advanced?).returns(true)
+ assert_equal "https://www.skipjackic.com/scripts/evolvcc.dll?SJAPI_TransactionChangeStatusRequest", @gateway.send(:url_for, :change_status)
+ end
+
+ def test_paymentech_authorization_success
+ @gateway.expects(:ssl_post).returns(successful_paymentech_authorization_response)
+
+ assert response = @gateway.authorize(@amount, @credit_card, @options)
+ assert_instance_of Response, response
+ assert_success response
+ assert_equal '40000024585892.109', response.authorization
+ end
+
+ def test_paymentech_authorization_failure
+ @gateway.expects(:ssl_post).returns(unsuccessful_paymentech_authorization_response)
+
+ assert response = @gateway.authorize(@amount, @credit_card, @options)
+ assert_instance_of Response, response
+ assert_failure response
+ end
+
private
def successful_authorization_response
<<-CSV
@@ -154,4 +195,19 @@ def unsuccessful_authorization_response
"AUTHCODE","szSerialNumber","szTransactionAmount","szAuthorizationDeclinedMessage","szAVSResponseCode","szAVSResponseMessage","szOrderNumber","szAuthorizationResponseCode","szIsApproved","szCVV2ResponseCode","szCVV2ResponseMessage","szReturnCode","szTransactionFileName","szCAVVResponseCode"\r\n"EMPTY","000386891209","100","","","","b1eec256d0182f29375e0cbae685092d","","0","","","-35","",""
CSV
end
+
+ def unsuccessful_paymentech_authorization_response
+ <<-CSV
+"AUTHCODE","szSerialNumber","szTransactionAmount","szAuthorizationDeclinedMessage","szAVSResponseCode","szAVSResponseMessage","szOrderNumber","szAuthorizationResponseCode","szIsApproved","szCVV2ResponseCode","szCVV2ResponseMessage","szReturnCode","szTransactionFileName","szCAVVResponseCode",
+"EMPTY","000000000000","1.00","","","","43985b7953199d1f02c3017f948e9f13","","0","","","-83","","",
+ CSV
+ end
+
+ def successful_paymentech_authorization_response
+ <<-CSV
+"AUTHCODE","szSerialNumber","szTransactionAmount","szAuthorizationDeclinedMessage","szAVSResponseCode","szAVSResponseMessage","szOrderNumber","szAuthorizationResponseCode","szIsApproved","szCVV2ResponseCode","szCVV2ResponseMessage","szReturnCode","szTransactionFileName","szCAVVResponseCode",
+"093223","000000000000","1.00","","Y","Card authorized, exact address match with 5 digit zip code.","5ac0f04e737baea5a5370037afe827f6","093223","1","M","Match","1","40000024585892.109","",
+ CSV
+ end
end
+

0 comments on commit a3d18bd

Please sign in to comment.
Something went wrong with that request. Please try again.