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
data/test/fixtures.yml
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# This file has all of the ActiveMerchant test account credentials.
|
|
2
|
+
# Many gateways do not offer publicly available test accounts. In
|
|
3
|
+
# order to make testing the gateways easy you can copy this file to
|
|
4
|
+
# your home directory as the file ~/.active_merchant/fixtures.yml
|
|
5
|
+
# You can then place your own test account credentials in your local
|
|
6
|
+
# copy of the file.
|
|
7
|
+
#
|
|
8
|
+
# If the login is numeric, ensure that you place quotes around it.
|
|
9
|
+
# Leading zeros will be lost when YAML parses the file if you don't.
|
|
10
|
+
#
|
|
11
|
+
# Paste any required PEM certificates after the pem key.
|
|
12
|
+
#
|
|
13
|
+
authorize_net:
|
|
14
|
+
login: X
|
|
15
|
+
password: Y
|
|
16
|
+
|
|
17
|
+
brain_tree:
|
|
18
|
+
login: demo
|
|
19
|
+
password: password
|
|
20
|
+
|
|
21
|
+
card_stream:
|
|
22
|
+
login: X
|
|
23
|
+
password: Y
|
|
24
|
+
|
|
25
|
+
cyber_source:
|
|
26
|
+
login: X
|
|
27
|
+
password: Y
|
|
28
|
+
|
|
29
|
+
data_cash:
|
|
30
|
+
login: X
|
|
31
|
+
password: Y
|
|
32
|
+
|
|
33
|
+
efsnet:
|
|
34
|
+
login: X
|
|
35
|
+
password: Y
|
|
36
|
+
|
|
37
|
+
# Working credentials, no need to replace
|
|
38
|
+
eway:
|
|
39
|
+
login: '87654321'
|
|
40
|
+
|
|
41
|
+
# Working credentials, no need to replace
|
|
42
|
+
exact:
|
|
43
|
+
login: "A00427-01"
|
|
44
|
+
password: testus
|
|
45
|
+
|
|
46
|
+
ideal_ing_postbank:
|
|
47
|
+
login: LOGIN
|
|
48
|
+
password: PASSWORD
|
|
49
|
+
pem: |--
|
|
50
|
+
PASTE YOUR PEM FILE HERE
|
|
51
|
+
|
|
52
|
+
linkpoint:
|
|
53
|
+
login: STOREID
|
|
54
|
+
pem: |--
|
|
55
|
+
PASTE YOUR PEM FILE HERE
|
|
56
|
+
|
|
57
|
+
# Working credentials, no need to replace
|
|
58
|
+
moneris:
|
|
59
|
+
login: store1
|
|
60
|
+
password: yesguy
|
|
61
|
+
|
|
62
|
+
net_registry:
|
|
63
|
+
login: X
|
|
64
|
+
password: Y
|
|
65
|
+
|
|
66
|
+
payflow:
|
|
67
|
+
login: LOGIN
|
|
68
|
+
password: PASSWORD
|
|
69
|
+
partner: PayPal
|
|
70
|
+
|
|
71
|
+
payflow_uk:
|
|
72
|
+
login: LOGIN
|
|
73
|
+
password: PASSWORD
|
|
74
|
+
partner: PayPalUk
|
|
75
|
+
|
|
76
|
+
# Working credentials, no need to replace
|
|
77
|
+
pay_junction:
|
|
78
|
+
login: 'pj-ql-01'
|
|
79
|
+
password: 'pj-ql-01p'
|
|
80
|
+
|
|
81
|
+
payment_express:
|
|
82
|
+
login: LOGIN
|
|
83
|
+
password: PASSWORD
|
|
84
|
+
|
|
85
|
+
# You can use either your API PEM file or API signature with PayPal.
|
|
86
|
+
paypal:
|
|
87
|
+
login: LOGIN
|
|
88
|
+
password: PASSWORD
|
|
89
|
+
subject:
|
|
90
|
+
signature:
|
|
91
|
+
pem: |--
|
|
92
|
+
PASTE YOUR PEM FILE HERE
|
|
93
|
+
|
|
94
|
+
plugnpay:
|
|
95
|
+
login: LOGIN
|
|
96
|
+
password: PASSWORD
|
|
97
|
+
|
|
98
|
+
protx:
|
|
99
|
+
login: LOGIN
|
|
100
|
+
|
|
101
|
+
# Working credentials, no need to replace
|
|
102
|
+
psigate:
|
|
103
|
+
login: teststore
|
|
104
|
+
password: psigate1234
|
|
105
|
+
|
|
106
|
+
psl_card:
|
|
107
|
+
login: LOGIN
|
|
108
|
+
|
|
109
|
+
# PSL doesn't want the test data made public
|
|
110
|
+
psl_maestro:
|
|
111
|
+
number:
|
|
112
|
+
month:
|
|
113
|
+
year:
|
|
114
|
+
verification_value:
|
|
115
|
+
issue_number:
|
|
116
|
+
|
|
117
|
+
psl_maestro_address:
|
|
118
|
+
address1:
|
|
119
|
+
address2:
|
|
120
|
+
city:
|
|
121
|
+
state:
|
|
122
|
+
zip:
|
|
123
|
+
|
|
124
|
+
psl_solo:
|
|
125
|
+
number:
|
|
126
|
+
month:
|
|
127
|
+
year:
|
|
128
|
+
verification_value:
|
|
129
|
+
issue_number:
|
|
130
|
+
|
|
131
|
+
psl_solo_address:
|
|
132
|
+
address1:
|
|
133
|
+
city:
|
|
134
|
+
state:
|
|
135
|
+
zip:
|
|
136
|
+
|
|
137
|
+
psl_visa:
|
|
138
|
+
number:
|
|
139
|
+
month:
|
|
140
|
+
year:
|
|
141
|
+
verification_value:
|
|
142
|
+
|
|
143
|
+
psl_visa_address:
|
|
144
|
+
address1:
|
|
145
|
+
address2:
|
|
146
|
+
address3:
|
|
147
|
+
city:
|
|
148
|
+
zip:
|
|
149
|
+
|
|
150
|
+
quickpay:
|
|
151
|
+
login: X
|
|
152
|
+
password: Y
|
|
153
|
+
|
|
154
|
+
realex:
|
|
155
|
+
login: X
|
|
156
|
+
password: Y
|
|
157
|
+
|
|
158
|
+
realex_with_account:
|
|
159
|
+
login: X
|
|
160
|
+
password: Y
|
|
161
|
+
account: testaccount
|
|
162
|
+
|
|
163
|
+
# Realex doesn't provide public testing data
|
|
164
|
+
# Fill in the card numbers with the Realex test
|
|
165
|
+
# data.
|
|
166
|
+
realex_visa:
|
|
167
|
+
number:
|
|
168
|
+
month: '6'
|
|
169
|
+
year: '2020'
|
|
170
|
+
verification_value: '123'
|
|
171
|
+
|
|
172
|
+
realex_visa_declined:
|
|
173
|
+
number:
|
|
174
|
+
month: '6'
|
|
175
|
+
year: '2020'
|
|
176
|
+
verification_value: '123'
|
|
177
|
+
|
|
178
|
+
realex_visa_referral_a:
|
|
179
|
+
number:
|
|
180
|
+
month: '6'
|
|
181
|
+
year: '2020'
|
|
182
|
+
verification_value: '123'
|
|
183
|
+
|
|
184
|
+
realex_visa_referral_b:
|
|
185
|
+
number:
|
|
186
|
+
month: '6'
|
|
187
|
+
year: '2020'
|
|
188
|
+
verification_value: '123'
|
|
189
|
+
|
|
190
|
+
realex_visa_coms_error:
|
|
191
|
+
number:
|
|
192
|
+
month: '6'
|
|
193
|
+
year: '2020'
|
|
194
|
+
verification_value: '123'
|
|
195
|
+
|
|
196
|
+
realex_mastercard:
|
|
197
|
+
number:
|
|
198
|
+
month: '6'
|
|
199
|
+
year: '2020'
|
|
200
|
+
verification_value: '123'
|
|
201
|
+
|
|
202
|
+
realex_mastercard_declined:
|
|
203
|
+
number:
|
|
204
|
+
month: '6'
|
|
205
|
+
year: '2020'
|
|
206
|
+
verification_value: '123'
|
|
207
|
+
|
|
208
|
+
realex_mastercard_referral_a:
|
|
209
|
+
number:
|
|
210
|
+
month: '6'
|
|
211
|
+
year: '2020'
|
|
212
|
+
verification_value: '123'
|
|
213
|
+
|
|
214
|
+
realex_mastercard_referral_b:
|
|
215
|
+
number:
|
|
216
|
+
month: '6'
|
|
217
|
+
year: '2020'
|
|
218
|
+
verification_value: '123'
|
|
219
|
+
|
|
220
|
+
realex_mastercard_coms_error:
|
|
221
|
+
number:
|
|
222
|
+
month: '6'
|
|
223
|
+
year: '2020'
|
|
224
|
+
verification_value: '123'
|
|
225
|
+
|
|
226
|
+
secure_pay:
|
|
227
|
+
login: LOGIN
|
|
228
|
+
password: PASSWORD
|
|
229
|
+
|
|
230
|
+
trans_first:
|
|
231
|
+
login: LOGIN
|
|
232
|
+
password: PASSWORD
|
|
233
|
+
|
|
234
|
+
# Working credentials, no need to replace
|
|
235
|
+
trust_commerce:
|
|
236
|
+
login: 'TestMerchant'
|
|
237
|
+
password: 'password'
|
|
238
|
+
|
|
239
|
+
# Working credentials, no need to replace
|
|
240
|
+
usa_epay:
|
|
241
|
+
login: 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu'
|
|
242
|
+
|
|
243
|
+
# Working credentials, no need to replace
|
|
244
|
+
verify:
|
|
245
|
+
login: 'demo'
|
|
246
|
+
password: 'password'
|
|
247
|
+
|
|
248
|
+
viaklix:
|
|
249
|
+
login: LOGIN
|
|
250
|
+
password: PASSWORD
|
|
251
|
+
user: USER
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
|
2
|
+
|
|
3
|
+
class AuthorizeNetTest < Test::Unit::TestCase
|
|
4
|
+
def setup
|
|
5
|
+
Base.mode = :test
|
|
6
|
+
|
|
7
|
+
@gateway = AuthorizeNetGateway.new(fixtures(:authorize_net))
|
|
8
|
+
|
|
9
|
+
@creditcard = credit_card('4242424242424242')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_successful_purchase
|
|
13
|
+
assert response = @gateway.purchase(100, @creditcard,
|
|
14
|
+
:order_id => generate_order_id,
|
|
15
|
+
:description => 'Store purchase'
|
|
16
|
+
)
|
|
17
|
+
assert_success response
|
|
18
|
+
assert response.test?
|
|
19
|
+
assert_equal 'This transaction has been approved', response.message
|
|
20
|
+
assert response.authorization
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_expired_credit_card
|
|
24
|
+
@creditcard.year = 2004
|
|
25
|
+
assert response = @gateway.purchase(100, @creditcard, :order_id => generate_order_id)
|
|
26
|
+
assert_failure response
|
|
27
|
+
assert response.test?
|
|
28
|
+
assert_equal 'The credit card has expired', response.message
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def test_forced_test_mode_purchase
|
|
32
|
+
gateway = AuthorizeNetGateway.new(
|
|
33
|
+
:login => @login,
|
|
34
|
+
:password => @password,
|
|
35
|
+
:test => true
|
|
36
|
+
)
|
|
37
|
+
assert response = gateway.purchase(100, @creditcard, :order_id => generate_order_id)
|
|
38
|
+
assert_success response
|
|
39
|
+
assert response.test?
|
|
40
|
+
assert_match /TESTMODE/, response.message
|
|
41
|
+
assert response.authorization
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_successful_authorization
|
|
45
|
+
assert response = @gateway.authorize(100, @creditcard, :order_id => generate_order_id)
|
|
46
|
+
assert_success response
|
|
47
|
+
assert_equal 'This transaction has been approved', response.message
|
|
48
|
+
assert response.authorization
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def test_authorization_and_capture
|
|
52
|
+
assert authorization = @gateway.authorize(100, @creditcard, :order_id => generate_order_id)
|
|
53
|
+
assert_success authorization
|
|
54
|
+
assert authorization
|
|
55
|
+
assert capture = @gateway.capture(100, authorization.authorization)
|
|
56
|
+
assert_success capture
|
|
57
|
+
assert_equal 'This transaction has been approved', capture.message
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def test_authorization_and_void
|
|
61
|
+
assert authorization = @gateway.authorize(100, @creditcard, :order_id => generate_order_id)
|
|
62
|
+
assert_success authorization
|
|
63
|
+
assert authorization
|
|
64
|
+
assert void = @gateway.void(authorization.authorization)
|
|
65
|
+
assert_success void
|
|
66
|
+
assert_equal 'This transaction has been approved', void.message
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def test_bad_login
|
|
70
|
+
gateway = AuthorizeNetGateway.new(
|
|
71
|
+
:login => 'X',
|
|
72
|
+
:password => 'Y'
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
assert response = gateway.purchase(100, @creditcard)
|
|
77
|
+
|
|
78
|
+
assert_equal Response, response.class
|
|
79
|
+
assert_equal ["avs_message",
|
|
80
|
+
"avs_result_code",
|
|
81
|
+
"card_code",
|
|
82
|
+
"response_code",
|
|
83
|
+
"response_reason_code",
|
|
84
|
+
"response_reason_text",
|
|
85
|
+
"transaction_id"], response.params.keys.sort
|
|
86
|
+
|
|
87
|
+
assert_match /The merchant login ID or password is invalid/, response.message
|
|
88
|
+
|
|
89
|
+
assert_equal false, response.success?
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def test_using_test_request
|
|
93
|
+
gateway = AuthorizeNetGateway.new(
|
|
94
|
+
:login => 'X',
|
|
95
|
+
:password => 'Y'
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
assert response = gateway.purchase(100, @creditcard)
|
|
99
|
+
|
|
100
|
+
assert_equal Response, response.class
|
|
101
|
+
assert_equal ["avs_message",
|
|
102
|
+
"avs_result_code",
|
|
103
|
+
"card_code",
|
|
104
|
+
"response_code",
|
|
105
|
+
"response_reason_code",
|
|
106
|
+
"response_reason_text",
|
|
107
|
+
"transaction_id"], response.params.keys.sort
|
|
108
|
+
|
|
109
|
+
assert_match /The merchant login ID or password is invalid/, response.message
|
|
110
|
+
|
|
111
|
+
assert_equal false, response.success?
|
|
112
|
+
end
|
|
113
|
+
end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
|
2
|
+
|
|
3
|
+
class RemoteBrainTreeTest < Test::Unit::TestCase
|
|
4
|
+
AMOUNT = 10000
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
@gateway = BrainTreeGateway.new(fixtures(:brain_tree))
|
|
8
|
+
|
|
9
|
+
@creditcard = credit_card('4111111111111111')
|
|
10
|
+
|
|
11
|
+
@declined_amount = rand(99)
|
|
12
|
+
@amount = rand(10000)+1001
|
|
13
|
+
|
|
14
|
+
@options = { :order_id => generate_order_id,
|
|
15
|
+
:address => { :address1 => '1234 Shady Brook Lane',
|
|
16
|
+
:zip => '90210'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_successful_purchase
|
|
22
|
+
assert response = @gateway.purchase(@amount, @creditcard, @options)
|
|
23
|
+
assert_equal 'This transaction has been approved', response.message
|
|
24
|
+
assert_success response
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_successful_add_to_vault
|
|
28
|
+
@options[:store] = true
|
|
29
|
+
assert response = @gateway.purchase(@amount, @creditcard, @options)
|
|
30
|
+
assert_equal 'This transaction has been approved', response.message
|
|
31
|
+
assert_success response
|
|
32
|
+
assert_not_nil response.params["customer_vault_id"]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_successful_add_to_vault_and_use
|
|
36
|
+
@options[:store] = true
|
|
37
|
+
assert response = @gateway.purchase(@amount, @creditcard, @options)
|
|
38
|
+
assert_equal 'This transaction has been approved', response.message
|
|
39
|
+
assert_success response
|
|
40
|
+
assert_not_nil customer_id = response.params["customer_vault_id"]
|
|
41
|
+
|
|
42
|
+
assert second_response = @gateway.purchase(@amount*2, customer_id, @options)
|
|
43
|
+
assert_equal 'This transaction has been approved', second_response.message
|
|
44
|
+
assert second_response.success?
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def test_declined_purchase
|
|
48
|
+
assert response = @gateway.purchase(@declined_amount, @creditcard, @options)
|
|
49
|
+
assert_equal 'This transaction has been declined', response.message
|
|
50
|
+
assert_failure response
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def test_authorize_and_capture
|
|
54
|
+
assert auth = @gateway.authorize(@amount, @creditcard, @options)
|
|
55
|
+
assert_success auth
|
|
56
|
+
assert_equal 'This transaction has been approved', auth.message
|
|
57
|
+
assert auth.authorization
|
|
58
|
+
assert capture = @gateway.capture(@amount, auth.authorization)
|
|
59
|
+
assert_equal 'This transaction has been approved', capture.message
|
|
60
|
+
assert_success capture
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def test_failed_capture
|
|
64
|
+
assert response = @gateway.capture(@amount, '')
|
|
65
|
+
assert_failure response
|
|
66
|
+
assert response.message.match(/Invalid Transaction ID \/ Object ID specified:/)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def test_invalid_login
|
|
70
|
+
gateway = BrainTreeGateway.new(
|
|
71
|
+
:login => '',
|
|
72
|
+
:password => ''
|
|
73
|
+
)
|
|
74
|
+
assert response = gateway.purchase(@amount, @creditcard, @options)
|
|
75
|
+
assert_equal 'Invalid Username', response.message
|
|
76
|
+
assert_failure response
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Portions of the Cardstream gateway by Jonah Fox and Thomas Nichols
|
|
2
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
|
3
|
+
|
|
4
|
+
class RemoteCardStreamTest < Test::Unit::TestCase
|
|
5
|
+
def setup
|
|
6
|
+
@gateway = CardStreamGateway.new(fixtures(:card_stream))
|
|
7
|
+
|
|
8
|
+
@amex = CreditCard.new(
|
|
9
|
+
:number => '374245455400001',
|
|
10
|
+
:month => 12,
|
|
11
|
+
:year => 2009,
|
|
12
|
+
:verification_value => 4887,
|
|
13
|
+
:first_name => 'Longbob',
|
|
14
|
+
:last_name => 'Longsen',
|
|
15
|
+
:type => :american_express
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
@maestro = CreditCard.new(
|
|
19
|
+
:number => '6759016800000120097',
|
|
20
|
+
:month => 6,
|
|
21
|
+
:year => 2009,
|
|
22
|
+
:issue_number => 1,
|
|
23
|
+
:verification_value => 701,
|
|
24
|
+
:first_name => 'Longbob',
|
|
25
|
+
:last_name => 'Longsen',
|
|
26
|
+
:type => :maestro
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
@solo = CreditCard.new(
|
|
30
|
+
:number => '6334960300099354',
|
|
31
|
+
:month => 6,
|
|
32
|
+
:year => 2008,
|
|
33
|
+
:issue_number => 1,
|
|
34
|
+
:verification_value => 227,
|
|
35
|
+
:first_name => 'Longbob',
|
|
36
|
+
:last_name => 'Longsen',
|
|
37
|
+
:type => :solo
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
@mastercard = CreditCard.new(
|
|
41
|
+
:number => '5301250070000191',
|
|
42
|
+
:month => 12,
|
|
43
|
+
:year => 2009,
|
|
44
|
+
:verification_value => 419,
|
|
45
|
+
:first_name => 'Longbob',
|
|
46
|
+
:last_name => 'Longsen',
|
|
47
|
+
:type => :master
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
@declined_card = CreditCard.new(
|
|
51
|
+
:number => '4000300011112220',
|
|
52
|
+
:month => 9,
|
|
53
|
+
:year => 2009,
|
|
54
|
+
:first_name => 'Longbob',
|
|
55
|
+
:last_name => 'Longsen'
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
@mastercard_options = {
|
|
59
|
+
:address => { :address1 => '25 The Larches',
|
|
60
|
+
:city => "Narborough",
|
|
61
|
+
:state => "Leicester",
|
|
62
|
+
:zip => 'LE10 2RT'
|
|
63
|
+
},
|
|
64
|
+
:order_id => generate_order_id,
|
|
65
|
+
:description => 'Store purchase'
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@maestro_options = {
|
|
69
|
+
:address => { :address1 => 'The Parkway',
|
|
70
|
+
:address2 => "Larches Approach",
|
|
71
|
+
:city => "Hull",
|
|
72
|
+
:state => "North Humberside",
|
|
73
|
+
:zip => 'HU7 9OP'
|
|
74
|
+
},
|
|
75
|
+
:order_id => generate_order_id,
|
|
76
|
+
:description => 'Store purchase'
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@solo_options = {
|
|
80
|
+
:address => {
|
|
81
|
+
:address1 => '5 Zigzag Road',
|
|
82
|
+
:city => 'Isleworth',
|
|
83
|
+
:state => 'Middlesex',
|
|
84
|
+
:zip => 'TW7 8FF'
|
|
85
|
+
},
|
|
86
|
+
:order_id => generate_order_id,
|
|
87
|
+
:description => 'Store purchase'
|
|
88
|
+
}
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def test_successful_mastercard_purchase
|
|
92
|
+
assert response = @gateway.purchase(100, @mastercard, @mastercard_options)
|
|
93
|
+
assert_equal 'APPROVED', response.message
|
|
94
|
+
assert_success response
|
|
95
|
+
assert response.test?
|
|
96
|
+
assert !response.authorization.blank?
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def test_declined_mastercard_purchase
|
|
100
|
+
assert response = @gateway.purchase(10000, @mastercard, @mastercard_options)
|
|
101
|
+
assert_equal 'CARD DECLINED', response.message
|
|
102
|
+
assert_failure response
|
|
103
|
+
assert response.test?
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def test_expired_mastercard
|
|
107
|
+
@mastercard.year = 2005
|
|
108
|
+
assert response = @gateway.purchase(100, @mastercard, @mastercard_options)
|
|
109
|
+
assert_equal 'CARD EXPIRED', response.message
|
|
110
|
+
assert_failure response
|
|
111
|
+
assert response.test?
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def test_successful_maestro_purchase
|
|
115
|
+
assert response = @gateway.purchase(100, @maestro, @maestro_options)
|
|
116
|
+
assert_equal 'APPROVED', response.message
|
|
117
|
+
assert_success response
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def test_successful_solo_purchase
|
|
121
|
+
assert response = @gateway.purchase(100, @solo, @solo_options)
|
|
122
|
+
assert_equal 'APPROVED', response.message
|
|
123
|
+
assert_success response
|
|
124
|
+
assert response.test?
|
|
125
|
+
assert !response.authorization.blank?
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def test_successful_amex_purchase
|
|
129
|
+
assert response = @gateway.purchase(100, @amex, :order_id => generate_order_id)
|
|
130
|
+
assert_equal 'APPROVED', response.message
|
|
131
|
+
assert_success response
|
|
132
|
+
assert response.test?
|
|
133
|
+
assert !response.authorization.blank?
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def test_maestro_missing_start_date_and_issue_date
|
|
137
|
+
@maestro.issue_number = nil
|
|
138
|
+
assert response = @gateway.purchase(100, @maestro, @maestro_options)
|
|
139
|
+
assert_equal 'ISSUE NUMBER MISSING', response.message
|
|
140
|
+
assert_failure response
|
|
141
|
+
assert response.test?
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def test_invalid_login
|
|
145
|
+
gateway = CardStreamGateway.new(
|
|
146
|
+
:login => '',
|
|
147
|
+
:password => ''
|
|
148
|
+
)
|
|
149
|
+
assert response = gateway.purchase(100, @mastercard, @mastercard_options)
|
|
150
|
+
assert_equal 'Merchant ID or Password Error', response.message
|
|
151
|
+
assert_failure response
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def test_unsupported_merchant_currency
|
|
155
|
+
assert response = @gateway.purchase(100, @mastercard, @mastercard_options)
|
|
156
|
+
assert_equal "ERROR 5456:CURRENCY NOT SUPPORTED FOR THIS MERCHANT ACCOUNT", response.message
|
|
157
|
+
assert_failure response
|
|
158
|
+
assert response.test?
|
|
159
|
+
end
|
|
160
|
+
end
|