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,16 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
2
|
|
|
3
3
|
class RemoteQuickpayTest < Test::Unit::TestCase
|
|
4
|
-
|
|
5
|
-
# 100 cents
|
|
6
|
-
AMOUNT = 100
|
|
7
|
-
|
|
8
|
-
def setup
|
|
9
|
-
|
|
4
|
+
def setup
|
|
10
5
|
@gateway = QuickpayGateway.new(fixtures(:quickpay))
|
|
6
|
+
|
|
7
|
+
@amount = 100
|
|
8
|
+
@options = {
|
|
9
|
+
:order_id => generate_unique_id,
|
|
10
|
+
:billing_address => address
|
|
11
|
+
}
|
|
11
12
|
|
|
12
|
-
@
|
|
13
|
+
@visa_no_cvv2 = credit_card('4000300011112220', :verification_value => nil)
|
|
13
14
|
@visa = credit_card('4000100011112224')
|
|
14
15
|
@dankort = credit_card('5019717010103742')
|
|
15
16
|
@visa_dankort = credit_card('4571100000000000')
|
|
@@ -27,7 +28,7 @@ class RemoteQuickpayTest < Test::Unit::TestCase
|
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def test_successful_purchase
|
|
30
|
-
assert response = @gateway.purchase(
|
|
31
|
+
assert response = @gateway.purchase(@amount, @visa, @options)
|
|
31
32
|
assert_equal 'OK', response.message
|
|
32
33
|
assert_equal 'DKK', response.params['currency']
|
|
33
34
|
assert_success response
|
|
@@ -35,116 +36,115 @@ class RemoteQuickpayTest < Test::Unit::TestCase
|
|
|
35
36
|
end
|
|
36
37
|
|
|
37
38
|
def test_successful_usd_purchase
|
|
38
|
-
assert response = @gateway.purchase(
|
|
39
|
+
assert response = @gateway.purchase(@amount, @visa, @options.update(:currency => 'USD'))
|
|
39
40
|
assert_equal 'OK', response.message
|
|
40
41
|
assert_equal 'USD', response.params['currency']
|
|
41
42
|
assert_success response
|
|
42
43
|
assert !response.authorization.blank?
|
|
43
44
|
end
|
|
44
45
|
|
|
45
|
-
def
|
|
46
|
-
assert response = @gateway.authorize(
|
|
46
|
+
def test_successful_dankort_authorization
|
|
47
|
+
assert response = @gateway.authorize(@amount, @dankort, @options)
|
|
47
48
|
assert_success response
|
|
48
49
|
assert !response.authorization.blank?
|
|
49
50
|
assert_equal 'Dankort', response.params['cardtype']
|
|
50
51
|
end
|
|
51
52
|
|
|
52
|
-
def
|
|
53
|
-
assert response = @gateway.authorize(
|
|
53
|
+
def test_successful_visa_dankort_authorization
|
|
54
|
+
assert response = @gateway.authorize(@amount, @visa_dankort, @options)
|
|
54
55
|
assert_success response
|
|
55
56
|
assert !response.authorization.blank?
|
|
56
57
|
assert_equal 'Visa-Dankort', response.params['cardtype']
|
|
57
58
|
end
|
|
58
59
|
|
|
59
|
-
def
|
|
60
|
-
assert response = @gateway.authorize(
|
|
60
|
+
def test_successful_visa_electron_authorization
|
|
61
|
+
assert response = @gateway.authorize(@amount, @electron_dk, @options)
|
|
61
62
|
assert_success response
|
|
62
63
|
assert !response.authorization.blank?
|
|
63
64
|
assert_equal 'Visa-Electron-DK', response.params['cardtype']
|
|
64
65
|
end
|
|
65
66
|
|
|
66
|
-
def
|
|
67
|
-
assert response = @gateway.authorize(
|
|
67
|
+
def test_successful_diners_club_authorization
|
|
68
|
+
assert response = @gateway.authorize(@amount, @diners_club, @options)
|
|
68
69
|
assert_success response
|
|
69
70
|
assert !response.authorization.blank?
|
|
70
71
|
assert_equal 'Diners', response.params['cardtype']
|
|
71
72
|
end
|
|
72
73
|
|
|
73
|
-
def
|
|
74
|
-
assert response = @gateway.authorize(
|
|
74
|
+
def test_successful_diners_club_dk_authorization
|
|
75
|
+
assert response = @gateway.authorize(@amount, @diners_club_dk, @options)
|
|
75
76
|
assert_success response
|
|
76
77
|
assert !response.authorization.blank?
|
|
77
78
|
assert_equal 'Diners', response.params['cardtype']
|
|
78
79
|
end
|
|
79
80
|
|
|
80
|
-
def
|
|
81
|
-
assert response = @gateway.authorize(
|
|
81
|
+
def test_successful_maestro_authorization
|
|
82
|
+
assert response = @gateway.authorize(@amount, @maestro, @options)
|
|
82
83
|
assert_success response
|
|
83
84
|
assert !response.authorization.blank?
|
|
84
85
|
assert_equal 'Maestro', response.params['cardtype']
|
|
85
86
|
end
|
|
86
87
|
|
|
87
|
-
def
|
|
88
|
-
assert response = @gateway.authorize(
|
|
88
|
+
def test_successful_maestro_dk_authorization
|
|
89
|
+
assert response = @gateway.authorize(@amount, @maestro_dk, @options)
|
|
89
90
|
assert_success response
|
|
90
91
|
assert !response.authorization.blank?
|
|
91
92
|
assert_equal 'Maestro', response.params['cardtype']
|
|
92
93
|
end
|
|
93
94
|
|
|
94
|
-
def
|
|
95
|
-
assert response = @gateway.authorize(
|
|
95
|
+
def test_successful_mastercard_dk_authorization
|
|
96
|
+
assert response = @gateway.authorize(@amount, @mastercard_dk, @options)
|
|
96
97
|
assert_success response
|
|
97
98
|
assert !response.authorization.blank?
|
|
98
99
|
assert_equal 'MasterCard-DK', response.params['cardtype']
|
|
99
100
|
end
|
|
100
101
|
|
|
101
|
-
def
|
|
102
|
-
assert response = @gateway.authorize(
|
|
102
|
+
def test_successful_american_express_dk_authorization
|
|
103
|
+
assert response = @gateway.authorize(@amount, @amex_dk, @options)
|
|
103
104
|
assert_success response
|
|
104
105
|
assert !response.authorization.blank?
|
|
105
106
|
assert_equal 'AmericanExpress-DK', response.params['cardtype']
|
|
106
107
|
end
|
|
107
108
|
|
|
108
|
-
def
|
|
109
|
-
assert response = @gateway.authorize(
|
|
109
|
+
def test_successful_american_express_authorization
|
|
110
|
+
assert response = @gateway.authorize(@amount, @amex, @options)
|
|
110
111
|
assert_success response
|
|
111
112
|
assert !response.authorization.blank?
|
|
112
113
|
assert_equal 'AmericanExpress', response.params['cardtype']
|
|
113
114
|
end
|
|
114
115
|
|
|
115
|
-
def
|
|
116
|
-
assert response = @gateway.authorize(
|
|
116
|
+
def test_successful_forbrugsforeningen_authorization
|
|
117
|
+
assert response = @gateway.authorize(@amount, @forbrugsforeningen, @options)
|
|
117
118
|
assert_success response
|
|
118
119
|
assert !response.authorization.blank?
|
|
119
120
|
assert_equal 'FBG-1886', response.params['cardtype']
|
|
120
121
|
end
|
|
121
122
|
|
|
122
123
|
def test_unsuccessful_purchase_with_missing_cvv2
|
|
123
|
-
assert response = @gateway.purchase(
|
|
124
|
+
assert response = @gateway.purchase(@amount, @visa_no_cvv2, @options)
|
|
124
125
|
assert_equal 'Missing/error in card verification data', response.message
|
|
125
126
|
assert_failure response
|
|
126
127
|
assert response.authorization.blank?
|
|
127
128
|
end
|
|
128
129
|
|
|
129
|
-
def
|
|
130
|
-
|
|
131
|
-
assert auth = @gateway.authorize(amount, @visa, :order_id => generate_order_id)
|
|
130
|
+
def test_successful_authorize_and_capture
|
|
131
|
+
assert auth = @gateway.authorize(@amount, @visa, @options)
|
|
132
132
|
assert_success auth
|
|
133
133
|
assert_equal 'OK', auth.message
|
|
134
134
|
assert auth.authorization
|
|
135
|
-
assert capture = @gateway.capture(amount, auth.authorization)
|
|
135
|
+
assert capture = @gateway.capture(@amount, auth.authorization)
|
|
136
136
|
assert_success capture
|
|
137
137
|
assert_equal 'OK', capture.message
|
|
138
138
|
end
|
|
139
139
|
|
|
140
140
|
def test_failed_capture
|
|
141
|
-
assert response = @gateway.capture(
|
|
141
|
+
assert response = @gateway.capture(@amount, '')
|
|
142
142
|
assert_failure response
|
|
143
143
|
assert_equal 'Missing/error in transaction number', response.message
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
-
def
|
|
147
|
-
assert auth = @gateway.authorize(
|
|
146
|
+
def test_successful_purchase_and_void
|
|
147
|
+
assert auth = @gateway.authorize(@amount, @visa, @options)
|
|
148
148
|
assert_success auth
|
|
149
149
|
assert_equal 'OK', auth.message
|
|
150
150
|
assert auth.authorization
|
|
@@ -153,20 +153,20 @@ class RemoteQuickpayTest < Test::Unit::TestCase
|
|
|
153
153
|
assert_equal 'OK', void.message
|
|
154
154
|
end
|
|
155
155
|
|
|
156
|
-
def
|
|
157
|
-
assert auth = @gateway.authorize(
|
|
156
|
+
def test_successful_authorization_capture_and_credit
|
|
157
|
+
assert auth = @gateway.authorize(@amount, @visa, @options)
|
|
158
158
|
assert_success auth
|
|
159
|
-
assert capture = @gateway.capture(
|
|
159
|
+
assert capture = @gateway.capture(@amount, auth.authorization)
|
|
160
160
|
assert_success capture
|
|
161
|
-
assert credit = @gateway.credit(
|
|
161
|
+
assert credit = @gateway.credit(@amount, auth.authorization)
|
|
162
162
|
assert_success credit
|
|
163
163
|
assert_equal 'OK', credit.message
|
|
164
164
|
end
|
|
165
165
|
|
|
166
|
-
def
|
|
167
|
-
assert purchase = @gateway.purchase(
|
|
166
|
+
def test_successful_purchase_and_credit
|
|
167
|
+
assert purchase = @gateway.purchase(@amount, @visa, @options)
|
|
168
168
|
assert_success purchase
|
|
169
|
-
assert credit = @gateway.credit(
|
|
169
|
+
assert credit = @gateway.credit(@amount, purchase.authorization)
|
|
170
170
|
assert_success credit
|
|
171
171
|
end
|
|
172
172
|
|
|
@@ -175,7 +175,7 @@ class RemoteQuickpayTest < Test::Unit::TestCase
|
|
|
175
175
|
:login => '',
|
|
176
176
|
:password => ''
|
|
177
177
|
)
|
|
178
|
-
assert response = gateway.purchase(
|
|
178
|
+
assert response = gateway.purchase(@amount, @visa, @options)
|
|
179
179
|
assert_equal 'Missing/error in merchant', response.message
|
|
180
180
|
assert_failure response
|
|
181
181
|
end
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
2
|
|
|
3
3
|
class RemoteRealexTest < Test::Unit::TestCase
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
|
|
6
5
|
def setup
|
|
7
6
|
@gateway = RealexGateway.new(fixtures(:realex))
|
|
8
7
|
|
|
@@ -20,17 +19,15 @@ class RemoteRealexTest < Test::Unit::TestCase
|
|
|
20
19
|
@mastercard_referral_b = fixtures(:realex_mastercard_referral_b)
|
|
21
20
|
@mastercard_referral_a = fixtures(:realex_mastercard_referral_a)
|
|
22
21
|
@mastercard_coms_error = fixtures(:realex_mastercard_coms_error)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def test_nothing
|
|
26
|
-
assert true
|
|
22
|
+
|
|
23
|
+
@amount = 10000
|
|
27
24
|
end
|
|
28
25
|
|
|
29
26
|
def test_realex_purchase
|
|
30
27
|
[ @visa, @mastercard ].each do |card|
|
|
31
28
|
|
|
32
|
-
response = @gateway.purchase(
|
|
33
|
-
:order_id =>
|
|
29
|
+
response = @gateway.purchase(@amount, card,
|
|
30
|
+
:order_id => generate_unique_id,
|
|
34
31
|
:description => 'Test Realex Purchase',
|
|
35
32
|
:billing_address => {
|
|
36
33
|
:zip => '90210',
|
|
@@ -50,8 +47,8 @@ class RemoteRealexTest < Test::Unit::TestCase
|
|
|
50
47
|
:login => 'invalid',
|
|
51
48
|
:password => 'invalid'
|
|
52
49
|
)
|
|
53
|
-
response = gateway.purchase(
|
|
54
|
-
:order_id =>
|
|
50
|
+
response = gateway.purchase(@amount, @visa,
|
|
51
|
+
:order_id => generate_unique_id,
|
|
55
52
|
:description => 'Invalid login test'
|
|
56
53
|
)
|
|
57
54
|
|
|
@@ -65,8 +62,8 @@ class RemoteRealexTest < Test::Unit::TestCase
|
|
|
65
62
|
|
|
66
63
|
def test_realex_purchase_with_invalid_account
|
|
67
64
|
|
|
68
|
-
response = @gateway_with_account.purchase(
|
|
69
|
-
:order_id =>
|
|
65
|
+
response = @gateway_with_account.purchase(@amount, @visa,
|
|
66
|
+
:order_id => generate_unique_id,
|
|
70
67
|
:description => 'Test Realex purchase with invalid acocunt'
|
|
71
68
|
)
|
|
72
69
|
|
|
@@ -82,8 +79,8 @@ class RemoteRealexTest < Test::Unit::TestCase
|
|
|
82
79
|
|
|
83
80
|
[ @visa_declined, @mastercard_declined ].each do |card|
|
|
84
81
|
|
|
85
|
-
response = @gateway.purchase(
|
|
86
|
-
:order_id =>
|
|
82
|
+
response = @gateway.purchase(@amount, card,
|
|
83
|
+
:order_id => generate_unique_id,
|
|
87
84
|
:description => 'Test Realex purchase declined'
|
|
88
85
|
)
|
|
89
86
|
assert_not_nil response
|
|
@@ -98,8 +95,8 @@ class RemoteRealexTest < Test::Unit::TestCase
|
|
|
98
95
|
def test_realex_purchase_referral_b
|
|
99
96
|
[ @visa_referral_b, @mastercard_referral_b ].each do |card|
|
|
100
97
|
|
|
101
|
-
response = @gateway.purchase(
|
|
102
|
-
:order_id =>
|
|
98
|
+
response = @gateway.purchase(@amount, card,
|
|
99
|
+
:order_id => generate_unique_id,
|
|
103
100
|
:description => 'Test Realex Referral B'
|
|
104
101
|
)
|
|
105
102
|
assert_not_nil response
|
|
@@ -113,8 +110,8 @@ class RemoteRealexTest < Test::Unit::TestCase
|
|
|
113
110
|
def test_realex_purchase_referral_a
|
|
114
111
|
[ @visa_referral_a, @mastercard_referral_a ].each do |card|
|
|
115
112
|
|
|
116
|
-
response = @gateway.purchase(
|
|
117
|
-
:order_id =>
|
|
113
|
+
response = @gateway.purchase(@amount, card,
|
|
114
|
+
:order_id => generate_unique_id,
|
|
118
115
|
:description => 'Test Realex Rqeferral A'
|
|
119
116
|
)
|
|
120
117
|
assert_not_nil response
|
|
@@ -129,8 +126,8 @@ class RemoteRealexTest < Test::Unit::TestCase
|
|
|
129
126
|
|
|
130
127
|
[ @visa_coms_error, @mastercard_coms_error ].each do |card|
|
|
131
128
|
|
|
132
|
-
response = @gateway.purchase(
|
|
133
|
-
:order_id =>
|
|
129
|
+
response = @gateway.purchase(@amount, card,
|
|
130
|
+
:order_id => generate_unique_id,
|
|
134
131
|
:description => 'Test Realex coms error'
|
|
135
132
|
)
|
|
136
133
|
|
|
@@ -146,8 +143,8 @@ class RemoteRealexTest < Test::Unit::TestCase
|
|
|
146
143
|
def test_realex_ccn_error
|
|
147
144
|
@visa.number = 5
|
|
148
145
|
|
|
149
|
-
response = @gateway.purchase(
|
|
150
|
-
:order_id =>
|
|
146
|
+
response = @gateway.purchase(@amount, @visa,
|
|
147
|
+
:order_id => generate_unique_id,
|
|
151
148
|
:description => 'Test Realex ccn error'
|
|
152
149
|
)
|
|
153
150
|
assert_not_nil response
|
|
@@ -161,8 +158,8 @@ class RemoteRealexTest < Test::Unit::TestCase
|
|
|
161
158
|
def test_realex_expiry_month_error
|
|
162
159
|
@visa.month = 13
|
|
163
160
|
|
|
164
|
-
response = @gateway.purchase(
|
|
165
|
-
:order_id =>
|
|
161
|
+
response = @gateway.purchase(@amount, @visa,
|
|
162
|
+
:order_id => generate_unique_id,
|
|
166
163
|
:description => 'Test Realex expiry month error'
|
|
167
164
|
)
|
|
168
165
|
assert_not_nil response
|
|
@@ -176,8 +173,8 @@ class RemoteRealexTest < Test::Unit::TestCase
|
|
|
176
173
|
def test_realex_expiry_year_error
|
|
177
174
|
@visa.year = 2005
|
|
178
175
|
|
|
179
|
-
response = @gateway.purchase(
|
|
180
|
-
:order_id =>
|
|
176
|
+
response = @gateway.purchase(@amount, @visa,
|
|
177
|
+
:order_id => generate_unique_id,
|
|
181
178
|
:description => 'Test Realex expiry year error'
|
|
182
179
|
)
|
|
183
180
|
assert_not_nil response
|
|
@@ -191,8 +188,8 @@ class RemoteRealexTest < Test::Unit::TestCase
|
|
|
191
188
|
@visa.first_name = ""
|
|
192
189
|
@visa.last_name = ""
|
|
193
190
|
|
|
194
|
-
response = @gateway.purchase(
|
|
195
|
-
:order_id =>
|
|
191
|
+
response = @gateway.purchase(@amount, @visa,
|
|
192
|
+
:order_id => generate_unique_id,
|
|
196
193
|
:description => 'test_chname_error'
|
|
197
194
|
)
|
|
198
195
|
assert_not_nil response
|
|
@@ -205,8 +202,8 @@ class RemoteRealexTest < Test::Unit::TestCase
|
|
|
205
202
|
def test_cvn
|
|
206
203
|
@visa_cvn = @visa.clone
|
|
207
204
|
@visa_cvn.verification_value = "111"
|
|
208
|
-
response = @gateway.purchase(
|
|
209
|
-
:order_id =>
|
|
205
|
+
response = @gateway.purchase(@amount, @visa_cvn,
|
|
206
|
+
:order_id => generate_unique_id,
|
|
210
207
|
:description => 'test_cvn'
|
|
211
208
|
)
|
|
212
209
|
assert_not_nil response
|
|
@@ -215,8 +212,8 @@ class RemoteRealexTest < Test::Unit::TestCase
|
|
|
215
212
|
end
|
|
216
213
|
|
|
217
214
|
def test_customer_number
|
|
218
|
-
response = @gateway.purchase(
|
|
219
|
-
:order_id =>
|
|
215
|
+
response = @gateway.purchase(@amount, @visa,
|
|
216
|
+
:order_id => generate_unique_id,
|
|
220
217
|
:description => 'test_cust_num',
|
|
221
218
|
:customer => 'my customer id'
|
|
222
219
|
)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
|
+
|
|
3
|
+
class RemoteSecurePayTechTest < Test::Unit::TestCase
|
|
4
|
+
$verbose = true
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
@gateway = SecurePayTechGateway.new(fixtures(:secure_pay_tech))
|
|
8
|
+
|
|
9
|
+
@accepted_amount = 10000
|
|
10
|
+
@declined_amount = 10075
|
|
11
|
+
|
|
12
|
+
@credit_card = credit_card('4987654321098769', :month => '5', :year => '2013')
|
|
13
|
+
@options = { :billing_address => address }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_successful_purchase
|
|
17
|
+
assert response = @gateway.purchase(@accepted_amount, @credit_card, @options)
|
|
18
|
+
assert_equal 'Transaction OK', response.message
|
|
19
|
+
assert_success response
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_unsuccessful_purchase
|
|
23
|
+
assert response = @gateway.purchase(@declined_amount, @credit_card, @options)
|
|
24
|
+
assert_equal 'Card declined', response.message
|
|
25
|
+
assert_failure response
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_invalid_login
|
|
29
|
+
gateway = SecurePayTechGateway.new(
|
|
30
|
+
:login => 'foo',
|
|
31
|
+
:password => 'bar'
|
|
32
|
+
)
|
|
33
|
+
assert response = gateway.purchase(@accepted_amount, @credit_card, @options)
|
|
34
|
+
assert_equal 'Bad or malformed request', response.message
|
|
35
|
+
assert_failure response
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
|
+
|
|
3
|
+
class RemoteSecurePayTest < Test::Unit::TestCase
|
|
4
|
+
|
|
5
|
+
def setup
|
|
6
|
+
@gateway = SecurePayGateway.new(fixtures(:secure_pay))
|
|
7
|
+
|
|
8
|
+
@credit_card = credit_card('4111111111111111',
|
|
9
|
+
:month => '7',
|
|
10
|
+
:year => '2007'
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
@options = { :order_id => generate_unique_id,
|
|
14
|
+
:description => 'Store purchase',
|
|
15
|
+
:billing_address => address
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@amount = 100
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_successful_purchase
|
|
22
|
+
assert response = @gateway.purchase(@amount, @credit_card, @options)
|
|
23
|
+
assert response.success?
|
|
24
|
+
assert response.test?
|
|
25
|
+
assert_equal 'This transaction has been approved', response.message
|
|
26
|
+
assert response.authorization
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
|
2
|
+
|
|
3
|
+
class RemoteSkipJackTest < Test::Unit::TestCase
|
|
4
|
+
def setup
|
|
5
|
+
Base.mode = :test
|
|
6
|
+
|
|
7
|
+
@gateway = SkipJackGateway.new(fixtures(:skip_jack))
|
|
8
|
+
|
|
9
|
+
@credit_card = credit_card('4445999922225',
|
|
10
|
+
:verification_value => '999'
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
@amount = 100
|
|
14
|
+
|
|
15
|
+
@options = {
|
|
16
|
+
:order_id => generate_unique_id,
|
|
17
|
+
:email => 'email@foo.com',
|
|
18
|
+
:billing_address => address
|
|
19
|
+
}
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_successful_authorization
|
|
23
|
+
authorization = @gateway.authorize(@amount, @credit_card, @options)
|
|
24
|
+
assert_success authorization
|
|
25
|
+
assert_false authorization.authorization.blank?
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_unsuccessful_authorization
|
|
29
|
+
@credit_card.number = '1234'
|
|
30
|
+
authorization = @gateway.authorize(@amount, @credit_card, @options)
|
|
31
|
+
assert_failure authorization
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def test_authorization_fails_without_phone_number
|
|
35
|
+
@options[:billing_address][:phone] = nil
|
|
36
|
+
authorization = @gateway.authorize(@amount, @credit_card, @options)
|
|
37
|
+
assert_failure authorization
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def test_successful_purchase
|
|
41
|
+
assert_success @gateway.purchase(@amount, @credit_card, @options)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_successful_authorization_and_capture
|
|
45
|
+
authorization = @gateway.authorize(@amount, @credit_card, @options)
|
|
46
|
+
|
|
47
|
+
assert_success authorization
|
|
48
|
+
assert_false authorization.authorization.blank?
|
|
49
|
+
|
|
50
|
+
capture = @gateway.capture(@amount, authorization.authorization)
|
|
51
|
+
assert_success capture
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def test_authorization_and_void
|
|
55
|
+
authorization = @gateway.authorize(101, @credit_card, @options)
|
|
56
|
+
assert_success authorization
|
|
57
|
+
void = @gateway.void(authorization.authorization)
|
|
58
|
+
assert_success void
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def test_successful_authorization_and_credit
|
|
62
|
+
authorization = @gateway.authorize(@amount, @credit_card, @options)
|
|
63
|
+
assert_success authorization
|
|
64
|
+
|
|
65
|
+
capture = @gateway.capture(@amount, authorization.authorization, :force_settlement => true)
|
|
66
|
+
assert_success capture
|
|
67
|
+
|
|
68
|
+
# developer login won't change transaction immediately to settled, so status will have to mismatch
|
|
69
|
+
credit = @gateway.credit(@amount, authorization.authorization)
|
|
70
|
+
assert_success credit
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def test_authorization_with_invalid_verification_value
|
|
74
|
+
@credit_card.verification_value = '123'
|
|
75
|
+
|
|
76
|
+
response = @gateway.authorize(@amount, @credit_card, @options)
|
|
77
|
+
assert_failure response
|
|
78
|
+
assert_equal "Card verification number didn't match", response.message
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def test_authorization_and_status
|
|
82
|
+
authorization = @gateway.authorize(101, @credit_card, @options)
|
|
83
|
+
assert_success authorization
|
|
84
|
+
|
|
85
|
+
status = @gateway.status(@options[:order_id])
|
|
86
|
+
assert_success status
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def test_status_unkown_order
|
|
90
|
+
status = @gateway.status(generate_unique_id)
|
|
91
|
+
assert_failure status
|
|
92
|
+
assert_match /No Records Found/, status.message
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def test_invalid_login
|
|
96
|
+
gateway = SkipJackGateway.new(
|
|
97
|
+
:login => '555555555555',
|
|
98
|
+
:password => '999999999999'
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
response = gateway.authorize(@amount, @credit_card, @options)
|
|
102
|
+
assert_failure response
|
|
103
|
+
assert_match /Invalid serial number/, response.message
|
|
104
|
+
end
|
|
105
|
+
end
|