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 SkipJackTest < Test::Unit::TestCase
|
4
4
|
|
@@ -110,6 +110,71 @@ class SkipJackTest < Test::Unit::TestCase
|
|
110
110
|
assert_equal 'M', response.cvv_result['code']
|
111
111
|
end
|
112
112
|
|
113
|
+
def test_basic_test_url
|
114
|
+
@gateway.stubs(:test?).returns(true)
|
115
|
+
@gateway.stubs(:advanced?).returns(false)
|
116
|
+
assert_equal "https://developer.skipjackic.com/scripts/evolvcc.dll?AuthorizeAPI", @gateway.send(:url_for, :authorization)
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_basic_test_url_non_authorization
|
120
|
+
@gateway.stubs(:test?).returns(true)
|
121
|
+
@gateway.stubs(:advanced?).returns(false)
|
122
|
+
assert_equal "https://developer.skipjackic.com/scripts/evolvcc.dll?SJAPI_TransactionChangeStatusRequest", @gateway.send(:url_for, :change_status)
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_advanced_test_url
|
126
|
+
@gateway.stubs(:test?).returns(true)
|
127
|
+
@gateway.stubs(:advanced?).returns(true)
|
128
|
+
assert_equal "https://developer.skipjackic.com/evolvcc/evolvcc.aspx?AuthorizeAPI", @gateway.send(:url_for, :authorization)
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_advanced_test_url_non_authorization
|
132
|
+
@gateway.stubs(:test?).returns(true)
|
133
|
+
@gateway.stubs(:advanced?).returns(true)
|
134
|
+
assert_equal "https://developer.skipjackic.com/scripts/evolvcc.dll?SJAPI_TransactionChangeStatusRequest", @gateway.send(:url_for, :change_status)
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_basic_live_url
|
138
|
+
@gateway.stubs(:test?).returns(false)
|
139
|
+
@gateway.stubs(:advanced?).returns(false)
|
140
|
+
assert_equal "https://www.skipjackic.com/scripts/evolvcc.dll?AuthorizeAPI", @gateway.send(:url_for, :authorization)
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_basic_live_url_non_authorization
|
144
|
+
@gateway.stubs(:test?).returns(false)
|
145
|
+
@gateway.stubs(:advanced?).returns(false)
|
146
|
+
assert_equal "https://www.skipjackic.com/scripts/evolvcc.dll?SJAPI_TransactionChangeStatusRequest", @gateway.send(:url_for, :change_status)
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_advanced_live_url
|
150
|
+
@gateway.stubs(:test?).returns(false)
|
151
|
+
@gateway.stubs(:advanced?).returns(true)
|
152
|
+
assert_equal "https://www.skipjackic.com/evolvcc/evolvcc.aspx?AuthorizeAPI", @gateway.send(:url_for, :authorization)
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_advanced_live_url_non_authorization
|
156
|
+
@gateway.stubs(:test?).returns(false)
|
157
|
+
@gateway.stubs(:advanced?).returns(true)
|
158
|
+
assert_equal "https://www.skipjackic.com/scripts/evolvcc.dll?SJAPI_TransactionChangeStatusRequest", @gateway.send(:url_for, :change_status)
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_paymentech_authorization_success
|
162
|
+
@gateway.expects(:ssl_post).returns(successful_paymentech_authorization_response)
|
163
|
+
|
164
|
+
assert response = @gateway.authorize(@amount, @credit_card, @options)
|
165
|
+
assert_instance_of Response, response
|
166
|
+
assert_success response
|
167
|
+
assert_equal '40000024585892.109', response.authorization
|
168
|
+
end
|
169
|
+
|
170
|
+
def test_paymentech_authorization_failure
|
171
|
+
@gateway.expects(:ssl_post).returns(unsuccessful_paymentech_authorization_response)
|
172
|
+
|
173
|
+
assert response = @gateway.authorize(@amount, @credit_card, @options)
|
174
|
+
assert_instance_of Response, response
|
175
|
+
assert_failure response
|
176
|
+
end
|
177
|
+
|
113
178
|
private
|
114
179
|
def successful_authorization_response
|
115
180
|
<<-CSV
|
@@ -130,4 +195,19 @@ class SkipJackTest < Test::Unit::TestCase
|
|
130
195
|
"AUTHCODE","szSerialNumber","szTransactionAmount","szAuthorizationDeclinedMessage","szAVSResponseCode","szAVSResponseMessage","szOrderNumber","szAuthorizationResponseCode","szIsApproved","szCVV2ResponseCode","szCVV2ResponseMessage","szReturnCode","szTransactionFileName","szCAVVResponseCode"\r\n"EMPTY","000386891209","100","","","","b1eec256d0182f29375e0cbae685092d","","0","","","-35","",""
|
131
196
|
CSV
|
132
197
|
end
|
198
|
+
|
199
|
+
def unsuccessful_paymentech_authorization_response
|
200
|
+
<<-CSV
|
201
|
+
"AUTHCODE","szSerialNumber","szTransactionAmount","szAuthorizationDeclinedMessage","szAVSResponseCode","szAVSResponseMessage","szOrderNumber","szAuthorizationResponseCode","szIsApproved","szCVV2ResponseCode","szCVV2ResponseMessage","szReturnCode","szTransactionFileName","szCAVVResponseCode",
|
202
|
+
"EMPTY","000000000000","1.00","","","","43985b7953199d1f02c3017f948e9f13","","0","","","-83","","",
|
203
|
+
CSV
|
204
|
+
end
|
205
|
+
|
206
|
+
def successful_paymentech_authorization_response
|
207
|
+
<<-CSV
|
208
|
+
"AUTHCODE","szSerialNumber","szTransactionAmount","szAuthorizationDeclinedMessage","szAVSResponseCode","szAVSResponseMessage","szOrderNumber","szAuthorizationResponseCode","szIsApproved","szCVV2ResponseCode","szCVV2ResponseMessage","szReturnCode","szTransactionFileName","szCAVVResponseCode",
|
209
|
+
"093223","000000000000","1.00","","Y","Card authorized, exact address match with 5 digit zip code.","5ac0f04e737baea5a5370037afe827f6","093223","1","M","Match","1","40000024585892.109","",
|
210
|
+
CSV
|
211
|
+
end
|
133
212
|
end
|
213
|
+
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
3
|
class WirecardTest < Test::Unit::TestCase
|
4
4
|
TEST_AUTHORIZATION_GUWID = 'C822580121385121429927'
|
@@ -17,6 +17,16 @@ class WirecardTest < Test::Unit::TestCase
|
|
17
17
|
:description => 'Wirecard Purchase',
|
18
18
|
:email => 'soleone@example.com'
|
19
19
|
}
|
20
|
+
|
21
|
+
@address_without_state = {
|
22
|
+
:name => 'Jim Smith',
|
23
|
+
:address1 => '1234 My Street',
|
24
|
+
:company => 'Widgets Inc',
|
25
|
+
:city => 'Ottawa',
|
26
|
+
:zip => 'K12 P2A',
|
27
|
+
:country => 'CA',
|
28
|
+
:state => nil,
|
29
|
+
}
|
20
30
|
end
|
21
31
|
|
22
32
|
def test_successful_authorization
|
@@ -61,6 +71,14 @@ class WirecardTest < Test::Unit::TestCase
|
|
61
71
|
assert response.message["Could not find referenced transaction for GuWID 1234567890123456789012."]
|
62
72
|
end
|
63
73
|
|
74
|
+
def test_doesnt_raise_an_error_if_no_state_is_provided_in_address
|
75
|
+
options = @options.merge(:billing_address => @address_without_state)
|
76
|
+
@gateway.expects(:ssl_post).returns(unauthorized_capture_response)
|
77
|
+
assert_nothing_raised do
|
78
|
+
@gateway.authorize(@amount, @credit_card, options)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
64
82
|
private
|
65
83
|
|
66
84
|
# Authorization success
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
3
|
class PaypalHelperTest < Test::Unit::TestCase
|
4
4
|
include ActiveMerchant::Billing::Integrations
|
@@ -72,12 +72,21 @@ class PaypalHelperTest < Test::Unit::TestCase
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def test_phone_parsing
|
75
|
-
@helper.shipping_address :phone => '111-222-3333'
|
75
|
+
@helper.shipping_address :country => 'CA', :phone => '111-222-3333'
|
76
76
|
|
77
77
|
assert_field 'night_phone_a', '111'
|
78
78
|
assert_field 'night_phone_b', '222'
|
79
79
|
assert_field 'night_phone_c', '3333'
|
80
80
|
end
|
81
|
+
|
82
|
+
|
83
|
+
def test_phone_parsing_for_non_us
|
84
|
+
@helper.shipping_address :country => 'UK', :phone => '028 38841670'
|
85
|
+
|
86
|
+
assert_field 'night_phone_a', nil
|
87
|
+
assert_field 'night_phone_b', '02838841670'
|
88
|
+
assert_field 'night_phone_c', nil
|
89
|
+
end
|
81
90
|
|
82
91
|
|
83
92
|
def test_province
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
3
|
class NochexNotificationTest < Test::Unit::TestCase
|
4
4
|
include ActiveMerchant::Billing::Integrations
|
@@ -46,6 +46,6 @@ class NochexNotificationTest < Test::Unit::TestCase
|
|
46
46
|
|
47
47
|
private
|
48
48
|
def http_raw_data
|
49
|
-
"transaction_date=27/09/2006 22:30:53&transaction_id=91191&order_id=11&from_email=test2@nochex.com&to_email=test1@nochex.com&amount=31.
|
49
|
+
"transaction_date=27/09/2006 22:30:53&transaction_id=91191&order_id=11&from_email=test2@nochex.com&to_email=test1@nochex.com&amount=31.6600&security_key=L254524366479818252491366&status=test&custom="
|
50
50
|
end
|
51
51
|
end
|
data/test/unit/post_data_test.rb
CHANGED
@@ -1,14 +1,9 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
class MockResponse
|
4
|
-
def body
|
5
|
-
end
|
6
|
-
end
|
1
|
+
require 'test_helper'
|
7
2
|
|
8
3
|
class PostsDataTests < Test::Unit::TestCase
|
9
|
-
|
10
|
-
|
4
|
+
|
11
5
|
def setup
|
6
|
+
@url = 'http://example.com'
|
12
7
|
@gateway = SimpleTestGateway.new
|
13
8
|
end
|
14
9
|
|
@@ -17,69 +12,22 @@ class PostsDataTests < Test::Unit::TestCase
|
|
17
12
|
end
|
18
13
|
|
19
14
|
def test_single_successful_post
|
20
|
-
|
15
|
+
ActiveMerchant::Connection.any_instance.expects(:request).returns('')
|
21
16
|
|
22
17
|
assert_nothing_raised do
|
23
|
-
@gateway.ssl_post(
|
18
|
+
@gateway.ssl_post(@url, '')
|
24
19
|
end
|
25
20
|
end
|
26
21
|
|
27
22
|
def test_multiple_successful_posts
|
28
|
-
|
29
|
-
Net::HTTP.any_instance.expects(:post).times(2).returns(*responses)
|
30
|
-
|
31
|
-
assert_nothing_raised do
|
32
|
-
@gateway.ssl_post(URL, '')
|
33
|
-
@gateway.ssl_post(URL, '')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_unrecoverable_exception
|
38
|
-
Net::HTTP.any_instance.expects(:post).raises(EOFError)
|
39
|
-
|
40
|
-
assert_raises(ActiveMerchant::ConnectionError) do
|
41
|
-
@gateway.ssl_post(URL, '')
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_failure_then_success_with_recoverable_exception
|
46
|
-
Net::HTTP.any_instance.expects(:post).times(2).raises(Errno::ECONNREFUSED).then.returns(MockResponse.new)
|
23
|
+
ActiveMerchant::Connection.any_instance.expects(:request).times(2).returns('', '')
|
47
24
|
|
48
25
|
assert_nothing_raised do
|
49
|
-
@gateway.ssl_post(
|
26
|
+
@gateway.ssl_post(@url, '')
|
27
|
+
@gateway.ssl_post(@url, '')
|
50
28
|
end
|
51
29
|
end
|
52
|
-
|
53
|
-
def test_failure_limit_reached
|
54
|
-
Net::HTTP.any_instance.expects(:post).times(ActiveMerchant::PostsData::MAX_RETRIES).raises(Errno::ECONNREFUSED)
|
55
30
|
|
56
|
-
assert_raises(ActiveMerchant::ConnectionError) do
|
57
|
-
@gateway.ssl_post(URL, '')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_failure_then_success_with_retry_safe_enabled
|
62
|
-
Net::HTTP.any_instance.expects(:post).times(2).raises(EOFError).then.returns(MockResponse.new)
|
63
|
-
|
64
|
-
@gateway.retry_safe = true
|
65
|
-
|
66
|
-
assert_nothing_raised do
|
67
|
-
@gateway.ssl_post(URL, '')
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_mixture_of_failures_with_retry_safe_enabled
|
72
|
-
Net::HTTP.any_instance.expects(:post).times(3).raises(Errno::ECONNRESET).
|
73
|
-
raises(Errno::ECONNREFUSED).
|
74
|
-
raises(EOFError)
|
75
|
-
|
76
|
-
@gateway.retry_safe = true
|
77
|
-
|
78
|
-
assert_raises(ActiveMerchant::ConnectionError) do
|
79
|
-
@gateway.ssl_post(URL, '')
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
31
|
def test_setting_ssl_strict_outside_class_definition
|
84
32
|
assert_equal SimpleTestGateway.ssl_strict, SubclassGateway.ssl_strict
|
85
33
|
SimpleTestGateway.ssl_strict = !SimpleTestGateway.ssl_strict
|
@@ -87,14 +35,14 @@ class PostsDataTests < Test::Unit::TestCase
|
|
87
35
|
end
|
88
36
|
|
89
37
|
def test_setting_timeouts
|
90
|
-
@gateway.class.open_timeout=50
|
91
|
-
@gateway.class.read_timeout=37
|
92
|
-
|
93
|
-
|
94
|
-
|
38
|
+
@gateway.class.open_timeout = 50
|
39
|
+
@gateway.class.read_timeout = 37
|
40
|
+
ActiveMerchant::Connection.any_instance.expects(:request).returns('')
|
41
|
+
ActiveMerchant::Connection.any_instance.expects(:open_timeout=).with(50)
|
42
|
+
ActiveMerchant::Connection.any_instance.expects(:read_timeout=).with(37)
|
95
43
|
|
96
44
|
assert_nothing_raised do
|
97
|
-
@gateway.ssl_post(
|
45
|
+
@gateway.ssl_post(@url, '')
|
98
46
|
end
|
99
47
|
end
|
100
48
|
end
|