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
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
2
|
|
|
3
3
|
class PaypalExpressTest < Test::Unit::TestCase
|
|
4
4
|
def setup
|
|
5
5
|
Base.gateway_mode = :test
|
|
6
6
|
|
|
7
|
-
@gateway = PaypalExpressGateway.new(fixtures(:
|
|
7
|
+
@gateway = PaypalExpressGateway.new(fixtures(:paypal_certificate))
|
|
8
8
|
|
|
9
9
|
@options = {
|
|
10
10
|
:order_id => '230000',
|
|
11
11
|
:email => 'buyer@jadedpallet.com',
|
|
12
|
-
:
|
|
12
|
+
:billing_address => { :name => 'Fred Brooks',
|
|
13
13
|
:address1 => '1234 Penny Lane',
|
|
14
14
|
:city => 'Jonsetown',
|
|
15
15
|
:state => 'NC',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
2
|
|
|
3
3
|
class PaypalTest < Test::Unit::TestCase
|
|
4
4
|
def setup
|
|
5
5
|
Base.gateway_mode = :test
|
|
6
6
|
|
|
7
|
-
@gateway = PaypalGateway.new(fixtures(:
|
|
7
|
+
@gateway = PaypalGateway.new(fixtures(:paypal_certificate))
|
|
8
8
|
|
|
9
9
|
@creditcard = CreditCard.new(
|
|
10
10
|
:type => "Visa",
|
|
@@ -17,9 +17,9 @@ class PaypalTest < Test::Unit::TestCase
|
|
|
17
17
|
)
|
|
18
18
|
|
|
19
19
|
@params = {
|
|
20
|
-
:order_id =>
|
|
20
|
+
:order_id => generate_unique_id,
|
|
21
21
|
:email => 'buyer@jadedpallet.com',
|
|
22
|
-
:
|
|
22
|
+
:billing_address => { :name => 'Fred Brooks',
|
|
23
23
|
:address1 => '1234 Penny Lane',
|
|
24
24
|
:city => 'Jonsetown',
|
|
25
25
|
:state => 'NC',
|
|
@@ -27,11 +27,10 @@ class PaypalTest < Test::Unit::TestCase
|
|
|
27
27
|
:zip => '23456'
|
|
28
28
|
} ,
|
|
29
29
|
:description => 'Stuff that you purchased, yo!',
|
|
30
|
-
:ip => '10.0.0.1'
|
|
31
|
-
:return_url => 'http://example.com/return',
|
|
32
|
-
:cancel_return_url => 'http://example.com/cancel'
|
|
30
|
+
:ip => '10.0.0.1'
|
|
33
31
|
}
|
|
34
32
|
|
|
33
|
+
@amount = 100
|
|
35
34
|
# test re-authorization, auth-id must be more than 3 days old.
|
|
36
35
|
# each auth-id can only be reauthorized and tested once.
|
|
37
36
|
# leave it commented if you don't want to test reauthorization.
|
|
@@ -41,20 +40,27 @@ class PaypalTest < Test::Unit::TestCase
|
|
|
41
40
|
end
|
|
42
41
|
|
|
43
42
|
def test_successful_purchase
|
|
44
|
-
response = @gateway.purchase(
|
|
43
|
+
response = @gateway.purchase(@amount, @creditcard, @params)
|
|
44
|
+
assert_success response
|
|
45
|
+
assert response.params['transaction_id']
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_successful_purchase_with_api_signature
|
|
49
|
+
gateway = PaypalGateway.new(fixtures(:paypal_signature))
|
|
50
|
+
response = gateway.purchase(@amount, @creditcard, @params)
|
|
45
51
|
assert_success response
|
|
46
52
|
assert response.params['transaction_id']
|
|
47
53
|
end
|
|
48
54
|
|
|
49
55
|
def test_failed_purchase
|
|
50
56
|
@creditcard.number = '234234234234'
|
|
51
|
-
response = @gateway.purchase(
|
|
57
|
+
response = @gateway.purchase(@amount, @creditcard, @params)
|
|
52
58
|
assert_failure response
|
|
53
59
|
assert_nil response.params['transaction_id']
|
|
54
60
|
end
|
|
55
61
|
|
|
56
62
|
def test_successful_authorization
|
|
57
|
-
response = @gateway.authorize(
|
|
63
|
+
response = @gateway.authorize(@amount, @creditcard, @params)
|
|
58
64
|
assert_success response
|
|
59
65
|
assert response.params['transaction_id']
|
|
60
66
|
assert_equal '3.00', response.params['amount']
|
|
@@ -63,7 +69,7 @@ class PaypalTest < Test::Unit::TestCase
|
|
|
63
69
|
|
|
64
70
|
def test_failed_authorization
|
|
65
71
|
@creditcard.number = '234234234234'
|
|
66
|
-
response = @gateway.authorize(
|
|
72
|
+
response = @gateway.authorize(@amount, @creditcard, @params)
|
|
67
73
|
assert_failure response
|
|
68
74
|
assert_nil response.params['transaction_id']
|
|
69
75
|
end
|
|
@@ -89,9 +95,9 @@ class PaypalTest < Test::Unit::TestCase
|
|
|
89
95
|
end
|
|
90
96
|
|
|
91
97
|
def test_successful_capture
|
|
92
|
-
auth = @gateway.authorize(
|
|
98
|
+
auth = @gateway.authorize(@amount, @creditcard, @params)
|
|
93
99
|
assert_success auth
|
|
94
|
-
response = @gateway.capture(
|
|
100
|
+
response = @gateway.capture(@amount, auth.authorization)
|
|
95
101
|
assert_success response
|
|
96
102
|
assert response.params['transaction_id']
|
|
97
103
|
assert_equal '3.00', response.params['gross_amount']
|
|
@@ -99,19 +105,17 @@ class PaypalTest < Test::Unit::TestCase
|
|
|
99
105
|
end
|
|
100
106
|
|
|
101
107
|
def test_successful_voiding
|
|
102
|
-
auth = @gateway.authorize(
|
|
108
|
+
auth = @gateway.authorize(@amount, @creditcard, @params)
|
|
103
109
|
assert_success auth
|
|
104
110
|
response = @gateway.void(auth.authorization)
|
|
105
111
|
assert_success response
|
|
106
112
|
end
|
|
107
113
|
|
|
108
114
|
def test_purchase_and_full_credit
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
purchase = @gateway.purchase(amount, @creditcard, @params)
|
|
115
|
+
purchase = @gateway.purchase(@amount, @creditcard, @params)
|
|
112
116
|
assert_success purchase
|
|
113
117
|
|
|
114
|
-
credit = @gateway.credit(amount, purchase.authorization, :note => 'Sorry')
|
|
118
|
+
credit = @gateway.credit(@amount, purchase.authorization, :note => 'Sorry')
|
|
115
119
|
assert_success credit
|
|
116
120
|
assert credit.test?
|
|
117
121
|
assert_equal 'USD', credit.params['net_refund_amount_currency_id']
|
|
@@ -128,10 +132,10 @@ class PaypalTest < Test::Unit::TestCase
|
|
|
128
132
|
end
|
|
129
133
|
|
|
130
134
|
def test_successful_transfer
|
|
131
|
-
response = @gateway.purchase(
|
|
135
|
+
response = @gateway.purchase(@amount, @creditcard, @params)
|
|
132
136
|
assert_success response
|
|
133
137
|
|
|
134
|
-
response = @gateway.transfer(
|
|
138
|
+
response = @gateway.transfer(@amount, 'joe@example.com', :subject => 'Your money', :note => 'Thanks for taking care of that')
|
|
135
139
|
assert_success response
|
|
136
140
|
end
|
|
137
141
|
|
|
@@ -145,7 +149,7 @@ class PaypalTest < Test::Unit::TestCase
|
|
|
145
149
|
response = @gateway.purchase(900, @creditcard, @params)
|
|
146
150
|
assert_success response
|
|
147
151
|
|
|
148
|
-
response = @gateway.transfer([
|
|
152
|
+
response = @gateway.transfer([@amount, 'joe@example.com'],
|
|
149
153
|
[600, 'jane@example.com', {:note => 'Thanks for taking care of that'}],
|
|
150
154
|
:subject => 'Your money')
|
|
151
155
|
assert_success response
|
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
2
|
|
|
3
3
|
class PlugnpayTest < Test::Unit::TestCase
|
|
4
|
-
include ActiveMerchant::Billing
|
|
5
|
-
|
|
6
4
|
def setup
|
|
7
5
|
@gateway = PlugnpayGateway.new(fixtures(:plugnpay))
|
|
8
|
-
@
|
|
9
|
-
@
|
|
6
|
+
@good_credit_card = credit_card('4242424242424242')
|
|
7
|
+
@bad_credit_card = credit_card('1234123412341234')
|
|
8
|
+
@options = {
|
|
9
|
+
:billing_address => address,
|
|
10
|
+
:description => 'Store purchaes'
|
|
11
|
+
}
|
|
12
|
+
@amount = 100
|
|
13
|
+
|
|
10
14
|
end
|
|
11
15
|
|
|
12
16
|
def test_bad_credit_card
|
|
13
|
-
assert response = @gateway.authorize(
|
|
17
|
+
assert response = @gateway.authorize(@amount, @bad_credit_card, @options)
|
|
14
18
|
assert_failure response
|
|
15
19
|
assert_equal 'Invalid Credit Card No.', response.message
|
|
16
20
|
end
|
|
17
21
|
|
|
18
22
|
def test_good_credit_card
|
|
19
|
-
assert response = @gateway.authorize(
|
|
23
|
+
assert response = @gateway.authorize(@amount, @good_credit_card, @options)
|
|
20
24
|
assert_success response
|
|
21
25
|
assert !response.authorization.blank?
|
|
22
26
|
assert_equal 'Success', response.message
|
|
23
27
|
end
|
|
24
28
|
|
|
25
29
|
def test_purchase_transaction
|
|
26
|
-
assert response = @gateway.purchase(
|
|
30
|
+
assert response = @gateway.purchase(@amount, @good_credit_card, @options)
|
|
27
31
|
assert_success response
|
|
28
32
|
assert !response.authorization.blank?
|
|
29
33
|
assert_equal 'Success', response.message
|
|
@@ -33,16 +37,16 @@ class PlugnpayTest < Test::Unit::TestCase
|
|
|
33
37
|
# In the gateway admin tool, you must add your IP address to the allowed addresses and uncheck "Remote client" under the
|
|
34
38
|
# "Auth Transactions" section of the "Security Requirements" area in the test account Security Administration Area.
|
|
35
39
|
def test_authorization_and_capture
|
|
36
|
-
assert authorization = @gateway.authorize(
|
|
40
|
+
assert authorization = @gateway.authorize(@amount, @good_credit_card, @options)
|
|
37
41
|
assert_success authorization
|
|
38
42
|
|
|
39
|
-
assert capture = @gateway.capture(
|
|
43
|
+
assert capture = @gateway.capture(@amount, authorization.authorization)
|
|
40
44
|
assert_success capture
|
|
41
45
|
assert_equal 'Success', capture.message
|
|
42
46
|
end
|
|
43
47
|
|
|
44
48
|
def test_authorization_and_void
|
|
45
|
-
assert authorization = @gateway.authorize(
|
|
49
|
+
assert authorization = @gateway.authorize(@amount, @good_credit_card, @options)
|
|
46
50
|
assert_success authorization
|
|
47
51
|
|
|
48
52
|
assert void = @gateway.void(authorization.authorization)
|
|
@@ -51,18 +55,16 @@ class PlugnpayTest < Test::Unit::TestCase
|
|
|
51
55
|
end
|
|
52
56
|
|
|
53
57
|
def test_purchase_and_credit
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
assert purchase = @gateway.purchase(amount, @good_creditcard)
|
|
58
|
+
assert purchase = @gateway.purchase(@amount, @good_credit_card, @options)
|
|
57
59
|
assert_success purchase
|
|
58
60
|
|
|
59
|
-
assert credit = @gateway.credit(amount, purchase.authorization)
|
|
61
|
+
assert credit = @gateway.credit(@amount, purchase.authorization)
|
|
60
62
|
assert_success credit
|
|
61
63
|
assert_equal 'Success', credit.message
|
|
62
64
|
end
|
|
63
65
|
|
|
64
66
|
def test_credit_with_no_previous_transaction
|
|
65
|
-
assert credit = @gateway.credit(
|
|
67
|
+
assert credit = @gateway.credit(@amount, @good_credit_card, @options)
|
|
66
68
|
|
|
67
69
|
assert_success credit
|
|
68
70
|
assert_equal 'Success', credit.message
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
2
|
|
|
3
3
|
# Some of the standard tests have been removed at Protx test
|
|
4
4
|
# server is pants and accepts anything and says Status=OK. (shift)
|
|
5
5
|
class RemoteProtxTest < Test::Unit::TestCase
|
|
6
|
-
include ActiveMerchant::Billing
|
|
7
|
-
|
|
8
6
|
# Run the tests in the simulated environment
|
|
9
7
|
# set to false to run the tests in the test environment
|
|
10
8
|
ProtxGateway.simulate = true
|
|
11
9
|
|
|
12
|
-
AMOUNT = 100
|
|
13
|
-
|
|
14
10
|
def setup
|
|
15
11
|
@gateway = ProtxGateway.new(fixtures(:protx))
|
|
16
12
|
|
|
@@ -70,55 +66,59 @@ class RemoteProtxTest < Test::Unit::TestCase
|
|
|
70
66
|
)
|
|
71
67
|
|
|
72
68
|
@mastercard_options = {
|
|
73
|
-
:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
:billing_address => {
|
|
70
|
+
:address1 => '25 The Larches',
|
|
71
|
+
:city => "Narborough",
|
|
72
|
+
:state => "Leicester",
|
|
73
|
+
:zip => 'LE10 2RT'
|
|
74
|
+
},
|
|
75
|
+
:order_id => generate_unique_id,
|
|
79
76
|
:description => 'Store purchase'
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
@maestro_options = {
|
|
83
|
-
:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
80
|
+
:billing_address => {
|
|
81
|
+
:address1 => 'The Parkway',
|
|
82
|
+
:address2 => "Larches Approach",
|
|
83
|
+
:city => "Hull",
|
|
84
|
+
:state => "North Humberside",
|
|
85
|
+
:zip => 'HU7 9OP'
|
|
86
|
+
},
|
|
87
|
+
:order_id => generate_unique_id,
|
|
90
88
|
:description => 'Store purchase'
|
|
91
89
|
}
|
|
92
90
|
|
|
93
91
|
@solo_options = {
|
|
94
|
-
:
|
|
92
|
+
:billing_address => {
|
|
95
93
|
:address1 => '5 Zigzag Road',
|
|
96
94
|
:city => 'Isleworth',
|
|
97
95
|
:state => 'Middlesex',
|
|
98
96
|
:zip => 'TW7 8FF'
|
|
99
97
|
},
|
|
100
|
-
:order_id =>
|
|
98
|
+
:order_id => generate_unique_id,
|
|
101
99
|
:description => 'Store purchase'
|
|
102
100
|
}
|
|
101
|
+
|
|
102
|
+
@amount = 100
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
def test_successful_mastercard_purchase
|
|
106
|
-
assert response = @gateway.purchase(
|
|
106
|
+
assert response = @gateway.purchase(@amount, @mastercard, @mastercard_options)
|
|
107
107
|
assert_success response
|
|
108
108
|
assert response.test?
|
|
109
109
|
assert !response.authorization.blank?
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
def test_successful_authorization_and_capture
|
|
113
|
-
assert auth = @gateway.authorize(
|
|
113
|
+
assert auth = @gateway.authorize(@amount, @mastercard, @mastercard_options)
|
|
114
114
|
assert_success auth
|
|
115
115
|
|
|
116
|
-
assert capture = @gateway.capture(
|
|
116
|
+
assert capture = @gateway.capture(@amount, auth.authorization)
|
|
117
117
|
assert_success capture
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
def test_successful_authorization_and_void
|
|
121
|
-
assert auth = @gateway.authorize(
|
|
121
|
+
assert auth = @gateway.authorize(@amount, @mastercard, @mastercard_options)
|
|
122
122
|
assert_success auth
|
|
123
123
|
|
|
124
124
|
assert void = @gateway.void(auth.authorization)
|
|
@@ -126,7 +126,7 @@ class RemoteProtxTest < Test::Unit::TestCase
|
|
|
126
126
|
end
|
|
127
127
|
|
|
128
128
|
def test_successful_purchase_and_void
|
|
129
|
-
assert purchase = @gateway.purchase(
|
|
129
|
+
assert purchase = @gateway.purchase(@amount, @mastercard, @mastercard_options)
|
|
130
130
|
assert_success purchase
|
|
131
131
|
|
|
132
132
|
assert void = @gateway.void(purchase.authorization)
|
|
@@ -134,38 +134,38 @@ class RemoteProtxTest < Test::Unit::TestCase
|
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
def test_successful_purchase_and_credit
|
|
137
|
-
assert purchase = @gateway.purchase(
|
|
137
|
+
assert purchase = @gateway.purchase(@amount, @mastercard, @mastercard_options)
|
|
138
138
|
assert_success purchase
|
|
139
139
|
|
|
140
|
-
assert credit = @gateway.credit(
|
|
140
|
+
assert credit = @gateway.credit(@amount, purchase.authorization,
|
|
141
141
|
:description => 'Crediting trx',
|
|
142
|
-
:order_id =>
|
|
142
|
+
:order_id => generate_unique_id
|
|
143
143
|
)
|
|
144
144
|
|
|
145
145
|
assert_success credit
|
|
146
146
|
end
|
|
147
147
|
|
|
148
148
|
def test_successful_maestro_purchase
|
|
149
|
-
assert response = @gateway.purchase(
|
|
149
|
+
assert response = @gateway.purchase(@amount, @maestro, @maestro_options)
|
|
150
150
|
assert_success response
|
|
151
151
|
end
|
|
152
152
|
|
|
153
153
|
def test_successful_solo_purchase
|
|
154
|
-
assert response = @gateway.purchase(
|
|
154
|
+
assert response = @gateway.purchase(@amount, @solo, @solo_options)
|
|
155
155
|
assert_success response
|
|
156
156
|
assert response.test?
|
|
157
157
|
assert !response.authorization.blank?
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
def test_successful_amex_purchase
|
|
161
|
-
assert response = @gateway.purchase(
|
|
161
|
+
assert response = @gateway.purchase(@amount, @amex, :order_id => generate_unique_id)
|
|
162
162
|
assert_success response
|
|
163
163
|
assert response.test?
|
|
164
164
|
assert !response.authorization.blank?
|
|
165
165
|
end
|
|
166
166
|
|
|
167
167
|
def test_successful_electron_purchase
|
|
168
|
-
assert response = @gateway.purchase(
|
|
168
|
+
assert response = @gateway.purchase(@amount, @electron, :order_id => generate_unique_id)
|
|
169
169
|
assert_success response
|
|
170
170
|
assert response.test?
|
|
171
171
|
assert !response.authorization.blank?
|
|
@@ -177,7 +177,7 @@ class RemoteProtxTest < Test::Unit::TestCase
|
|
|
177
177
|
gateway = ProtxGateway.new(
|
|
178
178
|
:login => ''
|
|
179
179
|
)
|
|
180
|
-
assert response = gateway.purchase(
|
|
180
|
+
assert response = gateway.purchase(@amount, @mastercard, @mastercard_options)
|
|
181
181
|
assert_equal message, response.message
|
|
182
182
|
assert_failure response
|
|
183
183
|
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
|
+
|
|
3
|
+
class PsigateRemoteTest < Test::Unit::TestCase
|
|
4
|
+
|
|
5
|
+
def setup
|
|
6
|
+
Base.mode = :test
|
|
7
|
+
@gateway = PsigateGateway.new(fixtures(:psigate))
|
|
8
|
+
|
|
9
|
+
@amount = 2400
|
|
10
|
+
@creditcard = credit_card('4242424242424242')
|
|
11
|
+
@options = {
|
|
12
|
+
:order_id => generate_unique_id,
|
|
13
|
+
:billing_address => address,
|
|
14
|
+
:email => 'jack@example.com'
|
|
15
|
+
}
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_successful_authorization
|
|
19
|
+
assert response = @gateway.authorize(@amount, @creditcard, @options)
|
|
20
|
+
assert_success response
|
|
21
|
+
assert_equal @options[:order_id], response.authorization
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_successful_purchase
|
|
25
|
+
assert response = @gateway.purchase(@amount, @creditcard, @options)
|
|
26
|
+
assert_success response
|
|
27
|
+
assert_equal @options[:order_id], response.authorization
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_successful_authorization_and_capture
|
|
31
|
+
assert authorization = @gateway.authorize(@amount, @creditcard, @options)
|
|
32
|
+
assert_success authorization
|
|
33
|
+
|
|
34
|
+
assert capture = @gateway.capture(@amount, authorization.authorization)
|
|
35
|
+
assert_success capture
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_successful_purchase_and_credit
|
|
39
|
+
assert purchase = @gateway.purchase(@amount, @creditcard, @options)
|
|
40
|
+
assert_success purchase
|
|
41
|
+
|
|
42
|
+
assert credit = @gateway.credit(@amount, purchase.authorization)
|
|
43
|
+
assert_success credit
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_failed_purchase
|
|
47
|
+
assert response = @gateway.purchase(@amount, @creditcard, @options.update(:test_result => 'D'))
|
|
48
|
+
assert_failure response
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
# Author:: MoneySpyder, http://moneyspyder.co.uk
|
|
2
2
|
|
|
3
|
-
require File.dirname(__FILE__) + '
|
|
3
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
4
4
|
|
|
5
5
|
class RemotePslCardTest < Test::Unit::TestCase
|
|
6
|
-
|
|
7
|
-
ACCEPT_AMOUNT = 1000
|
|
8
|
-
REFERRED_AMOUNT = 6000
|
|
9
|
-
DECLINED_AMOUNT = 11000
|
|
10
|
-
KEEP_CARD_AMOUNT = 15000
|
|
11
|
-
|
|
6
|
+
|
|
12
7
|
def setup
|
|
13
8
|
@gateway = PslCardGateway.new(fixtures(:psl_card))
|
|
14
9
|
|
|
@@ -20,19 +15,25 @@ class RemotePslCardTest < Test::Unit::TestCase
|
|
|
20
15
|
|
|
21
16
|
@visa = CreditCard.new(fixtures(:psl_visa))
|
|
22
17
|
@visa_address = fixtures(:psl_visa_address)
|
|
18
|
+
|
|
19
|
+
# The test results are determined by the amount of the transaction
|
|
20
|
+
@accept_amount = 1000
|
|
21
|
+
@referred_amount = 6000
|
|
22
|
+
@declined_amount = 11000
|
|
23
|
+
@keep_card_amount = 15000
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
def test_successful_visa_purchase
|
|
26
|
-
response = @gateway.purchase(
|
|
27
|
-
:
|
|
27
|
+
response = @gateway.purchase(@accept_amount, @visa,
|
|
28
|
+
:billing_address => @visa_address
|
|
28
29
|
)
|
|
29
30
|
assert_success response
|
|
30
31
|
assert response.test?
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
def test_successful_visa_purchase_specifying_currency
|
|
34
|
-
response = @gateway.purchase(
|
|
35
|
-
:
|
|
35
|
+
response = @gateway.purchase(@accept_amount, @visa,
|
|
36
|
+
:billing_address => @visa_address,
|
|
36
37
|
:currency => 'GBP'
|
|
37
38
|
)
|
|
38
39
|
assert_success response
|
|
@@ -40,40 +41,40 @@ class RemotePslCardTest < Test::Unit::TestCase
|
|
|
40
41
|
end
|
|
41
42
|
|
|
42
43
|
def test_successful_solo_purchase
|
|
43
|
-
response = @gateway.purchase(
|
|
44
|
-
:
|
|
44
|
+
response = @gateway.purchase(@accept_amount, @solo,
|
|
45
|
+
:billing_address => @solo_address
|
|
45
46
|
)
|
|
46
47
|
assert_success response
|
|
47
48
|
assert response.test?
|
|
48
49
|
end
|
|
49
50
|
|
|
50
51
|
def test_referred_purchase
|
|
51
|
-
response = @gateway.purchase(
|
|
52
|
-
:
|
|
52
|
+
response = @gateway.purchase(@referred_amount, @uk_maestro,
|
|
53
|
+
:billing_address => @uk_maestro_address
|
|
53
54
|
)
|
|
54
55
|
assert_failure response
|
|
55
56
|
assert response.test?
|
|
56
57
|
end
|
|
57
58
|
|
|
58
59
|
def test_declined_purchase
|
|
59
|
-
response = @gateway.purchase(
|
|
60
|
-
:
|
|
60
|
+
response = @gateway.purchase(@declined_amount, @uk_maestro,
|
|
61
|
+
:billing_address => @uk_maestro_address
|
|
61
62
|
)
|
|
62
63
|
assert_failure response
|
|
63
64
|
assert response.test?
|
|
64
65
|
end
|
|
65
66
|
|
|
66
67
|
def test_declined_keep_card_purchase
|
|
67
|
-
response = @gateway.purchase(
|
|
68
|
-
:
|
|
68
|
+
response = @gateway.purchase(@keep_card_amount, @uk_maestro,
|
|
69
|
+
:billing_address => @uk_maestro_address
|
|
69
70
|
)
|
|
70
71
|
assert_failure response
|
|
71
72
|
assert response.test?
|
|
72
73
|
end
|
|
73
74
|
|
|
74
75
|
def test_successful_authorization
|
|
75
|
-
response = @gateway.authorize(
|
|
76
|
-
:
|
|
76
|
+
response = @gateway.authorize(@accept_amount, @uk_maestro,
|
|
77
|
+
:billing_address => @uk_maestro_address
|
|
77
78
|
)
|
|
78
79
|
assert_success response
|
|
79
80
|
assert response.test?
|
|
@@ -83,21 +84,21 @@ class RemotePslCardTest < Test::Unit::TestCase
|
|
|
83
84
|
@gateway = PslCardGateway.new(
|
|
84
85
|
:login => ''
|
|
85
86
|
)
|
|
86
|
-
response = @gateway.authorize(
|
|
87
|
-
:
|
|
87
|
+
response = @gateway.authorize(@accept_amount, @uk_maestro,
|
|
88
|
+
:billing_address => @uk_maestro_address
|
|
88
89
|
)
|
|
89
90
|
assert_failure response
|
|
90
91
|
assert response.test?
|
|
91
92
|
end
|
|
92
93
|
|
|
93
94
|
def test_successful_authorization_and_capture
|
|
94
|
-
authorization = @gateway.authorize(
|
|
95
|
-
:
|
|
95
|
+
authorization = @gateway.authorize(@accept_amount, @uk_maestro,
|
|
96
|
+
:billing_address => @uk_maestro_address
|
|
96
97
|
)
|
|
97
98
|
assert_success authorization
|
|
98
99
|
assert authorization.test?
|
|
99
100
|
|
|
100
|
-
capture = @gateway.capture(
|
|
101
|
+
capture = @gateway.capture(@accept_amount, authorization.authorization)
|
|
101
102
|
|
|
102
103
|
assert_success capture
|
|
103
104
|
assert capture.test?
|