activemerchant 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +310 -294
- data/CONTRIBUTERS +13 -0
- data/README +55 -31
- data/Rakefile +21 -13
- data/lib/active_merchant.rb +7 -0
- data/lib/active_merchant/billing/avs_result.rb +95 -0
- data/lib/active_merchant/billing/base.rb +8 -3
- data/lib/active_merchant/billing/check.rb +61 -0
- data/lib/active_merchant/billing/credit_card.rb +104 -80
- data/lib/active_merchant/billing/credit_card_formatting.rb +11 -8
- data/lib/active_merchant/billing/credit_card_methods.rb +76 -32
- data/lib/active_merchant/billing/cvv_result.rb +38 -0
- data/lib/active_merchant/billing/expiry_date.rb +28 -0
- data/lib/active_merchant/billing/gateway.rb +47 -111
- data/lib/active_merchant/billing/gateways/authorize_net.rb +508 -121
- data/lib/active_merchant/billing/gateways/bogus.rb +26 -32
- data/lib/active_merchant/billing/gateways/brain_tree.rb +82 -70
- data/lib/active_merchant/billing/gateways/card_stream.rb +43 -15
- data/lib/active_merchant/billing/gateways/cyber_source.rb +9 -29
- data/lib/active_merchant/billing/gateways/data_cash.rb +18 -38
- data/lib/active_merchant/billing/gateways/efsnet.rb +23 -50
- data/lib/active_merchant/billing/gateways/eway.rb +8 -19
- data/lib/active_merchant/billing/gateways/exact.rb +17 -25
- data/lib/active_merchant/billing/gateways/linkpoint.rb +18 -25
- data/lib/active_merchant/billing/gateways/moneris.rb +9 -39
- data/lib/active_merchant/billing/gateways/net_registry.rb +113 -182
- data/lib/active_merchant/billing/gateways/netbilling.rb +168 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +52 -73
- data/lib/active_merchant/billing/gateways/pay_secure.rb +120 -0
- data/lib/active_merchant/billing/gateways/payflow.rb +13 -14
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +55 -37
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -4
- data/lib/active_merchant/billing/gateways/payment_express.rb +11 -30
- data/lib/active_merchant/billing/gateways/paypal.rb +3 -14
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +36 -16
- data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -2
- data/lib/active_merchant/billing/gateways/plugnpay.rb +7 -15
- data/lib/active_merchant/billing/gateways/protx.rb +24 -25
- data/lib/active_merchant/billing/gateways/psigate.rb +34 -71
- data/lib/active_merchant/billing/gateways/psl_card.rb +24 -19
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -24
- data/lib/active_merchant/billing/gateways/realex.rb +7 -19
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +113 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +437 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +5 -14
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +100 -39
- data/lib/active_merchant/billing/gateways/usa_epay.rb +60 -55
- data/lib/active_merchant/billing/gateways/verifi.rb +32 -39
- data/lib/active_merchant/billing/gateways/viaklix.rb +31 -37
- data/lib/active_merchant/billing/integrations.rb +2 -0
- data/lib/active_merchant/billing/integrations/bogus.rb +5 -0
- data/lib/active_merchant/billing/integrations/bogus/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/chronopay.rb +5 -0
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/gestpay.rb +5 -0
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/hi_trust.rb +26 -0
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +58 -0
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +57 -0
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +67 -0
- data/lib/active_merchant/billing/integrations/nochex.rb +5 -0
- data/lib/active_merchant/billing/integrations/nochex/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/paypal.rb +5 -0
- data/lib/active_merchant/billing/integrations/paypal/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/return.rb +35 -0
- data/lib/active_merchant/billing/integrations/two_checkout.rb +5 -0
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +17 -0
- data/lib/active_merchant/billing/response.rb +12 -8
- data/lib/active_merchant/lib/posts_data.rb +39 -7
- data/lib/active_merchant/lib/requires_parameters.rb +2 -3
- data/lib/active_merchant/lib/utils.rb +18 -0
- data/lib/active_merchant/lib/validateable.rb +3 -3
- data/lib/support/gateway_support.rb +22 -9
- data/script/destroy +14 -0
- data/script/generate +7 -7
- data/test/fixtures.yml +25 -3
- data/test/remote/gateways/remote_authorize_net_test.rb +145 -0
- data/test/remote/gateways/remote_brain_tree_test.rb +118 -0
- data/test/{remote_tests → remote/gateways}/remote_card_stream_test.rb +56 -68
- data/test/{remote_tests → remote/gateways}/remote_cyber_source_test.rb +21 -32
- data/test/{remote_tests → remote/gateways}/remote_data_cash_test.rb +2 -2
- data/test/{remote_tests → remote/gateways}/remote_efsnet_test.rb +22 -34
- data/test/{remote_tests → remote/gateways}/remote_eway_test.rb +18 -15
- data/test/{remote_tests → remote/gateways}/remote_exact_test.rb +20 -19
- data/test/{remote_tests → remote/gateways}/remote_linkpoint_test.rb +31 -63
- data/test/remote/gateways/remote_moneris_test.rb +82 -0
- data/test/{remote_tests → remote/gateways}/remote_net_registry_test.rb +19 -54
- data/test/remote/gateways/remote_netbilling_test.rb +70 -0
- data/test/{remote_tests → remote/gateways}/remote_pay_junction_test.rb +41 -60
- data/test/remote/gateways/remote_pay_secure_test.rb +39 -0
- data/test/{remote_tests → remote/gateways}/remote_payflow_express_test.rb +2 -2
- data/test/{remote_tests → remote/gateways}/remote_payflow_test.rb +34 -38
- data/test/{remote_tests → remote/gateways}/remote_payflow_uk_test.rb +13 -12
- data/test/{remote_tests → remote/gateways}/remote_payment_express_test.rb +26 -36
- data/test/{remote_tests → remote/gateways}/remote_paypal_express_test.rb +3 -3
- data/test/{remote_tests → remote/gateways}/remote_paypal_test.rb +25 -21
- data/test/{remote_tests → remote/gateways}/remote_plugnpay_test.rb +18 -16
- data/test/{remote_tests → remote/gateways}/remote_protx_test.rb +33 -33
- data/test/remote/gateways/remote_psigate_test.rb +50 -0
- data/test/{remote_tests → remote/gateways}/remote_psl_card_test.rb +27 -26
- data/test/{remote_tests → remote/gateways}/remote_quickpay_test.rb +48 -48
- data/test/{remote_tests → remote/gateways}/remote_realex_test.rb +30 -33
- data/test/remote/gateways/remote_secure_pay_tech_test.rb +37 -0
- data/test/remote/gateways/remote_secure_pay_test.rb +28 -0
- data/test/remote/gateways/remote_skipjack_test.rb +105 -0
- data/test/{remote_tests → remote/gateways}/remote_trans_first_test.rb +7 -10
- data/test/remote/gateways/remote_trust_commerce_test.rb +152 -0
- data/test/{remote_tests → remote/gateways}/remote_usa_epay_test.rb +11 -22
- data/test/{remote_tests → remote/gateways}/remote_verifi_test.rb +27 -27
- data/test/{remote_tests → remote/gateways}/remote_viaklix_test.rb +8 -18
- data/test/{remote_tests → remote/integrations}/remote_gestpay_integration_test.rb +1 -1
- data/test/{remote_tests → remote/integrations}/remote_paypal_integration_test.rb +1 -1
- data/test/test_helper.rb +102 -61
- data/test/unit/avs_result_test.rb +59 -0
- data/test/unit/base_test.rb +33 -39
- data/test/unit/check_test.rb +76 -0
- data/test/unit/credit_card_formatting_test.rb +10 -15
- data/test/unit/credit_card_methods_test.rb +132 -17
- data/test/unit/credit_card_test.rb +157 -228
- data/test/unit/cvv_result_test.rb +33 -0
- data/test/unit/expiry_date_test.rb +21 -0
- data/test/unit/gateways/authorize_net_test.rb +180 -40
- data/test/unit/gateways/bogus_test.rb +2 -3
- data/test/unit/gateways/brain_tree_test.rb +63 -29
- data/test/unit/gateways/card_stream_test.rb +59 -6
- data/test/unit/gateways/cyber_source_test.rb +59 -40
- data/test/unit/gateways/data_cash_test.rb +82 -1
- data/test/unit/gateways/efsnet_test.rb +97 -44
- data/test/unit/gateways/eway_test.rb +55 -42
- data/test/unit/gateways/exact_test.rb +93 -55
- data/test/unit/gateways/gateway_test.rb +7 -0
- data/test/unit/gateways/linkpoint_test.rb +60 -58
- data/test/unit/gateways/moneris_test.rb +67 -76
- data/test/unit/gateways/net_registry_test.rb +351 -419
- data/test/unit/gateways/netbilling_test.rb +54 -0
- data/test/unit/gateways/pay_junction_test.rb +108 -46
- data/test/unit/gateways/pay_secure_test.rb +71 -0
- data/test/unit/gateways/payflow_express_test.rb +0 -8
- data/test/unit/gateways/payflow_test.rb +136 -65
- data/test/unit/gateways/payflow_uk_test.rb +0 -38
- data/test/unit/gateways/payment_express_test.rb +31 -51
- data/test/unit/gateways/paypal_express_test.rb +8 -2
- data/test/unit/gateways/paypal_test.rb +213 -54
- data/test/unit/gateways/plugnpay_test.rb +39 -32
- data/test/unit/gateways/protx_test.rb +45 -33
- data/test/unit/gateways/psigate_test.rb +146 -87
- data/test/unit/gateways/psl_card_test.rb +37 -24
- data/test/unit/gateways/quickpay_test.rb +33 -46
- data/test/unit/gateways/realex_test.rb +32 -31
- data/test/unit/gateways/secure_pay_tech_test.rb +44 -0
- data/test/unit/gateways/secure_pay_test.rb +35 -26
- data/test/unit/gateways/skip_jack_test.rb +125 -0
- data/test/unit/gateways/trans_first_test.rb +24 -37
- data/test/unit/gateways/trust_commerce_test.rb +47 -26
- data/test/unit/gateways/usa_epay_test.rb +52 -41
- data/test/unit/gateways/verifi_test.rb +41 -35
- data/test/unit/gateways/viaklix_test.rb +38 -32
- data/test/unit/generators/test_gateway_generator.rb +46 -0
- data/test/unit/generators/test_generator_helper.rb +20 -0
- data/test/unit/generators/test_integration_generator.rb +53 -0
- data/test/unit/integrations/action_view_helper_test.rb +7 -14
- data/test/unit/integrations/bogus_module_test.rb +4 -0
- data/test/unit/integrations/chronopay_module_test.rb +4 -0
- data/test/unit/integrations/gestpay_module_test.rb +4 -0
- data/test/unit/integrations/helpers/hi_trust_helper_test.rb +16 -0
- data/test/unit/integrations/hi_trust_module_test.rb +13 -0
- data/test/unit/integrations/nochex_module_test.rb +4 -0
- data/test/unit/integrations/notifications/hi_trust_notification_test.rb +38 -0
- data/test/unit/integrations/paypal_module_test.rb +4 -0
- data/test/unit/integrations/returns/chronopay_return_test.rb +11 -0
- data/test/unit/integrations/returns/gestpay_return_test.rb +10 -0
- data/test/unit/integrations/returns/hi_trust_return_test.rb +24 -0
- data/test/unit/integrations/returns/nochex_return_test.rb +10 -0
- data/test/unit/integrations/returns/paypal_return_test.rb +10 -0
- data/test/unit/integrations/returns/return_test.rb +11 -0
- data/test/unit/integrations/returns/two_checkout_return_test.rb +24 -0
- data/test/unit/integrations/two_checkout_module_test.rb +4 -0
- data/test/unit/posts_data_test.rb +86 -0
- data/test/unit/response_test.rb +15 -1
- data/test/unit/utils_test.rb +7 -0
- data/test/unit/validateable_test.rb +10 -6
- metadata +180 -142
- metadata.gz.sig +0 -0
- data/lib/active_merchant/billing/gateways/paypal/api_cert_chain.crt +0 -35
- data/script/generator/base.rb +0 -45
- data/script/generator/generator.rb +0 -24
- data/script/generator/generators/gateway/gateway_generator.rb +0 -14
- data/script/generator/generators/gateway/templates/gateway.rb +0 -73
- data/script/generator/generators/gateway/templates/gateway_test.rb +0 -41
- data/script/generator/generators/gateway/templates/remote_gateway_test.rb +0 -56
- data/script/generator/generators/integration/integration_generator.rb +0 -25
- data/script/generator/generators/integration/templates/helper.rb +0 -34
- data/script/generator/generators/integration/templates/helper_test.rb +0 -54
- data/script/generator/generators/integration/templates/integration.rb +0 -18
- data/script/generator/generators/integration/templates/module_test.rb +0 -9
- data/script/generator/generators/integration/templates/notification.rb +0 -100
- data/script/generator/generators/integration/templates/notification_test.rb +0 -41
- data/script/generator/manifest.rb +0 -20
- data/test/remote_tests/remote_authorize_net_test.rb +0 -113
- data/test/remote_tests/remote_brain_tree_test.rb +0 -78
- data/test/remote_tests/remote_moneris_test.rb +0 -110
- data/test/remote_tests/remote_psigate_test.rb +0 -87
- data/test/remote_tests/remote_secure_pay_test.rb +0 -36
- data/test/remote_tests/remote_trust_commerce_test.rb +0 -136
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
|
+
|
|
3
|
+
class RemotePaySecureTest < Test::Unit::TestCase
|
|
4
|
+
|
|
5
|
+
def setup
|
|
6
|
+
@gateway = PaySecureGateway.new(fixtures(:pay_secure))
|
|
7
|
+
|
|
8
|
+
@credit_card = credit_card('4000100011112224')
|
|
9
|
+
@options = {
|
|
10
|
+
:billing_address => address,
|
|
11
|
+
:order_id => generate_unique_id
|
|
12
|
+
}
|
|
13
|
+
@amount = 100
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_successful_purchase
|
|
17
|
+
assert response = @gateway.purchase(@amount, @credit_card, @options)
|
|
18
|
+
assert_success response
|
|
19
|
+
assert_equal PaySecureGateway::SUCCESS_MESSAGE, response.message
|
|
20
|
+
assert response.test?
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_unsuccessful_purchase
|
|
24
|
+
@credit_card.year = '2006'
|
|
25
|
+
assert response = @gateway.purchase(@amount, @credit_card, @options)
|
|
26
|
+
assert_equal 'Declined, card expired', response.message
|
|
27
|
+
assert_failure response
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_invalid_login
|
|
31
|
+
gateway = PaySecureGateway.new(
|
|
32
|
+
:login => '',
|
|
33
|
+
:password => ''
|
|
34
|
+
)
|
|
35
|
+
assert response = gateway.purchase(@amount, @credit_card, @options)
|
|
36
|
+
assert_equal "MissingField: 'MERCHANT_ID'", response.message
|
|
37
|
+
assert_failure response
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
2
|
|
|
3
3
|
class RemotePayflowTest < Test::Unit::TestCase
|
|
4
4
|
def setup
|
|
@@ -6,7 +6,7 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
6
6
|
|
|
7
7
|
@gateway = PayflowExpressGateway.new(fixtures(:payflow))
|
|
8
8
|
|
|
9
|
-
@options = { :
|
|
9
|
+
@options = { :billing_address => {
|
|
10
10
|
:name => 'Cody Fauser',
|
|
11
11
|
:address1 => '1234 Shady Brook Lane',
|
|
12
12
|
:city => 'Ottawa',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
2
|
|
|
3
3
|
class RemotePayflowTest < Test::Unit::TestCase
|
|
4
4
|
def setup
|
|
@@ -6,25 +6,18 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
6
6
|
|
|
7
7
|
@gateway = PayflowGateway.new(fixtures(:payflow))
|
|
8
8
|
|
|
9
|
-
@
|
|
9
|
+
@credit_card = credit_card('5105105105105100',
|
|
10
10
|
:type => 'master'
|
|
11
11
|
)
|
|
12
12
|
|
|
13
|
-
@options = { :
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
:city => 'Ottawa',
|
|
17
|
-
:state => 'ON',
|
|
18
|
-
:country => 'CA',
|
|
19
|
-
:zip => '90210',
|
|
20
|
-
:phone => '555-555-5555'
|
|
21
|
-
},
|
|
22
|
-
:email => 'cody@example.com'
|
|
13
|
+
@options = { :billing_address => address,
|
|
14
|
+
:email => 'cody@example.com',
|
|
15
|
+
:customer => 'codyexample'
|
|
23
16
|
}
|
|
24
17
|
end
|
|
25
18
|
|
|
26
19
|
def test_successful_purchase
|
|
27
|
-
assert response = @gateway.purchase(100000, @
|
|
20
|
+
assert response = @gateway.purchase(100000, @credit_card, @options)
|
|
28
21
|
assert_equal "Approved", response.message
|
|
29
22
|
assert_success response
|
|
30
23
|
assert response.test?
|
|
@@ -32,14 +25,14 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
32
25
|
end
|
|
33
26
|
|
|
34
27
|
def test_declined_purchase
|
|
35
|
-
assert response = @gateway.purchase(210000, @
|
|
28
|
+
assert response = @gateway.purchase(210000, @credit_card, @options)
|
|
36
29
|
assert_equal 'Declined', response.message
|
|
37
30
|
assert_failure response
|
|
38
31
|
assert response.test?
|
|
39
32
|
end
|
|
40
33
|
|
|
41
34
|
def test_successful_authorization
|
|
42
|
-
assert response = @gateway.authorize(100, @
|
|
35
|
+
assert response = @gateway.authorize(100, @credit_card, @options)
|
|
43
36
|
assert_equal "Approved", response.message
|
|
44
37
|
assert_success response
|
|
45
38
|
assert response.test?
|
|
@@ -47,7 +40,7 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
47
40
|
end
|
|
48
41
|
|
|
49
42
|
def test_authorize_and_capture
|
|
50
|
-
assert auth = @gateway.authorize(100, @
|
|
43
|
+
assert auth = @gateway.authorize(100, @credit_card, @options)
|
|
51
44
|
assert_success auth
|
|
52
45
|
assert_equal 'Approved', auth.message
|
|
53
46
|
assert auth.authorization
|
|
@@ -56,7 +49,7 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
56
49
|
end
|
|
57
50
|
|
|
58
51
|
def test_authorize_and_partial_capture
|
|
59
|
-
assert auth = @gateway.authorize(100 * 2, @
|
|
52
|
+
assert auth = @gateway.authorize(100 * 2, @credit_card, @options)
|
|
60
53
|
assert_success auth
|
|
61
54
|
assert_equal 'Approved', auth.message
|
|
62
55
|
assert auth.authorization
|
|
@@ -72,7 +65,7 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
72
65
|
end
|
|
73
66
|
|
|
74
67
|
def test_authorize_and_void
|
|
75
|
-
assert auth = @gateway.authorize(100, @
|
|
68
|
+
assert auth = @gateway.authorize(100, @credit_card, @options)
|
|
76
69
|
assert_success auth
|
|
77
70
|
assert_equal 'Approved', auth.message
|
|
78
71
|
assert auth.authorization
|
|
@@ -85,36 +78,33 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
85
78
|
:login => '',
|
|
86
79
|
:password => ''
|
|
87
80
|
)
|
|
88
|
-
assert response = gateway.purchase(100, @
|
|
81
|
+
assert response = gateway.purchase(100, @credit_card, @options)
|
|
89
82
|
assert_equal 'Invalid vendor account', response.message
|
|
90
83
|
assert_failure response
|
|
91
84
|
end
|
|
92
85
|
|
|
93
86
|
def test_duplicate_request_id
|
|
94
|
-
gateway = PayflowGateway.new(
|
|
95
|
-
:login => @login,
|
|
96
|
-
:password => @password,
|
|
97
|
-
:partner => @partner
|
|
98
|
-
)
|
|
99
|
-
|
|
100
87
|
request_id = Digest::MD5.hexdigest(rand.to_s)
|
|
101
|
-
gateway.expects(:generate_unique_id).times(2).returns(request_id)
|
|
88
|
+
@gateway.expects(:generate_unique_id).times(2).returns(request_id)
|
|
102
89
|
|
|
103
|
-
response1 = gateway.purchase(100, @
|
|
90
|
+
response1 = @gateway.purchase(100, @credit_card, @options)
|
|
91
|
+
assert response1.success?
|
|
104
92
|
assert_nil response1.params['duplicate']
|
|
105
|
-
|
|
93
|
+
|
|
94
|
+
response2 = @gateway.purchase(100, @credit_card, @options)
|
|
95
|
+
assert response2.success?
|
|
106
96
|
assert response2.params['duplicate']
|
|
107
97
|
end
|
|
108
98
|
|
|
109
99
|
def test_create_recurring_profile
|
|
110
|
-
response = @gateway.recurring(1000, @
|
|
100
|
+
response = @gateway.recurring(1000, @credit_card, :periodicity => :monthly)
|
|
111
101
|
assert_success response
|
|
112
102
|
assert !response.params['profile_id'].blank?
|
|
113
103
|
assert response.test?
|
|
114
104
|
end
|
|
115
105
|
|
|
116
106
|
def test_create_recurring_profile_with_invalid_date
|
|
117
|
-
response = @gateway.recurring(1000, @
|
|
107
|
+
response = @gateway.recurring(1000, @credit_card, :periodicity => :monthly, :starting_at => Time.now)
|
|
118
108
|
assert_failure response
|
|
119
109
|
assert_equal 'Field format error: Start or next payment date must be a valid future date', response.message
|
|
120
110
|
assert response.params['profile_id'].blank?
|
|
@@ -122,7 +112,7 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
122
112
|
end
|
|
123
113
|
|
|
124
114
|
def test_create_and_cancel_recurring_profile
|
|
125
|
-
response = @gateway.recurring(1000, @
|
|
115
|
+
response = @gateway.recurring(1000, @credit_card, :periodicity => :monthly)
|
|
126
116
|
assert_success response
|
|
127
117
|
assert !response.params['profile_id'].blank?
|
|
128
118
|
assert response.test?
|
|
@@ -140,7 +130,7 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
140
130
|
:starting_at => Time.now + 1.day,
|
|
141
131
|
:comment => "Test Profile"
|
|
142
132
|
)
|
|
143
|
-
response = @gateway.recurring(100, @
|
|
133
|
+
response = @gateway.recurring(100, @credit_card, @options)
|
|
144
134
|
assert_equal "Approved", response.params['message']
|
|
145
135
|
assert_equal "0", response.params['result']
|
|
146
136
|
assert_success response
|
|
@@ -155,7 +145,7 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
155
145
|
:payments => '4',
|
|
156
146
|
:profile_id => @recurring_profile_id
|
|
157
147
|
)
|
|
158
|
-
response = @gateway.recurring(400, @
|
|
148
|
+
response = @gateway.recurring(400, @credit_card, @options)
|
|
159
149
|
assert_equal "Approved", response.params['message']
|
|
160
150
|
assert_equal "0", response.params['result']
|
|
161
151
|
assert_success response
|
|
@@ -167,6 +157,12 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
167
157
|
assert_success response
|
|
168
158
|
assert response.test?
|
|
169
159
|
|
|
160
|
+
# Test payment history inquiry
|
|
161
|
+
response = @gateway.recurring_inquiry(@recurring_profile_id, :history => true)
|
|
162
|
+
assert_equal '0', response.params['result']
|
|
163
|
+
assert_success response
|
|
164
|
+
assert response.test?
|
|
165
|
+
|
|
170
166
|
# Test cancel
|
|
171
167
|
response = @gateway.cancel_recurring(@recurring_profile_id)
|
|
172
168
|
assert_equal "Approved", response.params['message']
|
|
@@ -177,7 +173,7 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
177
173
|
|
|
178
174
|
# Note that this test will only work if you enable reference transactions!!
|
|
179
175
|
def test_reference_purchase
|
|
180
|
-
assert response = @gateway.purchase(10000, @
|
|
176
|
+
assert response = @gateway.purchase(10000, @credit_card, @options)
|
|
181
177
|
assert_equal "Approved", response.message
|
|
182
178
|
assert_success response
|
|
183
179
|
assert response.test?
|
|
@@ -191,7 +187,7 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
191
187
|
end
|
|
192
188
|
|
|
193
189
|
def test_recurring_with_initial_authorization
|
|
194
|
-
response = @gateway.recurring(1000, @
|
|
190
|
+
response = @gateway.recurring(1000, @credit_card,
|
|
195
191
|
:periodicity => :monthly,
|
|
196
192
|
:initial_transaction => {
|
|
197
193
|
:type => :authorization
|
|
@@ -204,7 +200,7 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
204
200
|
end
|
|
205
201
|
|
|
206
202
|
def test_recurring_with_initial_authorization
|
|
207
|
-
response = @gateway.recurring(1000, @
|
|
203
|
+
response = @gateway.recurring(1000, @credit_card,
|
|
208
204
|
:periodicity => :monthly,
|
|
209
205
|
:initial_transaction => {
|
|
210
206
|
:type => :purchase,
|
|
@@ -220,7 +216,7 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
220
216
|
def test_purchase_and_referenced_credit
|
|
221
217
|
amount = 100
|
|
222
218
|
|
|
223
|
-
assert purchase = @gateway.purchase(amount, @
|
|
219
|
+
assert purchase = @gateway.purchase(amount, @credit_card, @options)
|
|
224
220
|
assert_success purchase
|
|
225
221
|
assert_equal 'Approved', purchase.message
|
|
226
222
|
assert !purchase.authorization.blank?
|
|
@@ -235,7 +231,7 @@ class RemotePayflowTest < Test::Unit::TestCase
|
|
|
235
231
|
# Non-referenced credits will fail with Result code 117 (failed the security
|
|
236
232
|
# check) unless Allow non-referenced credits = Yes in PayPal manager
|
|
237
233
|
def test_purchase_and_non_referenced_credit
|
|
238
|
-
assert credit = @gateway.credit(100, @
|
|
234
|
+
assert credit = @gateway.credit(100, @credit_card, @options)
|
|
239
235
|
assert_success credit
|
|
240
236
|
end
|
|
241
237
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
2
|
|
|
3
3
|
class RemotePayflowUkTest < Test::Unit::TestCase
|
|
4
4
|
def setup
|
|
@@ -37,17 +37,18 @@ class RemotePayflowUkTest < Test::Unit::TestCase
|
|
|
37
37
|
:last_name => 'Brooks'
|
|
38
38
|
)
|
|
39
39
|
|
|
40
|
-
@options = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
@options = {
|
|
41
|
+
:billing_address => {
|
|
42
|
+
:name => 'Cody Fauser',
|
|
43
|
+
:address1 => '1234 Shady Brook Lane',
|
|
44
|
+
:city => 'Ottawa',
|
|
45
|
+
:state => 'ON',
|
|
46
|
+
:country => 'CA',
|
|
47
|
+
:zip => '90210',
|
|
48
|
+
:phone => '555-555-5555'
|
|
49
|
+
},
|
|
50
|
+
:email => 'cody@example.com'
|
|
51
|
+
}
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
def test_successful_purchase
|
|
@@ -1,31 +1,24 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
2
|
|
|
3
3
|
class RemotePaymentExpressTest < Test::Unit::TestCase
|
|
4
|
-
|
|
5
|
-
PASSWORD = 'PASSWORD'
|
|
6
|
-
|
|
4
|
+
|
|
7
5
|
def setup
|
|
8
6
|
@gateway = PaymentExpressGateway.new(fixtures(:payment_express))
|
|
9
7
|
|
|
10
|
-
@
|
|
8
|
+
@credit_card = credit_card
|
|
11
9
|
|
|
12
10
|
@options = {
|
|
13
|
-
:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
:state => 'ON',
|
|
18
|
-
:country => 'CA',
|
|
19
|
-
:zip => '90210',
|
|
20
|
-
:phone => '555-555-5555'
|
|
21
|
-
},
|
|
22
|
-
:email => 'cody@example.com',
|
|
23
|
-
:description => 'Store purchase'
|
|
11
|
+
:order_id => generate_unique_id,
|
|
12
|
+
:billing_address => address,
|
|
13
|
+
:email => 'cody@example.com',
|
|
14
|
+
:description => 'Store purchase'
|
|
24
15
|
}
|
|
16
|
+
|
|
17
|
+
@amount = 100
|
|
25
18
|
end
|
|
26
19
|
|
|
27
20
|
def test_successful_purchase
|
|
28
|
-
assert response = @gateway.purchase(
|
|
21
|
+
assert response = @gateway.purchase(@amount, @credit_card, @options)
|
|
29
22
|
assert_equal "APPROVED", response.message
|
|
30
23
|
assert_success response
|
|
31
24
|
assert response.test?
|
|
@@ -33,8 +26,7 @@ class RemotePaymentExpressTest < Test::Unit::TestCase
|
|
|
33
26
|
end
|
|
34
27
|
|
|
35
28
|
def test_successful_purchase_with_reference_id
|
|
36
|
-
|
|
37
|
-
assert response = @gateway.purchase(100, @creditcard, @options)
|
|
29
|
+
assert response = @gateway.purchase(@amount, @credit_card, @options)
|
|
38
30
|
assert_equal "APPROVED", response.message
|
|
39
31
|
assert_success response
|
|
40
32
|
assert response.test?
|
|
@@ -42,14 +34,14 @@ class RemotePaymentExpressTest < Test::Unit::TestCase
|
|
|
42
34
|
end
|
|
43
35
|
|
|
44
36
|
def test_declined_purchase
|
|
45
|
-
assert response = @gateway.purchase(176, @
|
|
37
|
+
assert response = @gateway.purchase(176, @credit_card, @options)
|
|
46
38
|
assert_equal 'DECLINED', response.message
|
|
47
39
|
assert_failure response
|
|
48
40
|
assert response.test?
|
|
49
41
|
end
|
|
50
42
|
|
|
51
43
|
def test_successful_authorization
|
|
52
|
-
assert response = @gateway.authorize(
|
|
44
|
+
assert response = @gateway.authorize(@amount, @credit_card, @options)
|
|
53
45
|
assert_equal "APPROVED", response.message
|
|
54
46
|
assert_success response
|
|
55
47
|
assert response.test?
|
|
@@ -57,18 +49,17 @@ class RemotePaymentExpressTest < Test::Unit::TestCase
|
|
|
57
49
|
end
|
|
58
50
|
|
|
59
51
|
def test_authorize_and_capture
|
|
60
|
-
|
|
61
|
-
assert auth = @gateway.authorize(amount, @creditcard, @options)
|
|
52
|
+
assert auth = @gateway.authorize(@amount, @credit_card, @options)
|
|
62
53
|
assert_success auth
|
|
63
54
|
assert_equal 'APPROVED', auth.message
|
|
64
55
|
assert auth.authorization
|
|
65
|
-
assert capture = @gateway.capture(amount, auth.authorization)
|
|
56
|
+
assert capture = @gateway.capture(@amount, auth.authorization)
|
|
66
57
|
assert_success capture
|
|
67
58
|
end
|
|
68
59
|
|
|
69
60
|
def test_purchase_and_credit
|
|
70
61
|
amount = 10000
|
|
71
|
-
assert purchase = @gateway.purchase(amount, @
|
|
62
|
+
assert purchase = @gateway.purchase(amount, @credit_card, @options)
|
|
72
63
|
assert_success purchase
|
|
73
64
|
assert_equal 'APPROVED', purchase.message
|
|
74
65
|
assert !purchase.authorization.blank?
|
|
@@ -77,7 +68,7 @@ class RemotePaymentExpressTest < Test::Unit::TestCase
|
|
|
77
68
|
end
|
|
78
69
|
|
|
79
70
|
def test_failed_capture
|
|
80
|
-
assert response = @gateway.capture(
|
|
71
|
+
assert response = @gateway.capture(@amount, '999')
|
|
81
72
|
assert_failure response
|
|
82
73
|
assert_equal 'IVL DPSTXNREF', response.message
|
|
83
74
|
end
|
|
@@ -87,13 +78,13 @@ class RemotePaymentExpressTest < Test::Unit::TestCase
|
|
|
87
78
|
:login => '',
|
|
88
79
|
:password => ''
|
|
89
80
|
)
|
|
90
|
-
assert response = gateway.purchase(
|
|
81
|
+
assert response = gateway.purchase(@amount, @credit_card, @options)
|
|
91
82
|
assert_equal 'Invalid Credentials', response.message
|
|
92
83
|
assert_failure response
|
|
93
84
|
end
|
|
94
85
|
|
|
95
86
|
def test_store_credit_card
|
|
96
|
-
assert response = @gateway.store(@
|
|
87
|
+
assert response = @gateway.store(@credit_card)
|
|
97
88
|
assert_success response
|
|
98
89
|
assert_equal "APPROVED", response.message
|
|
99
90
|
assert !response.token.blank?
|
|
@@ -102,7 +93,7 @@ class RemotePaymentExpressTest < Test::Unit::TestCase
|
|
|
102
93
|
|
|
103
94
|
def test_store_with_custom_token
|
|
104
95
|
token = Time.now.to_i.to_s #hehe
|
|
105
|
-
assert response = @gateway.store(@
|
|
96
|
+
assert response = @gateway.store(@credit_card, :billing_id => token)
|
|
106
97
|
assert_success response
|
|
107
98
|
assert_equal "APPROVED", response.message
|
|
108
99
|
assert !response.token.blank?
|
|
@@ -111,26 +102,25 @@ class RemotePaymentExpressTest < Test::Unit::TestCase
|
|
|
111
102
|
end
|
|
112
103
|
|
|
113
104
|
def test_store_invalid_credit_card
|
|
114
|
-
original_number = @
|
|
115
|
-
@
|
|
105
|
+
original_number = @credit_card.number
|
|
106
|
+
@credit_card.number = 2
|
|
116
107
|
|
|
117
|
-
assert response = @gateway.store(@
|
|
108
|
+
assert response = @gateway.store(@credit_card)
|
|
118
109
|
assert_failure response
|
|
119
110
|
ensure
|
|
120
|
-
@
|
|
111
|
+
@credit_card.number = original_number
|
|
121
112
|
end
|
|
122
113
|
|
|
123
114
|
def test_store_and_charge
|
|
124
|
-
assert response = @gateway.store(@
|
|
115
|
+
assert response = @gateway.store(@credit_card)
|
|
125
116
|
assert_success response
|
|
126
117
|
assert_equal "APPROVED", response.message
|
|
127
118
|
assert (token = response.token)
|
|
128
119
|
|
|
129
|
-
assert purchase = @gateway.purchase(
|
|
120
|
+
assert purchase = @gateway.purchase( @amount, token)
|
|
130
121
|
assert_equal "APPROVED", purchase.message
|
|
131
122
|
assert_success purchase
|
|
132
123
|
assert_not_nil purchase.authorization
|
|
133
124
|
end
|
|
134
125
|
|
|
135
|
-
|
|
136
126
|
end
|