activemerchant 1.4.2 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +78 -0
- data/{CONTRIBUTERS → CONTRIBUTORS} +44 -0
- data/{README → README.rdoc} +4 -1
- data/Rakefile +7 -13
- data/lib/active_merchant.rb +11 -21
- data/lib/active_merchant/billing/avs_result.rb +13 -10
- data/lib/active_merchant/billing/base.rb +2 -2
- data/lib/active_merchant/billing/check.rb +1 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +2 -2
- data/lib/active_merchant/billing/expiry_date.rb +10 -4
- data/lib/active_merchant/billing/gateway.rb +7 -6
- data/lib/active_merchant/billing/gateways.rb +18 -3
- data/lib/active_merchant/billing/gateways/authorize_net.rb +20 -12
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +40 -6
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb.orig +736 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +6 -211
- data/lib/active_merchant/billing/gateways/data_cash.rb +5 -7
- data/lib/active_merchant/billing/gateways/elavon.rb +134 -0
- data/lib/active_merchant/billing/gateways/eway.rb +7 -2
- data/lib/active_merchant/billing/gateways/first_pay.rb +172 -0
- data/lib/active_merchant/billing/gateways/instapay.rb +164 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +270 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +65 -12
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +154 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +283 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +12 -6
- data/lib/active_merchant/billing/gateways/ogone.rb +279 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +20 -32
- data/lib/active_merchant/billing/gateways/paypal.rb +22 -9
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/psl_card.rb +4 -6
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +7 -1
- data/lib/active_merchant/billing/gateways/{protx.rb → sage_pay.rb} +60 -35
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +144 -0
- data/lib/active_merchant/billing/gateways/secure_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/skip_jack.rb +23 -10
- data/lib/active_merchant/billing/gateways/smart_ps.rb +265 -0
- data/lib/active_merchant/billing/gateways/transax.rb +25 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +38 -14
- data/lib/active_merchant/billing/gateways/wirecard.rb +15 -2
- data/lib/active_merchant/billing/integrations.rb +18 -11
- data/lib/active_merchant/billing/integrations/bogus.rb +4 -3
- data/lib/active_merchant/billing/integrations/chronopay.rb +4 -3
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +3 -1
- data/lib/active_merchant/billing/integrations/gestpay.rb +4 -5
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +3 -1
- data/lib/active_merchant/billing/integrations/hi_trust.rb +4 -3
- data/lib/active_merchant/billing/integrations/nochex.rb +4 -3
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +1 -1
- data/lib/active_merchant/billing/integrations/paypal.rb +3 -4
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +9 -8
- data/lib/active_merchant/billing/integrations/quickpay.rb +2 -3
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +1 -1
- data/lib/active_merchant/billing/integrations/two_checkout.rb +3 -3
- data/lib/active_merchant/lib/connection.rb +170 -0
- data/lib/active_merchant/lib/country.rb +4 -1
- data/lib/active_merchant/lib/posts_data.rb +22 -84
- data/test/fixtures.yml +39 -1
- data/test/remote/gateways/remote_authorize_net_cim_test.rb +2 -1
- data/test/remote/gateways/remote_authorize_net_test.rb +1 -1
- data/test/remote/gateways/remote_beanstream_interac_test.rb +1 -1
- data/test/remote/gateways/remote_beanstream_test.rb +1 -1
- data/test/remote/gateways/remote_braintree_test.rb +2 -9
- data/test/remote/gateways/remote_card_stream_test.rb +1 -1
- data/test/remote/gateways/remote_cyber_source_test.rb +1 -1
- data/test/remote/gateways/remote_data_cash_test.rb +1 -2
- data/test/remote/gateways/remote_efsnet_test.rb +1 -1
- data/test/remote/gateways/remote_elavon_test.rb +66 -0
- data/test/remote/gateways/remote_eway_test.rb +1 -1
- data/test/remote/gateways/remote_exact_test.rb +1 -1
- data/test/remote/gateways/remote_first_pay_test.rb +87 -0
- data/test/remote/gateways/remote_instapay_test.rb +61 -0
- data/test/remote/gateways/remote_jetpay_test.rb +103 -0
- data/test/remote/gateways/remote_linkpoint_test.rb +11 -2
- data/test/remote/gateways/remote_merchant_e_solutions_test.rb +173 -0
- data/test/remote/gateways/remote_merchant_ware_test.rb +113 -0
- data/test/remote/gateways/remote_modern_payments_cim_test.rb +1 -1
- data/test/remote/gateways/remote_modern_payments_test.rb +23 -9
- data/test/remote/gateways/remote_moneris_test.rb +1 -1
- data/test/remote/gateways/remote_net_registry_test.rb +1 -1
- data/test/remote/gateways/remote_netbilling_test.rb +1 -1
- data/test/remote/gateways/remote_ogone_test.rb +115 -0
- data/test/remote/gateways/remote_pay_junction_test.rb +1 -1
- data/test/remote/gateways/remote_pay_secure_test.rb +1 -1
- data/test/remote/gateways/remote_payflow_express_test.rb +1 -1
- data/test/remote/gateways/remote_payflow_test.rb +1 -1
- data/test/remote/gateways/remote_payflow_uk_test.rb +1 -1
- data/test/remote/gateways/remote_payment_express_test.rb +17 -7
- data/test/remote/gateways/remote_paypal_express_test.rb +1 -1
- data/test/remote/gateways/remote_paypal_test.rb +26 -2
- data/test/remote/gateways/remote_plugnpay_test.rb +1 -1
- data/test/remote/gateways/remote_psigate_test.rb +1 -1
- data/test/remote/gateways/remote_psl_card_test.rb +1 -3
- data/test/remote/gateways/remote_quickpay_test.rb +1 -1
- data/test/remote/gateways/remote_realex_test.rb +1 -1
- data/test/remote/gateways/remote_sage_bankcard_test.rb +1 -1
- data/test/remote/gateways/remote_sage_pay_test.rb +219 -0
- data/test/remote/gateways/remote_sage_test.rb +1 -1
- data/test/remote/gateways/remote_sage_virtual_check_test.rb +1 -1
- data/test/remote/gateways/remote_sallie_mae_test.rb +51 -0
- data/test/remote/gateways/remote_secure_pay_au_test.rb +1 -1
- data/test/remote/gateways/remote_secure_pay_tech_test.rb +1 -1
- data/test/remote/gateways/remote_secure_pay_test.rb +2 -2
- data/test/remote/gateways/remote_skipjack_test.rb +1 -1
- data/test/remote/gateways/remote_trans_first_test.rb +1 -1
- data/test/remote/gateways/remote_transax_test.rb +112 -0
- data/test/remote/gateways/remote_trust_commerce_test.rb +1 -1
- data/test/remote/gateways/remote_usa_epay_test.rb +1 -1
- data/test/remote/gateways/remote_verifi_test.rb +1 -1
- data/test/remote/gateways/remote_viaklix_test.rb +1 -1
- data/test/remote/gateways/remote_wirecard_test.rb +34 -0
- data/test/remote/integrations/remote_gestpay_integration_test.rb +1 -1
- data/test/remote/integrations/remote_paypal_integration_test.rb +1 -1
- data/test/test_helper.rb +81 -89
- data/test/unit/avs_result_test.rb +1 -1
- data/test/unit/base_test.rb +1 -2
- data/test/unit/check_test.rb +1 -1
- data/test/unit/connection_test.rb +129 -0
- data/test/unit/country_code_test.rb +1 -1
- data/test/unit/country_test.rb +1 -1
- data/test/unit/credit_card_formatting_test.rb +1 -1
- data/test/unit/credit_card_methods_test.rb +10 -1
- data/test/unit/credit_card_test.rb +1 -1
- data/test/unit/cvv_result_test.rb +1 -1
- data/test/unit/expiry_date_test.rb +13 -2
- data/test/unit/gateways/authorize_net_cim_test.rb +39 -1
- data/test/unit/gateways/authorize_net_test.rb +1 -1
- data/test/unit/gateways/beanstream_interac_test.rb +1 -1
- data/test/unit/gateways/beanstream_test.rb +1 -1
- data/test/unit/gateways/bogus_test.rb +1 -1
- data/test/unit/gateways/braintree_test.rb +16 -14
- data/test/unit/gateways/card_stream_test.rb +1 -1
- data/test/unit/gateways/cyber_source_test.rb +1 -1
- data/test/unit/gateways/data_cash_test.rb +2 -1
- data/test/unit/gateways/efsnet_test.rb +1 -1
- data/test/unit/gateways/elavon_test.rb +139 -0
- data/test/unit/gateways/eway_test.rb +1 -1
- data/test/unit/gateways/exact_test.rb +1 -1
- data/test/unit/gateways/first_pay_test.rb +125 -0
- data/test/unit/gateways/gateway_test.rb +1 -1
- data/test/unit/gateways/instapay_test.rb +102 -0
- data/test/unit/gateways/jetpay_test.rb +185 -0
- data/test/unit/gateways/linkpoint_test.rb +37 -7
- data/test/unit/gateways/merchant_e_solutions_test.rb +169 -0
- data/test/unit/gateways/merchant_ware_test.rb +188 -0
- data/test/unit/gateways/modern_payments_cim_test.rb +25 -34
- data/test/unit/gateways/moneris_test.rb +1 -1
- data/test/unit/gateways/net_registry_test.rb +1 -1
- data/test/unit/gateways/netbilling_test.rb +1 -1
- data/test/unit/gateways/ogone_test.rb +319 -0
- data/test/unit/gateways/pay_junction_test.rb +1 -1
- data/test/unit/gateways/pay_secure_test.rb +1 -1
- data/test/unit/gateways/payflow_express_test.rb +2 -2
- data/test/unit/gateways/payflow_express_uk_test.rb +73 -1
- data/test/unit/gateways/payflow_test.rb +1 -1
- data/test/unit/gateways/payflow_uk_test.rb +1 -1
- data/test/unit/gateways/payment_express_test.rb +3 -3
- data/test/unit/gateways/paypal_express_test.rb +1 -1
- data/test/unit/gateways/paypal_test.rb +50 -1
- data/test/unit/gateways/plugnpay_test.rb +1 -1
- data/test/unit/gateways/psigate_test.rb +1 -1
- data/test/unit/gateways/psl_card_test.rb +1 -1
- data/test/unit/gateways/quickpay_test.rb +1 -1
- data/test/unit/gateways/realex_test.rb +1 -1
- data/test/unit/gateways/sage_bankcard_test.rb +36 -2
- data/test/unit/gateways/{protx_test.rb → sage_pay_test.rb} +49 -32
- data/test/unit/gateways/sage_virtual_check_test.rb +1 -1
- data/test/unit/gateways/sallie_mae_test.rb +53 -0
- data/test/unit/gateways/secure_pay_au_test.rb +1 -1
- data/test/unit/gateways/secure_pay_tech_test.rb +1 -1
- data/test/unit/gateways/secure_pay_test.rb +24 -10
- data/test/unit/gateways/skip_jack_test.rb +81 -1
- data/test/unit/gateways/trans_first_test.rb +1 -1
- data/test/unit/gateways/trust_commerce_test.rb +1 -1
- data/test/unit/gateways/usa_epay_test.rb +1 -1
- data/test/unit/gateways/verifi_test.rb +1 -1
- data/test/unit/gateways/viaklix_test.rb +1 -1
- data/test/unit/gateways/wirecard_test.rb +19 -1
- data/test/unit/generators/test_generator_helper.rb +1 -1
- data/test/unit/integrations/action_view_helper_test.rb +1 -1
- data/test/unit/integrations/bogus_module_test.rb +1 -1
- data/test/unit/integrations/chronopay_module_test.rb +1 -1
- data/test/unit/integrations/gestpay_module_test.rb +1 -1
- data/test/unit/integrations/helpers/bogus_helper_test.rb +1 -1
- data/test/unit/integrations/helpers/chronopay_helper_test.rb +1 -1
- data/test/unit/integrations/helpers/gestpay_helper_test.rb +1 -1
- data/test/unit/integrations/helpers/hi_trust_helper_test.rb +1 -1
- data/test/unit/integrations/helpers/nochex_helper_test.rb +1 -1
- data/test/unit/integrations/helpers/paypal_helper_test.rb +11 -2
- data/test/unit/integrations/helpers/quickpay_helper_test.rb +1 -1
- data/test/unit/integrations/helpers/two_checkout_helper_test.rb +1 -1
- data/test/unit/integrations/hi_trust_module_test.rb +1 -1
- data/test/unit/integrations/nochex_module_test.rb +1 -1
- data/test/unit/integrations/notifications/chronopay_notification_test.rb +1 -1
- data/test/unit/integrations/notifications/gestpay_notification_test.rb +1 -1
- data/test/unit/integrations/notifications/hi_trust_notification_test.rb +1 -1
- data/test/unit/integrations/notifications/nochex_notification_test.rb +2 -2
- data/test/unit/integrations/notifications/notification_test.rb +1 -1
- data/test/unit/integrations/notifications/paypal_notification_test.rb +1 -1
- data/test/unit/integrations/notifications/quickpay_notification_test.rb +1 -1
- data/test/unit/integrations/notifications/two_checkout_notification_test.rb +1 -1
- data/test/unit/integrations/paypal_module_test.rb +1 -1
- data/test/unit/integrations/quickpay_module_test.rb +1 -1
- data/test/unit/integrations/returns/chronopay_return_test.rb +1 -1
- data/test/unit/integrations/returns/gestpay_return_test.rb +1 -1
- data/test/unit/integrations/returns/hi_trust_return_test.rb +1 -1
- data/test/unit/integrations/returns/nochex_return_test.rb +1 -1
- data/test/unit/integrations/returns/paypal_return_test.rb +1 -1
- data/test/unit/integrations/returns/return_test.rb +1 -1
- data/test/unit/integrations/returns/two_checkout_return_test.rb +1 -1
- data/test/unit/integrations/two_checkout_module_test.rb +1 -1
- data/test/unit/post_data_test.rb +1 -1
- data/test/unit/posts_data_test.rb +14 -66
- data/test/unit/response_test.rb +1 -1
- data/test/unit/utils_test.rb +1 -1
- data/test/unit/validateable_test.rb +1 -1
- metadata +41 -45
- metadata.gz.sig +0 -0
- data/test/extra/binding_of_caller.rb +0 -80
- data/test/extra/breakpoint.rb +0 -547
- data/test/remote/gateways/remote_protx_test.rb +0 -184
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
3
|
class PaymentExpressTest < Test::Unit::TestCase
|
4
4
|
def setup
|
@@ -109,14 +109,14 @@ class PaymentExpressTest < Test::Unit::TestCase
|
|
109
109
|
def test_avs_result_not_supported
|
110
110
|
@gateway.expects(:ssl_post).returns(successful_authorization_response)
|
111
111
|
|
112
|
-
response = @gateway.purchase(@amount, @
|
112
|
+
response = @gateway.purchase(@amount, @visa, @options)
|
113
113
|
assert_nil response.avs_result['code']
|
114
114
|
end
|
115
115
|
|
116
116
|
def test_cvv_result_not_supported
|
117
117
|
@gateway.expects(:ssl_post).returns(successful_authorization_response)
|
118
118
|
|
119
|
-
response = @gateway.purchase(@amount, @
|
119
|
+
response = @gateway.purchase(@amount, @visa, @options)
|
120
120
|
assert_nil response.cvv_result['code']
|
121
121
|
end
|
122
122
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
3
|
class PaypalTest < Test::Unit::TestCase
|
4
4
|
def setup
|
@@ -30,6 +30,24 @@ class PaypalTest < Test::Unit::TestCase
|
|
30
30
|
assert response.test?
|
31
31
|
end
|
32
32
|
|
33
|
+
def test_successful_reference_purchase
|
34
|
+
@gateway.expects(:ssl_post).returns(successful_purchase_response)
|
35
|
+
assert response = @gateway.purchase(@amount, @credit_card, @options)
|
36
|
+
assert_instance_of Response, response
|
37
|
+
assert_success response
|
38
|
+
assert_equal '62U664727W5914806', response.authorization
|
39
|
+
|
40
|
+
ref_id = response.authorization
|
41
|
+
|
42
|
+
gateway2 = PaypalGateway.new(:login => 'cody', :password => 'test', :pem => 'PEM')
|
43
|
+
gateway2.expects(:ssl_post).returns(successful_reference_purchase_response)
|
44
|
+
assert response = gateway2.purchase(@amount, ref_id, @options)
|
45
|
+
assert_instance_of Response, response
|
46
|
+
assert_success response
|
47
|
+
assert_equal '62U664727W5915049', response.authorization
|
48
|
+
assert response.test?
|
49
|
+
end
|
50
|
+
|
33
51
|
def test_failed_purchase
|
34
52
|
@gateway.expects(:ssl_post).returns(failed_purchase_response)
|
35
53
|
|
@@ -252,6 +270,37 @@ class PaypalTest < Test::Unit::TestCase
|
|
252
270
|
RESPONSE
|
253
271
|
end
|
254
272
|
|
273
|
+
def successful_reference_purchase_response
|
274
|
+
<<-RESPONSE
|
275
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
276
|
+
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:market="urn:ebay:apis:Market" xmlns:auction="urn:ebay:apis:Auction" xmlns:sizeship="urn:ebay:api:PayPalAPI/sizeship.xsd" xmlns:ship="urn:ebay:apis:ship" xmlns:skype="urn:ebay:apis:skype" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI">
|
277
|
+
<SOAP-ENV:Header>
|
278
|
+
<Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"/>
|
279
|
+
<RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
|
280
|
+
<Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
|
281
|
+
<Username xsi:type="xs:string"/>
|
282
|
+
<Password xsi:type="xs:string"/>
|
283
|
+
<Subject xsi:type="xs:string"/>
|
284
|
+
</Credentials>
|
285
|
+
</RequesterCredentials>
|
286
|
+
</SOAP-ENV:Header>
|
287
|
+
<SOAP-ENV:Body id="_0">
|
288
|
+
<DoReferenceTransactionResponse xmlns="urn:ebay:api:PayPalAPI">
|
289
|
+
<Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2008-01-06T23:41:25Z</Timestamp>
|
290
|
+
<Ack xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack>
|
291
|
+
<CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">fee61882e6f47</CorrelationID>
|
292
|
+
<Version xmlns="urn:ebay:apis:eBLBaseComponents">2.000000</Version>
|
293
|
+
<Build xmlns="urn:ebay:apis:eBLBaseComponents">1.0006</Build>
|
294
|
+
<Amount xsi:type="cc:BasicAmountType" currencyID="USD">3.00</Amount>
|
295
|
+
<AVSCode xsi:type="xs:string">X</AVSCode>
|
296
|
+
<CVV2Code xsi:type="xs:string">M</CVV2Code>
|
297
|
+
<TransactionID>62U664727W5915049</TransactionID>
|
298
|
+
</DoReferenceTransactionResponse>
|
299
|
+
</SOAP-ENV:Body>
|
300
|
+
</SOAP-ENV:Envelope>
|
301
|
+
RESPONSE
|
302
|
+
end
|
303
|
+
|
255
304
|
def failed_purchase_response
|
256
305
|
<<-RESPONSE
|
257
306
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
3
|
class SageBankcardGatewayTest < Test::Unit::TestCase
|
4
4
|
def setup
|
@@ -138,7 +138,41 @@ class SageBankcardGatewayTest < Test::Unit::TestCase
|
|
138
138
|
response = @gateway.purchase(@amount, @credit_card, @options)
|
139
139
|
assert_equal 'M', response.cvv_result['code']
|
140
140
|
end
|
141
|
-
|
141
|
+
|
142
|
+
def test_us_address_with_state
|
143
|
+
post = {}
|
144
|
+
options = {
|
145
|
+
:billing_address => { :country => "US", :state => "CA"}
|
146
|
+
}
|
147
|
+
@gateway.send(:add_addresses, post, options)
|
148
|
+
|
149
|
+
assert_equal "US", post[:C_country]
|
150
|
+
assert_equal "CA", post[:C_state]
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_us_address_without_state
|
154
|
+
post = {}
|
155
|
+
options = {
|
156
|
+
:billing_address => { :country => "US", :state => ""}
|
157
|
+
}
|
158
|
+
@gateway.send(:add_addresses, post, options)
|
159
|
+
|
160
|
+
assert_equal "US", post[:C_country]
|
161
|
+
assert_equal "", post[:C_state]
|
162
|
+
end
|
163
|
+
|
164
|
+
|
165
|
+
def test_international_address_without_state
|
166
|
+
post = {}
|
167
|
+
options = {
|
168
|
+
:billing_address => { :country => "JP", :state => ""}
|
169
|
+
}
|
170
|
+
@gateway.send(:add_addresses, post, options)
|
171
|
+
|
172
|
+
assert_equal "JP", post[:C_country]
|
173
|
+
assert_equal "Outside of United States", post[:C_state]
|
174
|
+
end
|
175
|
+
|
142
176
|
private
|
143
177
|
def successful_authorization_response
|
144
178
|
"\002A911911APPROVED 00MX001234567890\0341000\0340\034\003"
|
@@ -1,21 +1,27 @@
|
|
1
|
-
require
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class SagePayTest < Test::Unit::TestCase
|
4
4
|
def setup
|
5
|
-
@gateway =
|
5
|
+
@gateway = SagePayGateway.new(
|
6
6
|
:login => 'X'
|
7
7
|
)
|
8
8
|
|
9
9
|
@credit_card = credit_card('4242424242424242', :type => 'visa')
|
10
10
|
@options = {
|
11
11
|
:billing_address => {
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
12
|
+
:name => 'Tekin Suleyman',
|
13
|
+
:address1 => 'Flat 10 Lapwing Court',
|
14
|
+
:address2 => 'West Didsbury',
|
15
|
+
:city => "Manchester",
|
16
|
+
:county => 'Greater Manchester',
|
17
|
+
:country => 'GB',
|
18
|
+
:zip => 'M20 2PS'
|
16
19
|
},
|
17
20
|
:order_id => '1',
|
18
|
-
:description => 'Store purchase'
|
21
|
+
:description => 'Store purchase',
|
22
|
+
:ip => '86.150.65.37',
|
23
|
+
:email => 'tekin@tekin.co.uk',
|
24
|
+
:phone => '0161 123 4567'
|
19
25
|
}
|
20
26
|
@amount = 100
|
21
27
|
end
|
@@ -25,7 +31,7 @@ class ProtxTest < Test::Unit::TestCase
|
|
25
31
|
|
26
32
|
assert response = @gateway.purchase(@amount, @credit_card, @options)
|
27
33
|
assert_instance_of Response, response
|
28
|
-
assert_equal "1;
|
34
|
+
assert_equal "1;B8AE1CF6-9DEF-C876-1BB4-9B382E6CE520;4193753;OHMETD7DFK;purchase", response.authorization
|
29
35
|
assert_success response
|
30
36
|
end
|
31
37
|
|
@@ -38,50 +44,50 @@ class ProtxTest < Test::Unit::TestCase
|
|
38
44
|
end
|
39
45
|
|
40
46
|
def test_purchase_url
|
41
|
-
assert_equal 'https://
|
47
|
+
assert_equal 'https://test.sagepay.com/gateway/service/vspdirect-register.vsp', @gateway.send(:url_for, :purchase)
|
42
48
|
end
|
43
49
|
|
44
50
|
def test_capture_url
|
45
|
-
assert_equal 'https://
|
51
|
+
assert_equal 'https://test.sagepay.com/gateway/service/release.vsp', @gateway.send(:url_for, :capture)
|
46
52
|
end
|
47
53
|
|
48
54
|
def test_electron_cards
|
49
55
|
# Visa range
|
50
|
-
assert_no_match
|
56
|
+
assert_no_match SagePayGateway::ELECTRON, '4245180000000000'
|
51
57
|
|
52
58
|
# First electron range
|
53
|
-
assert_match
|
59
|
+
assert_match SagePayGateway::ELECTRON, '4245190000000000'
|
54
60
|
|
55
61
|
# Second range
|
56
|
-
assert_match
|
57
|
-
assert_match
|
62
|
+
assert_match SagePayGateway::ELECTRON, '4249620000000000'
|
63
|
+
assert_match SagePayGateway::ELECTRON, '4249630000000000'
|
58
64
|
|
59
65
|
# Third
|
60
|
-
assert_match
|
66
|
+
assert_match SagePayGateway::ELECTRON, '4508750000000000'
|
61
67
|
|
62
68
|
# Fourth
|
63
|
-
assert_match
|
64
|
-
assert_match
|
69
|
+
assert_match SagePayGateway::ELECTRON, '4844060000000000'
|
70
|
+
assert_match SagePayGateway::ELECTRON, '4844080000000000'
|
65
71
|
|
66
72
|
# Fifth
|
67
|
-
assert_match
|
68
|
-
assert_match
|
73
|
+
assert_match SagePayGateway::ELECTRON, '4844110000000000'
|
74
|
+
assert_match SagePayGateway::ELECTRON, '4844550000000000'
|
69
75
|
|
70
76
|
# Sixth
|
71
|
-
assert_match
|
72
|
-
assert_match
|
77
|
+
assert_match SagePayGateway::ELECTRON, '4917300000000000'
|
78
|
+
assert_match SagePayGateway::ELECTRON, '4917590000000000'
|
73
79
|
|
74
80
|
# Seventh
|
75
|
-
assert_match
|
81
|
+
assert_match SagePayGateway::ELECTRON, '4918800000000000'
|
76
82
|
|
77
83
|
# Visa
|
78
|
-
assert_no_match
|
84
|
+
assert_no_match SagePayGateway::ELECTRON, '4918810000000000'
|
79
85
|
|
80
86
|
# 19 PAN length
|
81
|
-
assert_match
|
87
|
+
assert_match SagePayGateway::ELECTRON, '4249620000000000000'
|
82
88
|
|
83
89
|
# 20 PAN length
|
84
|
-
assert_no_match
|
90
|
+
assert_no_match SagePayGateway::ELECTRON, '42496200000000000'
|
85
91
|
end
|
86
92
|
|
87
93
|
def test_avs_result
|
@@ -103,20 +109,31 @@ class ProtxTest < Test::Unit::TestCase
|
|
103
109
|
|
104
110
|
def successful_purchase_response
|
105
111
|
<<-RESP
|
106
|
-
VPSProtocol=2.
|
112
|
+
VPSProtocol=2.23
|
107
113
|
Status=OK
|
108
|
-
StatusDetail=
|
109
|
-
VPSTxId=
|
110
|
-
SecurityKey=
|
111
|
-
TxAuthNo=
|
114
|
+
StatusDetail=0000 : The Authorisation was Successful.
|
115
|
+
VPSTxId=B8AE1CF6-9DEF-C876-1BB4-9B382E6CE520
|
116
|
+
SecurityKey=OHMETD7DFK
|
117
|
+
TxAuthNo=4193753
|
112
118
|
AVSCV2=NO DATA MATCHES
|
113
119
|
AddressResult=NOTMATCHED
|
114
120
|
PostCodeResult=MATCHED
|
115
121
|
CV2Result=NOTMATCHED
|
122
|
+
3DSecureStatus=NOTCHECKED
|
116
123
|
RESP
|
117
124
|
end
|
118
125
|
|
119
126
|
def unsuccessful_purchase_response
|
120
|
-
|
127
|
+
<<-RESP
|
128
|
+
VPSProtocol=2.23
|
129
|
+
Status=NOTAUTHED
|
130
|
+
StatusDetail=VSP Direct transaction from VSP Simulator.
|
131
|
+
VPSTxId=7BBA9078-8489-48CD-BF0D-10B0E6B0EF30
|
132
|
+
SecurityKey=DKDYLDYLXV
|
133
|
+
AVSCV2=ALL MATCH
|
134
|
+
AddressResult=MATCHED
|
135
|
+
PostCodeResult=MATCHED
|
136
|
+
CV2Result=MATCHED
|
137
|
+
RESP
|
121
138
|
end
|
122
139
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class SallieMaeTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@gateway = SallieMaeGateway.new(
|
6
|
+
:login => 'FAKEACCOUNT'
|
7
|
+
)
|
8
|
+
|
9
|
+
@credit_card = credit_card
|
10
|
+
@amount = 100
|
11
|
+
|
12
|
+
@options = {
|
13
|
+
:order_id => '1',
|
14
|
+
:billing_address => address,
|
15
|
+
:description => 'Store Purchase'
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_successful_purchase
|
20
|
+
@gateway.expects(:ssl_post).returns(successful_purchase_response)
|
21
|
+
|
22
|
+
assert response = @gateway.purchase(@amount, @credit_card, @options)
|
23
|
+
assert_success response
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_unsuccessful_request
|
27
|
+
@gateway.expects(:ssl_post).returns(failed_purcahse_response)
|
28
|
+
|
29
|
+
assert response = @gateway.purchase(@amount, @credit_card, @options)
|
30
|
+
assert_failure response
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_non_test_account
|
34
|
+
assert !@gateway.test?
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_test_account
|
38
|
+
gateway = SallieMaeGateway.new(:login => "TEST0")
|
39
|
+
assert !@gateway.test?
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
# Place raw successful response from gateway here
|
45
|
+
def successful_purchase_response
|
46
|
+
"Status=Accepted"
|
47
|
+
end
|
48
|
+
|
49
|
+
# Place raw failed response from gateway here
|
50
|
+
def failed_purcahse_response
|
51
|
+
"Status=Declined"
|
52
|
+
end
|
53
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
3
|
class SecurePayTest < Test::Unit::TestCase
|
4
|
-
|
4
|
+
|
5
5
|
def setup
|
6
6
|
@gateway = SecurePayGateway.new(
|
7
7
|
:login => 'X',
|
8
8
|
:password => 'Y'
|
9
9
|
)
|
10
|
-
|
10
|
+
|
11
11
|
@credit_card = credit_card
|
12
12
|
|
13
13
|
@options = {
|
@@ -18,7 +18,7 @@ class SecurePayTest < Test::Unit::TestCase
|
|
18
18
|
|
19
19
|
@amount = 100
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def test_failed_purchase
|
23
23
|
@gateway.stubs(:ssl_post).returns(failure_response)
|
24
24
|
|
@@ -29,6 +29,16 @@ class SecurePayTest < Test::Unit::TestCase
|
|
29
29
|
assert_equal '3377475', response.authorization
|
30
30
|
end
|
31
31
|
|
32
|
+
def test_failed_production_purchase
|
33
|
+
@gateway.stubs(:ssl_post).returns(failed_production_response)
|
34
|
+
|
35
|
+
assert response = @gateway.purchase(@amount, @credit_card, @options)
|
36
|
+
assert_failure response
|
37
|
+
assert response.test?
|
38
|
+
assert_equal 'This transaction has been declined', response.message
|
39
|
+
assert_equal '7416654', response.authorization
|
40
|
+
end
|
41
|
+
|
32
42
|
def test_successful_purchase
|
33
43
|
@gateway.stubs(:ssl_post).returns(successful_purchase_response)
|
34
44
|
|
@@ -74,14 +84,18 @@ class SecurePayTest < Test::Unit::TestCase
|
|
74
84
|
private
|
75
85
|
|
76
86
|
def successful_purchase_response
|
77
|
-
'1
|
87
|
+
'1,,1,This transaction has been approved.,100721,X,3377575,f6af895031c07d88399ed9fdb48c8476,Store+purchase,0.01,,AUTH_CAPTURE,,Cody,Fauser,,100+Example+St.%Ottawa,ON,K2A5P7,Canada,,,,,,,,,,,,,,,,,,,'
|
78
88
|
end
|
79
|
-
|
89
|
+
|
80
90
|
def failure_response
|
81
|
-
'2
|
91
|
+
'2,,2,This transaction has been declined.,NOT APPROVED,U,3377475,55adbbaed13aa7e2526846d672fdb594,Store+purchase,1.00,,AUTH_CAPTURE,,Longbob,Longsen,,1234+Test+St.,Ottawa,ON,K1N5P8,Canada,,,,,,,,,,,,,,,,,,,'
|
82
92
|
end
|
83
93
|
|
84
94
|
def failed_capture_response
|
85
|
-
'3
|
95
|
+
'3,,6,The credit card number is invalid.,,,,,,0.01,,PRIOR_AUTH_CAPTURE,,,,,,,,,,,,,,,,,,,,,,,,,,,,'
|
96
|
+
end
|
97
|
+
|
98
|
+
def failed_production_response
|
99
|
+
'2,,2,This transaction has been declined.,NOT APPROVED,U,7416654,%231014.11,,7.95,,AUTH_CAPTURE,321hunter%40comcast.net,David,Hunter,,260+Windsor+Ave,Haddonfield,NJ,08033,US,856+795+7941,,321hunter%40comcast.net,,,,260+Windsor+Ave,Haddonfield,Haddonfield,NJ,08033,,,,,,,,'
|
86
100
|
end
|
87
|
-
end
|
101
|
+
end
|