activemerchant 1.1.0 → 1.2.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 +226 -0
- data/CONTRIBUTERS +52 -0
- data/README +34 -24
- data/Rakefile +152 -0
- data/gem-public_cert.pem +20 -0
- data/init.rb +3 -0
- data/lib/active_merchant.rb +3 -1
- data/lib/active_merchant/billing/credit_card.rb +21 -17
- data/lib/active_merchant/billing/credit_card_methods.rb +17 -19
- data/lib/active_merchant/billing/gateway.rb +160 -44
- data/lib/active_merchant/billing/gateways.rb +2 -15
- data/lib/active_merchant/billing/gateways/authorize_net.rb +21 -21
- data/lib/active_merchant/billing/gateways/bogus.rb +6 -6
- data/lib/active_merchant/billing/gateways/brain_tree.rb +191 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +207 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +402 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +41 -97
- data/lib/active_merchant/billing/gateways/efsnet.rb +256 -0
- data/lib/active_merchant/billing/gateways/eway.rb +77 -29
- data/lib/active_merchant/billing/gateways/exact.rb +230 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +6 -33
- data/lib/active_merchant/billing/gateways/moneris.rb +155 -125
- data/lib/active_merchant/billing/gateways/net_registry.rb +257 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +407 -0
- data/lib/active_merchant/billing/gateways/payflow.rb +163 -25
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +56 -38
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +10 -1
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +9 -0
- data/lib/active_merchant/billing/gateways/payflow_express.rb +36 -11
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +6 -0
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +7 -3
- data/lib/active_merchant/billing/gateways/payment_express.rb +261 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +18 -4
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +31 -15
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +8 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +33 -8
- data/lib/active_merchant/billing/gateways/plugnpay.rb +300 -0
- data/lib/active_merchant/billing/gateways/protx.rb +285 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +13 -12
- data/lib/active_merchant/billing/gateways/psl_card.rb +297 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +197 -0
- data/lib/active_merchant/billing/gateways/realex.rb +212 -0
- data/lib/active_merchant/billing/gateways/secure_pay.rb +31 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +136 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +43 -20
- data/lib/active_merchant/billing/gateways/usa_epay.rb +6 -5
- data/lib/active_merchant/billing/gateways/verifi.rb +235 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +171 -0
- data/lib/active_merchant/billing/integrations/gestpay/helper.rb +0 -2
- data/lib/active_merchant/billing/integrations/helper.rb +8 -1
- data/lib/active_merchant/billing/integrations/nochex.rb +62 -1
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +9 -16
- data/lib/active_merchant/billing/integrations/notification.rb +1 -1
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +59 -46
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +14 -47
- data/lib/active_merchant/lib/error.rb +4 -0
- data/lib/active_merchant/lib/post_data.rb +22 -0
- data/lib/active_merchant/lib/posts_data.rb +23 -5
- data/lib/active_merchant/lib/requires_parameters.rb +2 -2
- data/lib/active_merchant/lib/validateable.rb +1 -1
- data/lib/support/gateway_support.rb +45 -0
- data/lib/tasks/cia.rb +1 -1
- data/script/generate +14 -0
- data/script/generator/base.rb +45 -0
- data/script/generator/generator.rb +24 -0
- data/script/generator/generators/gateway/gateway_generator.rb +14 -0
- data/script/generator/generators/gateway/templates/gateway.rb +73 -0
- data/script/generator/generators/gateway/templates/gateway_test.rb +41 -0
- data/script/generator/generators/gateway/templates/remote_gateway_test.rb +56 -0
- data/script/generator/generators/integration/integration_generator.rb +25 -0
- data/script/generator/generators/integration/templates/helper.rb +34 -0
- data/script/generator/generators/integration/templates/helper_test.rb +54 -0
- data/script/generator/generators/integration/templates/integration.rb +18 -0
- data/script/generator/generators/integration/templates/module_test.rb +9 -0
- data/script/generator/generators/integration/templates/notification.rb +100 -0
- data/script/generator/generators/integration/templates/notification_test.rb +41 -0
- data/script/generator/manifest.rb +20 -0
- data/test/extra/binding_of_caller.rb +80 -0
- data/test/extra/breakpoint.rb +547 -0
- data/test/fixtures.yml +251 -0
- data/test/remote_tests/remote_authorize_net_test.rb +113 -0
- data/test/remote_tests/remote_brain_tree_test.rb +78 -0
- data/test/remote_tests/remote_card_stream_test.rb +160 -0
- data/test/remote_tests/remote_cyber_source_test.rb +130 -0
- data/test/remote_tests/remote_data_cash_test.rb +155 -0
- data/test/remote_tests/remote_efsnet_test.rb +93 -0
- data/test/remote_tests/remote_eway_test.rb +71 -0
- data/test/remote_tests/remote_exact_test.rb +59 -0
- data/test/remote_tests/remote_gestpay_integration_test.rb +37 -0
- data/test/remote_tests/remote_linkpoint_test.rb +144 -0
- data/test/remote_tests/remote_moneris_test.rb +110 -0
- data/test/remote_tests/remote_net_registry_test.rb +120 -0
- data/test/remote_tests/remote_pay_junction_test.rb +162 -0
- data/test/remote_tests/remote_payflow_express_test.rb +50 -0
- data/test/remote_tests/remote_payflow_test.rb +241 -0
- data/test/remote_tests/remote_payflow_uk_test.rb +172 -0
- data/test/remote_tests/remote_payment_express_test.rb +136 -0
- data/test/remote_tests/remote_paypal_express_test.rb +49 -0
- data/test/remote_tests/remote_paypal_integration_test.rb +14 -0
- data/test/remote_tests/remote_paypal_test.rb +163 -0
- data/test/remote_tests/remote_plugnpay_test.rb +70 -0
- data/test/remote_tests/remote_protx_test.rb +184 -0
- data/test/remote_tests/remote_psigate_test.rb +87 -0
- data/test/remote_tests/remote_psl_card_test.rb +105 -0
- data/test/remote_tests/remote_quickpay_test.rb +182 -0
- data/test/remote_tests/remote_realex_test.rb +227 -0
- data/test/remote_tests/remote_secure_pay_test.rb +36 -0
- data/test/remote_tests/remote_trans_first_test.rb +37 -0
- data/test/remote_tests/remote_trust_commerce_test.rb +136 -0
- data/test/remote_tests/remote_usa_epay_test.rb +57 -0
- data/test/remote_tests/remote_verifi_test.rb +107 -0
- data/test/remote_tests/remote_viaklix_test.rb +53 -0
- data/test/test_helper.rb +132 -0
- data/test/unit/base_test.rb +61 -0
- data/test/unit/country_code_test.rb +33 -0
- data/test/unit/country_test.rb +64 -0
- data/test/unit/credit_card_formatting_test.rb +24 -0
- data/test/unit/credit_card_methods_test.rb +37 -0
- data/test/unit/credit_card_test.rb +365 -0
- data/test/unit/gateways/authorize_net_test.rb +140 -0
- data/test/unit/gateways/bogus_test.rb +43 -0
- data/test/unit/gateways/brain_tree_test.rb +77 -0
- data/test/unit/gateways/card_stream_test.rb +37 -0
- data/test/unit/gateways/cyber_source_test.rb +151 -0
- data/test/unit/gateways/data_cash_test.rb +23 -0
- data/test/unit/gateways/efsnet_test.rb +70 -0
- data/test/unit/gateways/eway_test.rb +105 -0
- data/test/unit/gateways/exact_test.rb +118 -0
- data/test/unit/gateways/gateway_test.rb +24 -0
- data/test/unit/gateways/linkpoint_test.rb +165 -0
- data/test/unit/gateways/moneris_test.rb +167 -0
- data/test/unit/gateways/net_registry_test.rb +478 -0
- data/test/unit/gateways/pay_junction_test.rb +61 -0
- data/test/unit/gateways/payflow_express_test.rb +165 -0
- data/test/unit/gateways/payflow_express_uk_test.rb +14 -0
- data/test/unit/gateways/payflow_test.rb +230 -0
- data/test/unit/gateways/payflow_uk_test.rb +68 -0
- data/test/unit/gateways/payment_express_test.rb +215 -0
- data/test/unit/gateways/paypal_express_test.rb +222 -0
- data/test/unit/gateways/paypal_test.rb +241 -0
- data/test/unit/gateways/plugnpay_test.rb +79 -0
- data/test/unit/gateways/protx_test.rb +110 -0
- data/test/unit/gateways/psigate_test.rb +110 -0
- data/test/unit/gateways/psl_card_test.rb +51 -0
- data/test/unit/gateways/quickpay_test.rb +125 -0
- data/test/unit/gateways/realex_test.rb +150 -0
- data/test/unit/gateways/secure_pay_test.rb +78 -0
- data/test/unit/gateways/trans_first_test.rb +125 -0
- data/test/unit/gateways/trust_commerce_test.rb +57 -0
- data/test/unit/gateways/usa_epay_test.rb +117 -0
- data/test/unit/gateways/verifi_test.rb +91 -0
- data/test/unit/gateways/viaklix_test.rb +72 -0
- data/test/unit/integrations/action_view_helper_test.rb +54 -0
- data/test/unit/integrations/bogus_module_test.rb +16 -0
- data/test/unit/integrations/chronopay_module_test.rb +9 -0
- data/test/unit/integrations/gestpay_module_test.rb +10 -0
- data/test/unit/integrations/helpers/bogus_helper_test.rb +28 -0
- data/test/unit/integrations/helpers/chronopay_helper_test.rb +67 -0
- data/test/unit/integrations/helpers/gestpay_helper_test.rb +100 -0
- data/test/unit/integrations/helpers/nochex_helper_test.rb +53 -0
- data/test/unit/integrations/helpers/paypal_helper_test.rb +162 -0
- data/test/unit/integrations/helpers/two_checkout_helper_test.rb +92 -0
- data/test/unit/integrations/nochex_module_test.rb +9 -0
- data/test/unit/integrations/notifications/chronopay_notification_test.rb +66 -0
- data/test/unit/integrations/notifications/gestpay_notification_test.rb +60 -0
- data/test/unit/integrations/notifications/nochex_notification_test.rb +51 -0
- data/test/unit/integrations/notifications/notification_test.rb +41 -0
- data/test/unit/integrations/notifications/paypal_notification_test.rb +85 -0
- data/test/unit/integrations/notifications/two_checkout_notification_test.rb +55 -0
- data/test/unit/integrations/paypal_module_test.rb +24 -0
- data/test/unit/integrations/two_checkout_module_test.rb +9 -0
- data/test/unit/post_data_test.rb +55 -0
- data/test/unit/response_test.rb +14 -0
- data/test/unit/validateable_test.rb +56 -0
- metadata +160 -7
- metadata.gz.sig +0 -0
- data/lib/active_merchant/billing/gateways/payflow/f73e89fd.0 +0 -17
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
|
2
|
+
|
|
3
|
+
class RemoteQuickpayTest < Test::Unit::TestCase
|
|
4
|
+
|
|
5
|
+
# 100 cents
|
|
6
|
+
AMOUNT = 100
|
|
7
|
+
|
|
8
|
+
def setup
|
|
9
|
+
|
|
10
|
+
@gateway = QuickpayGateway.new(fixtures(:quickpay))
|
|
11
|
+
|
|
12
|
+
@declined_visa = credit_card('4000300011112220')
|
|
13
|
+
@visa = credit_card('4000100011112224')
|
|
14
|
+
@dankort = credit_card('5019717010103742')
|
|
15
|
+
@visa_dankort = credit_card('4571100000000000')
|
|
16
|
+
@electron_dk = credit_card('4175001000000000')
|
|
17
|
+
@diners_club = credit_card('30401000000000')
|
|
18
|
+
@diners_club_dk = credit_card('36148010000000')
|
|
19
|
+
@maestro = credit_card('5020100000000000')
|
|
20
|
+
@maestro_dk = credit_card('6769271000000000')
|
|
21
|
+
@mastercard_dk = credit_card('5413031000000000')
|
|
22
|
+
@amex_dk = credit_card('3747100000000000')
|
|
23
|
+
@amex = credit_card('3700100000000000')
|
|
24
|
+
|
|
25
|
+
# forbrugsforeningen doesn't use a verification value
|
|
26
|
+
@forbrugsforeningen = credit_card('6007221000000000', :verification_value => nil)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_successful_purchase
|
|
30
|
+
assert response = @gateway.purchase(AMOUNT, @visa, :order_id => generate_order_id)
|
|
31
|
+
assert_equal 'OK', response.message
|
|
32
|
+
assert_equal 'DKK', response.params['currency']
|
|
33
|
+
assert_success response
|
|
34
|
+
assert !response.authorization.blank?
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_successful_usd_purchase
|
|
38
|
+
assert response = @gateway.purchase(AMOUNT, @visa, :order_id => generate_order_id, :currency => 'USD')
|
|
39
|
+
assert_equal 'OK', response.message
|
|
40
|
+
assert_equal 'USD', response.params['currency']
|
|
41
|
+
assert_success response
|
|
42
|
+
assert !response.authorization.blank?
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def test_dankort_authorization
|
|
46
|
+
assert response = @gateway.authorize(AMOUNT, @dankort, :order_id => generate_order_id)
|
|
47
|
+
assert_success response
|
|
48
|
+
assert !response.authorization.blank?
|
|
49
|
+
assert_equal 'Dankort', response.params['cardtype']
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def test_visa_dankort_authorization
|
|
53
|
+
assert response = @gateway.authorize(AMOUNT, @visa_dankort, :order_id => generate_order_id)
|
|
54
|
+
assert_success response
|
|
55
|
+
assert !response.authorization.blank?
|
|
56
|
+
assert_equal 'Visa-Dankort', response.params['cardtype']
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def test_visa_electron_authorization
|
|
60
|
+
assert response = @gateway.authorize(AMOUNT, @electron_dk, :order_id => generate_order_id)
|
|
61
|
+
assert_success response
|
|
62
|
+
assert !response.authorization.blank?
|
|
63
|
+
assert_equal 'Visa-Electron-DK', response.params['cardtype']
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def test_diners_club_authorization
|
|
67
|
+
assert response = @gateway.authorize(AMOUNT, @diners_club, :order_id => generate_order_id)
|
|
68
|
+
assert_success response
|
|
69
|
+
assert !response.authorization.blank?
|
|
70
|
+
assert_equal 'Diners', response.params['cardtype']
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def test_diners_club_dk_authorization
|
|
74
|
+
assert response = @gateway.authorize(AMOUNT, @diners_club_dk, :order_id => generate_order_id)
|
|
75
|
+
assert_success response
|
|
76
|
+
assert !response.authorization.blank?
|
|
77
|
+
assert_equal 'Diners', response.params['cardtype']
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def test_maestro_authorization
|
|
81
|
+
assert response = @gateway.authorize(AMOUNT, @maestro, :order_id => generate_order_id)
|
|
82
|
+
assert_success response
|
|
83
|
+
assert !response.authorization.blank?
|
|
84
|
+
assert_equal 'Maestro', response.params['cardtype']
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def test_maestro_dk_authorization
|
|
88
|
+
assert response = @gateway.authorize(AMOUNT, @maestro_dk, :order_id => generate_order_id)
|
|
89
|
+
assert_success response
|
|
90
|
+
assert !response.authorization.blank?
|
|
91
|
+
assert_equal 'Maestro', response.params['cardtype']
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def test_mastercard_dk_authorization
|
|
95
|
+
assert response = @gateway.authorize(AMOUNT, @mastercard_dk, :order_id => generate_order_id)
|
|
96
|
+
assert_success response
|
|
97
|
+
assert !response.authorization.blank?
|
|
98
|
+
assert_equal 'MasterCard-DK', response.params['cardtype']
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def test_american_express_dk_authorization
|
|
102
|
+
assert response = @gateway.authorize(AMOUNT, @amex_dk, :order_id => generate_order_id)
|
|
103
|
+
assert_success response
|
|
104
|
+
assert !response.authorization.blank?
|
|
105
|
+
assert_equal 'AmericanExpress-DK', response.params['cardtype']
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def test_american_express_authorization
|
|
109
|
+
assert response = @gateway.authorize(AMOUNT, @amex, :order_id => generate_order_id)
|
|
110
|
+
assert_success response
|
|
111
|
+
assert !response.authorization.blank?
|
|
112
|
+
assert_equal 'AmericanExpress', response.params['cardtype']
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def test_forbrugsforeningen_authorization
|
|
116
|
+
assert response = @gateway.authorize(AMOUNT, @forbrugsforeningen, :order_id => generate_order_id)
|
|
117
|
+
assert_success response
|
|
118
|
+
assert !response.authorization.blank?
|
|
119
|
+
assert_equal 'FBG-1886', response.params['cardtype']
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def test_unsuccessful_purchase_with_missing_cvv2
|
|
123
|
+
assert response = @gateway.purchase(AMOUNT, @declined_visa, :order_id => generate_order_id)
|
|
124
|
+
assert_equal 'Missing/error in card verification data', response.message
|
|
125
|
+
assert_failure response
|
|
126
|
+
assert response.authorization.blank?
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def test_authorize_and_capture
|
|
130
|
+
amount = AMOUNT
|
|
131
|
+
assert auth = @gateway.authorize(amount, @visa, :order_id => generate_order_id)
|
|
132
|
+
assert_success auth
|
|
133
|
+
assert_equal 'OK', auth.message
|
|
134
|
+
assert auth.authorization
|
|
135
|
+
assert capture = @gateway.capture(amount, auth.authorization)
|
|
136
|
+
assert_success capture
|
|
137
|
+
assert_equal 'OK', capture.message
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def test_failed_capture
|
|
141
|
+
assert response = @gateway.capture(AMOUNT, '')
|
|
142
|
+
assert_failure response
|
|
143
|
+
assert_equal 'Missing/error in transaction number', response.message
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def test_purchase_and_void
|
|
147
|
+
assert auth = @gateway.authorize(AMOUNT, @visa, :order_id => generate_order_id)
|
|
148
|
+
assert_success auth
|
|
149
|
+
assert_equal 'OK', auth.message
|
|
150
|
+
assert auth.authorization
|
|
151
|
+
assert void = @gateway.void(auth.authorization)
|
|
152
|
+
assert_success void
|
|
153
|
+
assert_equal 'OK', void.message
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def test_authorization_capture_and_credit
|
|
157
|
+
assert auth = @gateway.authorize(AMOUNT, @visa, :order_id => generate_order_id)
|
|
158
|
+
assert_success auth
|
|
159
|
+
assert capture = @gateway.capture(AMOUNT, auth.authorization)
|
|
160
|
+
assert_success capture
|
|
161
|
+
assert credit = @gateway.credit(AMOUNT, auth.authorization)
|
|
162
|
+
assert_success credit
|
|
163
|
+
assert_equal 'OK', credit.message
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def test_purchase_and_credit
|
|
167
|
+
assert purchase = @gateway.purchase(AMOUNT, @visa, :order_id => generate_order_id)
|
|
168
|
+
assert_success purchase
|
|
169
|
+
assert credit = @gateway.credit(AMOUNT, purchase.authorization)
|
|
170
|
+
assert_success credit
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def test_invalid_login
|
|
174
|
+
gateway = QuickpayGateway.new(
|
|
175
|
+
:login => '',
|
|
176
|
+
:password => ''
|
|
177
|
+
)
|
|
178
|
+
assert response = gateway.purchase(AMOUNT, @visa, :order_id => generate_order_id)
|
|
179
|
+
assert_equal 'Missing/error in merchant', response.message
|
|
180
|
+
assert_failure response
|
|
181
|
+
end
|
|
182
|
+
end
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
|
2
|
+
|
|
3
|
+
class RemoteRealexTest < Test::Unit::TestCase
|
|
4
|
+
AMOUNT = 10000
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
@gateway = RealexGateway.new(fixtures(:realex))
|
|
8
|
+
|
|
9
|
+
@gateway_with_account = RealexGateway.new(fixtures(:realex_with_account))
|
|
10
|
+
|
|
11
|
+
# Replace the card numbers with the test account numbers from Realex
|
|
12
|
+
@visa = fixtures(:realex_visa)
|
|
13
|
+
@visa_declined = fixtures(:realex_visa_declined)
|
|
14
|
+
@visa_referral_b = fixtures(:realex_visa_referral_b)
|
|
15
|
+
@visa_referral_a = fixtures(:realex_visa_referral_a)
|
|
16
|
+
@visa_coms_error = fixtures(:realex_visa_coms_error)
|
|
17
|
+
|
|
18
|
+
@mastercard = fixtures(:realex_mastercard)
|
|
19
|
+
@mastercard_declined = fixtures(:realex_mastercard_declined)
|
|
20
|
+
@mastercard_referral_b = fixtures(:realex_mastercard_referral_b)
|
|
21
|
+
@mastercard_referral_a = fixtures(:realex_mastercard_referral_a)
|
|
22
|
+
@mastercard_coms_error = fixtures(:realex_mastercard_coms_error)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_nothing
|
|
26
|
+
assert true
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_realex_purchase
|
|
30
|
+
[ @visa, @mastercard ].each do |card|
|
|
31
|
+
|
|
32
|
+
response = @gateway.purchase(AMOUNT, card,
|
|
33
|
+
:order_id => generate_order_id,
|
|
34
|
+
:description => 'Test Realex Purchase',
|
|
35
|
+
:billing_address => {
|
|
36
|
+
:zip => '90210',
|
|
37
|
+
:country => 'US'
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
assert_not_nil response
|
|
41
|
+
assert_success response
|
|
42
|
+
assert response.test?
|
|
43
|
+
assert response.authorization.length > 0
|
|
44
|
+
assert_equal 'Successful', response.message
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_realex_purchase_with_invalid_login
|
|
49
|
+
gateway = RealexGateway.new(
|
|
50
|
+
:login => 'invalid',
|
|
51
|
+
:password => 'invalid'
|
|
52
|
+
)
|
|
53
|
+
response = gateway.purchase(AMOUNT, @visa,
|
|
54
|
+
:order_id => generate_order_id,
|
|
55
|
+
:description => 'Invalid login test'
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
assert_not_nil response
|
|
59
|
+
assert_failure response
|
|
60
|
+
|
|
61
|
+
assert_equal '504', response.params['result']
|
|
62
|
+
assert_equal "There is no such merchant id. Please contact realex payments if you continue to experience this problem.", response.params['message']
|
|
63
|
+
assert_equal RealexGateway::ERROR, response.message
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def test_realex_purchase_with_invalid_account
|
|
67
|
+
|
|
68
|
+
response = @gateway_with_account.purchase(AMOUNT, @visa,
|
|
69
|
+
:order_id => generate_order_id,
|
|
70
|
+
:description => 'Test Realex purchase with invalid acocunt'
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
assert_not_nil response
|
|
74
|
+
assert_failure response
|
|
75
|
+
|
|
76
|
+
assert_equal '506', response.params['result']
|
|
77
|
+
assert_equal "There is no such merchant account. Please contact realex payments if you continue to experience this problem.", response.params['message']
|
|
78
|
+
assert_equal RealexGateway::ERROR, response.message
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def test_realex_purchase_declined
|
|
82
|
+
|
|
83
|
+
[ @visa_declined, @mastercard_declined ].each do |card|
|
|
84
|
+
|
|
85
|
+
response = @gateway.purchase(AMOUNT, card,
|
|
86
|
+
:order_id => generate_order_id,
|
|
87
|
+
:description => 'Test Realex purchase declined'
|
|
88
|
+
)
|
|
89
|
+
assert_not_nil response
|
|
90
|
+
assert_failure response
|
|
91
|
+
|
|
92
|
+
assert_equal '101', response.params['result']
|
|
93
|
+
assert_equal response.params['message'], response.message
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def test_realex_purchase_referral_b
|
|
99
|
+
[ @visa_referral_b, @mastercard_referral_b ].each do |card|
|
|
100
|
+
|
|
101
|
+
response = @gateway.purchase(AMOUNT, card,
|
|
102
|
+
:order_id => generate_order_id,
|
|
103
|
+
:description => 'Test Realex Referral B'
|
|
104
|
+
)
|
|
105
|
+
assert_not_nil response
|
|
106
|
+
assert_failure response
|
|
107
|
+
assert response.test?
|
|
108
|
+
assert_equal '102', response.params['result']
|
|
109
|
+
assert_equal RealexGateway::DECLINED, response.message
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def test_realex_purchase_referral_a
|
|
114
|
+
[ @visa_referral_a, @mastercard_referral_a ].each do |card|
|
|
115
|
+
|
|
116
|
+
response = @gateway.purchase(AMOUNT, card,
|
|
117
|
+
:order_id => generate_order_id,
|
|
118
|
+
:description => 'Test Realex Rqeferral A'
|
|
119
|
+
)
|
|
120
|
+
assert_not_nil response
|
|
121
|
+
assert_failure response
|
|
122
|
+
assert_equal '103', response.params['result']
|
|
123
|
+
assert_equal RealexGateway::DECLINED, response.message
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def test_realex_purchase_coms_error
|
|
129
|
+
|
|
130
|
+
[ @visa_coms_error, @mastercard_coms_error ].each do |card|
|
|
131
|
+
|
|
132
|
+
response = @gateway.purchase(AMOUNT, card,
|
|
133
|
+
:order_id => generate_order_id,
|
|
134
|
+
:description => 'Test Realex coms error'
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
assert_not_nil response
|
|
138
|
+
assert_failure response
|
|
139
|
+
|
|
140
|
+
assert_equal '205', response.params['result']
|
|
141
|
+
assert_equal RealexGateway::BANK_ERROR, response.message
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def test_realex_ccn_error
|
|
147
|
+
@visa.number = 5
|
|
148
|
+
|
|
149
|
+
response = @gateway.purchase(AMOUNT, @visa,
|
|
150
|
+
:order_id => generate_order_id,
|
|
151
|
+
:description => 'Test Realex ccn error'
|
|
152
|
+
)
|
|
153
|
+
assert_not_nil response
|
|
154
|
+
assert_failure response
|
|
155
|
+
|
|
156
|
+
assert_equal '509', response.params['result']
|
|
157
|
+
assert_equal "Invalid credit card length", response.params['message']
|
|
158
|
+
assert_equal RealexGateway::ERROR, response.message
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def test_realex_expiry_month_error
|
|
162
|
+
@visa.month = 13
|
|
163
|
+
|
|
164
|
+
response = @gateway.purchase(AMOUNT, @visa,
|
|
165
|
+
:order_id => generate_order_id,
|
|
166
|
+
:description => 'Test Realex expiry month error'
|
|
167
|
+
)
|
|
168
|
+
assert_not_nil response
|
|
169
|
+
assert_failure response
|
|
170
|
+
|
|
171
|
+
assert_equal '509', response.params['result']
|
|
172
|
+
assert_equal RealexGateway::ERROR, response.message
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def test_realex_expiry_year_error
|
|
177
|
+
@visa.year = 2005
|
|
178
|
+
|
|
179
|
+
response = @gateway.purchase(AMOUNT, @visa,
|
|
180
|
+
:order_id => generate_order_id,
|
|
181
|
+
:description => 'Test Realex expiry year error'
|
|
182
|
+
)
|
|
183
|
+
assert_not_nil response
|
|
184
|
+
assert_failure response
|
|
185
|
+
|
|
186
|
+
assert_equal '509', response.params['result']
|
|
187
|
+
assert_equal RealexGateway::ERROR, response.message
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def test_invalid_credit_card_name
|
|
191
|
+
@visa.first_name = ""
|
|
192
|
+
@visa.last_name = ""
|
|
193
|
+
|
|
194
|
+
response = @gateway.purchase(AMOUNT, @visa,
|
|
195
|
+
:order_id => generate_order_id,
|
|
196
|
+
:description => 'test_chname_error'
|
|
197
|
+
)
|
|
198
|
+
assert_not_nil response
|
|
199
|
+
assert_failure response
|
|
200
|
+
|
|
201
|
+
assert_equal '502', response.params['result']
|
|
202
|
+
assert_equal RealexGateway::ERROR, response.message
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def test_cvn
|
|
206
|
+
@visa_cvn = @visa.clone
|
|
207
|
+
@visa_cvn.verification_value = "111"
|
|
208
|
+
response = @gateway.purchase(AMOUNT, @visa_cvn,
|
|
209
|
+
:order_id => generate_order_id,
|
|
210
|
+
:description => 'test_cvn'
|
|
211
|
+
)
|
|
212
|
+
assert_not_nil response
|
|
213
|
+
assert_success response
|
|
214
|
+
assert response.authorization.length > 0
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def test_customer_number
|
|
218
|
+
response = @gateway.purchase(AMOUNT, @visa,
|
|
219
|
+
:order_id => generate_order_id,
|
|
220
|
+
:description => 'test_cust_num',
|
|
221
|
+
:customer => 'my customer id'
|
|
222
|
+
)
|
|
223
|
+
assert_not_nil response
|
|
224
|
+
assert_success response
|
|
225
|
+
assert response.authorization.length > 0
|
|
226
|
+
end
|
|
227
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
|
2
|
+
|
|
3
|
+
class RemoteSecurePayTest < Test::Unit::TestCase
|
|
4
|
+
include ActiveMerchant::Billing
|
|
5
|
+
|
|
6
|
+
AMOUNT = 100
|
|
7
|
+
|
|
8
|
+
def setup
|
|
9
|
+
@gateway = SecurePayGateway.new(fixtures(:secure_pay))
|
|
10
|
+
|
|
11
|
+
@creditcard = credit_card('4111111111111111',
|
|
12
|
+
:month => 7,
|
|
13
|
+
:year => 2007
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
@options = { :order_id => generate_order_id,
|
|
17
|
+
:description => 'Store purchase',
|
|
18
|
+
:billing_address => {
|
|
19
|
+
:address1 => '1234 My Street',
|
|
20
|
+
:address2 => 'Apartment 204',
|
|
21
|
+
:city => 'Beverly Hills',
|
|
22
|
+
:state => 'CA',
|
|
23
|
+
:country => 'US',
|
|
24
|
+
:zip => '90210'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_successful_purchase
|
|
30
|
+
assert response = @gateway.purchase(AMOUNT, @creditcard, @options)
|
|
31
|
+
assert response.success?
|
|
32
|
+
assert response.test?
|
|
33
|
+
assert_equal 'This transaction has been approved', response.message
|
|
34
|
+
assert response.authorization
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
|
2
|
+
|
|
3
|
+
class RemoteTransFirstTest < Test::Unit::TestCase
|
|
4
|
+
AMOUNT = 100
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
@gateway = TransFirstGateway.new(fixtures(:trans_first))
|
|
8
|
+
|
|
9
|
+
@creditcard = credit_card('4111111111111111')
|
|
10
|
+
|
|
11
|
+
@options = {
|
|
12
|
+
:order_id => generate_order_id,
|
|
13
|
+
:invoice => 'ActiveMerchant Sale',
|
|
14
|
+
:address => { :address1 => '1234 Shady Brook Lane',
|
|
15
|
+
:zip => '90210'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_successful_purchase
|
|
21
|
+
assert response = @gateway.purchase(AMOUNT, @creditcard, @options)
|
|
22
|
+
assert_equal 'test transaction', response.message
|
|
23
|
+
assert response.test?
|
|
24
|
+
assert_success response
|
|
25
|
+
assert !response.authorization.blank?
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_invalid_login
|
|
29
|
+
gateway = TransFirstGateway.new(
|
|
30
|
+
:login => '',
|
|
31
|
+
:password => ''
|
|
32
|
+
)
|
|
33
|
+
assert response = gateway.purchase(AMOUNT, @creditcard, @options)
|
|
34
|
+
assert_equal 'invalid account', response.message
|
|
35
|
+
assert_failure response
|
|
36
|
+
end
|
|
37
|
+
end
|