activemerchant 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +9 -0
  3. data/MIT-LICENSE +1 -1
  4. data/lib/active_merchant.rb +6 -26
  5. data/lib/active_merchant/billing.rb +9 -0
  6. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +12 -1
  7. data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -1
  8. data/lib/active_merchant/billing/integrations/chronopay/helper.rb +40 -1
  9. data/lib/active_merchant/billing/integrations/two_checkout.rb +1 -1
  10. metadata +9 -173
  11. metadata.gz.sig +0 -0
  12. data/Rakefile +0 -153
  13. data/init.rb +0 -3
  14. data/script/destroy +0 -14
  15. data/script/generate +0 -14
  16. data/test/fixtures.yml +0 -355
  17. data/test/remote/gateways/remote_authorize_net_cim_test.rb +0 -460
  18. data/test/remote/gateways/remote_authorize_net_test.rb +0 -145
  19. data/test/remote/gateways/remote_beanstream_interac_test.rb +0 -53
  20. data/test/remote/gateways/remote_beanstream_test.rb +0 -150
  21. data/test/remote/gateways/remote_braintree_test.rb +0 -147
  22. data/test/remote/gateways/remote_card_stream_test.rb +0 -148
  23. data/test/remote/gateways/remote_cyber_source_test.rb +0 -144
  24. data/test/remote/gateways/remote_data_cash_test.rb +0 -356
  25. data/test/remote/gateways/remote_efsnet_test.rb +0 -81
  26. data/test/remote/gateways/remote_elavon_test.rb +0 -66
  27. data/test/remote/gateways/remote_eway_test.rb +0 -74
  28. data/test/remote/gateways/remote_exact_test.rb +0 -60
  29. data/test/remote/gateways/remote_first_pay_test.rb +0 -87
  30. data/test/remote/gateways/remote_instapay_test.rb +0 -61
  31. data/test/remote/gateways/remote_jetpay_test.rb +0 -103
  32. data/test/remote/gateways/remote_linkpoint_test.rb +0 -121
  33. data/test/remote/gateways/remote_merchant_e_solutions_test.rb +0 -173
  34. data/test/remote/gateways/remote_merchant_ware_test.rb +0 -113
  35. data/test/remote/gateways/remote_modern_payments_cim_test.rb +0 -58
  36. data/test/remote/gateways/remote_modern_payments_test.rb +0 -57
  37. data/test/remote/gateways/remote_moneris_test.rb +0 -82
  38. data/test/remote/gateways/remote_net_registry_test.rb +0 -85
  39. data/test/remote/gateways/remote_netbilling_test.rb +0 -70
  40. data/test/remote/gateways/remote_ogone_test.rb +0 -115
  41. data/test/remote/gateways/remote_pay_junction_test.rb +0 -143
  42. data/test/remote/gateways/remote_pay_secure_test.rb +0 -39
  43. data/test/remote/gateways/remote_payflow_express_test.rb +0 -50
  44. data/test/remote/gateways/remote_payflow_test.rb +0 -237
  45. data/test/remote/gateways/remote_payflow_uk_test.rb +0 -173
  46. data/test/remote/gateways/remote_payment_express_test.rb +0 -136
  47. data/test/remote/gateways/remote_paypal_express_test.rb +0 -49
  48. data/test/remote/gateways/remote_paypal_test.rb +0 -191
  49. data/test/remote/gateways/remote_plugnpay_test.rb +0 -72
  50. data/test/remote/gateways/remote_psigate_test.rb +0 -50
  51. data/test/remote/gateways/remote_psl_card_test.rb +0 -123
  52. data/test/remote/gateways/remote_quickpay_test.rb +0 -190
  53. data/test/remote/gateways/remote_realex_test.rb +0 -224
  54. data/test/remote/gateways/remote_sage_bankcard_test.rb +0 -109
  55. data/test/remote/gateways/remote_sage_pay_test.rb +0 -219
  56. data/test/remote/gateways/remote_sage_test.rb +0 -87
  57. data/test/remote/gateways/remote_sage_virtual_check_test.rb +0 -62
  58. data/test/remote/gateways/remote_sallie_mae_test.rb +0 -51
  59. data/test/remote/gateways/remote_secure_pay_au_test.rb +0 -40
  60. data/test/remote/gateways/remote_secure_pay_tech_test.rb +0 -37
  61. data/test/remote/gateways/remote_secure_pay_test.rb +0 -28
  62. data/test/remote/gateways/remote_skipjack_test.rb +0 -105
  63. data/test/remote/gateways/remote_trans_first_test.rb +0 -34
  64. data/test/remote/gateways/remote_transax_test.rb +0 -112
  65. data/test/remote/gateways/remote_trust_commerce_test.rb +0 -152
  66. data/test/remote/gateways/remote_usa_epay_test.rb +0 -46
  67. data/test/remote/gateways/remote_verifi_test.rb +0 -107
  68. data/test/remote/gateways/remote_viaklix_test.rb +0 -43
  69. data/test/remote/gateways/remote_wirecard_test.rb +0 -111
  70. data/test/remote/integrations/remote_gestpay_integration_test.rb +0 -37
  71. data/test/remote/integrations/remote_paypal_integration_test.rb +0 -26
  72. data/test/test_helper.rb +0 -184
  73. data/test/unit/avs_result_test.rb +0 -59
  74. data/test/unit/base_test.rb +0 -54
  75. data/test/unit/check_test.rb +0 -88
  76. data/test/unit/connection_test.rb +0 -129
  77. data/test/unit/country_code_test.rb +0 -33
  78. data/test/unit/country_test.rb +0 -64
  79. data/test/unit/credit_card_formatting_test.rb +0 -19
  80. data/test/unit/credit_card_methods_test.rb +0 -179
  81. data/test/unit/credit_card_test.rb +0 -318
  82. data/test/unit/cvv_result_test.rb +0 -33
  83. data/test/unit/expiry_date_test.rb +0 -32
  84. data/test/unit/gateways/authorize_net_cim_test.rb +0 -676
  85. data/test/unit/gateways/authorize_net_test.rb +0 -290
  86. data/test/unit/gateways/beanstream_interac_test.rb +0 -51
  87. data/test/unit/gateways/beanstream_test.rb +0 -108
  88. data/test/unit/gateways/bogus_test.rb +0 -46
  89. data/test/unit/gateways/braintree_test.rb +0 -118
  90. data/test/unit/gateways/card_stream_test.rb +0 -90
  91. data/test/unit/gateways/cyber_source_test.rb +0 -188
  92. data/test/unit/gateways/data_cash_test.rb +0 -133
  93. data/test/unit/gateways/efsnet_test.rb +0 -123
  94. data/test/unit/gateways/elavon_test.rb +0 -139
  95. data/test/unit/gateways/eway_test.rb +0 -118
  96. data/test/unit/gateways/exact_test.rb +0 -156
  97. data/test/unit/gateways/first_pay_test.rb +0 -125
  98. data/test/unit/gateways/gateway_test.rb +0 -48
  99. data/test/unit/gateways/instapay_test.rb +0 -102
  100. data/test/unit/gateways/jetpay_test.rb +0 -185
  101. data/test/unit/gateways/linkpoint_test.rb +0 -197
  102. data/test/unit/gateways/merchant_e_solutions_test.rb +0 -169
  103. data/test/unit/gateways/merchant_ware_test.rb +0 -188
  104. data/test/unit/gateways/modern_payments_cim_test.rb +0 -162
  105. data/test/unit/gateways/moneris_test.rb +0 -158
  106. data/test/unit/gateways/net_registry_test.rb +0 -416
  107. data/test/unit/gateways/netbilling_test.rb +0 -54
  108. data/test/unit/gateways/ogone_test.rb +0 -319
  109. data/test/unit/gateways/pay_junction_test.rb +0 -123
  110. data/test/unit/gateways/pay_secure_test.rb +0 -71
  111. data/test/unit/gateways/payflow_express_test.rb +0 -173
  112. data/test/unit/gateways/payflow_express_uk_test.rb +0 -86
  113. data/test/unit/gateways/payflow_test.rb +0 -305
  114. data/test/unit/gateways/payflow_uk_test.rb +0 -30
  115. data/test/unit/gateways/payment_express_test.rb +0 -195
  116. data/test/unit/gateways/paypal_express_test.rb +0 -382
  117. data/test/unit/gateways/paypal_test.rb +0 -569
  118. data/test/unit/gateways/plugnpay_test.rb +0 -86
  119. data/test/unit/gateways/psigate_test.rb +0 -169
  120. data/test/unit/gateways/psl_card_test.rb +0 -64
  121. data/test/unit/gateways/quickpay_test.rb +0 -112
  122. data/test/unit/gateways/realex_test.rb +0 -151
  123. data/test/unit/gateways/sage_bankcard_test.rb +0 -196
  124. data/test/unit/gateways/sage_pay_test.rb +0 -139
  125. data/test/unit/gateways/sage_virtual_check_test.rb +0 -71
  126. data/test/unit/gateways/sallie_mae_test.rb +0 -53
  127. data/test/unit/gateways/secure_pay_au_test.rb +0 -207
  128. data/test/unit/gateways/secure_pay_tech_test.rb +0 -44
  129. data/test/unit/gateways/secure_pay_test.rb +0 -101
  130. data/test/unit/gateways/skip_jack_test.rb +0 -213
  131. data/test/unit/gateways/trans_first_test.rb +0 -112
  132. data/test/unit/gateways/trust_commerce_test.rb +0 -90
  133. data/test/unit/gateways/usa_epay_test.rb +0 -128
  134. data/test/unit/gateways/verifi_test.rb +0 -96
  135. data/test/unit/gateways/viaklix_test.rb +0 -78
  136. data/test/unit/gateways/wirecard_test.rb +0 -250
  137. data/test/unit/generators/test_gateway_generator.rb +0 -46
  138. data/test/unit/generators/test_generator_helper.rb +0 -20
  139. data/test/unit/generators/test_integration_generator.rb +0 -53
  140. data/test/unit/integrations/action_view_helper_test.rb +0 -50
  141. data/test/unit/integrations/bogus_module_test.rb +0 -20
  142. data/test/unit/integrations/chronopay_module_test.rb +0 -13
  143. data/test/unit/integrations/gestpay_module_test.rb +0 -14
  144. data/test/unit/integrations/helpers/bogus_helper_test.rb +0 -28
  145. data/test/unit/integrations/helpers/chronopay_helper_test.rb +0 -67
  146. data/test/unit/integrations/helpers/gestpay_helper_test.rb +0 -100
  147. data/test/unit/integrations/helpers/hi_trust_helper_test.rb +0 -16
  148. data/test/unit/integrations/helpers/nochex_helper_test.rb +0 -53
  149. data/test/unit/integrations/helpers/paypal_helper_test.rb +0 -171
  150. data/test/unit/integrations/helpers/quickpay_helper_test.rb +0 -40
  151. data/test/unit/integrations/helpers/two_checkout_helper_test.rb +0 -92
  152. data/test/unit/integrations/hi_trust_module_test.rb +0 -13
  153. data/test/unit/integrations/nochex_module_test.rb +0 -13
  154. data/test/unit/integrations/notifications/chronopay_notification_test.rb +0 -66
  155. data/test/unit/integrations/notifications/gestpay_notification_test.rb +0 -60
  156. data/test/unit/integrations/notifications/hi_trust_notification_test.rb +0 -59
  157. data/test/unit/integrations/notifications/nochex_notification_test.rb +0 -51
  158. data/test/unit/integrations/notifications/notification_test.rb +0 -54
  159. data/test/unit/integrations/notifications/paypal_notification_test.rb +0 -85
  160. data/test/unit/integrations/notifications/quickpay_notification_test.rb +0 -69
  161. data/test/unit/integrations/notifications/two_checkout_notification_test.rb +0 -55
  162. data/test/unit/integrations/paypal_module_test.rb +0 -28
  163. data/test/unit/integrations/quickpay_module_test.rb +0 -9
  164. data/test/unit/integrations/returns/chronopay_return_test.rb +0 -11
  165. data/test/unit/integrations/returns/gestpay_return_test.rb +0 -10
  166. data/test/unit/integrations/returns/hi_trust_return_test.rb +0 -24
  167. data/test/unit/integrations/returns/nochex_return_test.rb +0 -10
  168. data/test/unit/integrations/returns/paypal_return_test.rb +0 -10
  169. data/test/unit/integrations/returns/return_test.rb +0 -11
  170. data/test/unit/integrations/returns/two_checkout_return_test.rb +0 -24
  171. data/test/unit/integrations/two_checkout_module_test.rb +0 -13
  172. data/test/unit/post_data_test.rb +0 -55
  173. data/test/unit/posts_data_test.rb +0 -48
  174. data/test/unit/response_test.rb +0 -28
  175. data/test/unit/utils_test.rb +0 -7
  176. data/test/unit/validateable_test.rb +0 -60
data/init.rb DELETED
@@ -1,3 +0,0 @@
1
- require 'active_merchant'
2
- require 'active_merchant/billing/integrations/action_view_helper'
3
- ActionView::Base.send(:include, ActiveMerchant::Billing::Integrations::ActionViewHelper)
data/script/destroy DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.join(File.dirname(__FILE__), '..')
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:activemerchant, :rubygems, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.join(File.dirname(__FILE__), '..')
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:activemerchant, :rubygems, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)
data/test/fixtures.yml DELETED
@@ -1,355 +0,0 @@
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
- beanstream:
18
- login: merchant id
19
- user: username
20
- password: password
21
-
22
- beanstream_interac:
23
- login: merchant id
24
- user: username
25
- password: password
26
-
27
- braintree:
28
- login: demo
29
- password: password
30
-
31
- card_stream:
32
- login: X
33
- password: Y
34
-
35
- cyber_source:
36
- login: X
37
- password: Y
38
-
39
- data_cash:
40
- login: X
41
- password: Y
42
-
43
- efsnet:
44
- login: X
45
- password: Y
46
-
47
- elavon:
48
- login: LOGIN
49
- password: PASSWORD
50
-
51
- # Working credentials, no need to replace
52
- eway:
53
- login: '87654321'
54
-
55
- # Working credentials, no need to replace
56
- exact:
57
- login: "A00427-01"
58
- password: testus
59
-
60
- first_pay:
61
- login:
62
- password:
63
-
64
- ideal_ing_postbank:
65
- login: LOGIN
66
- password: PASSWORD
67
- pem: |--
68
- PASTE YOUR PEM FILE HERE
69
-
70
- instapay:
71
- login: TEST0
72
- password:
73
-
74
- jetpay:
75
- login: TESTTERMINAL
76
-
77
- linkpoint:
78
- login: STOREID
79
- pem: |--
80
- PASTE YOUR PEM FILE HERE
81
-
82
- merchant_ware:
83
- login:
84
- password:
85
- name:
86
-
87
- modern_payments:
88
- login: login
89
- password: password
90
-
91
- # Working credentials, no need to replace
92
- moneris:
93
- login: store1
94
- password: yesguy
95
-
96
- # Working credentials, no need to replace
97
- # Contact Netbilling for login info to the admin area
98
- netbilling:
99
- login: '104901072025'
100
-
101
- net_registry:
102
- login: X
103
- password: Y
104
-
105
- ogone:
106
- login: LOGIN
107
- user: USER
108
- password: PASSWORD
109
- signature: SIGNATURE
110
-
111
- payflow:
112
- login: LOGIN
113
- password: PASSWORD
114
- partner: PayPal
115
-
116
- payflow_uk:
117
- login: LOGIN
118
- password: PASSWORD
119
- partner: PayPalUk
120
-
121
- # Working credentials, no need to replace
122
- pay_junction:
123
- login: 'pj-ql-01'
124
- password: 'pj-ql-01p'
125
-
126
- payment_express:
127
- login: LOGIN
128
- password: PASSWORD
129
-
130
- # You can use either your API PEM file or API signature with PayPal.
131
- paypal_certificate:
132
- login: LOGIN
133
- password: PASSWORD
134
- subject:
135
- pem: |--
136
- PASTE YOUR PEM FILE HERE
137
-
138
- paypal_signature:
139
- login: LOGIN
140
- password: PASSWORD
141
- signature: SIGNATURE
142
-
143
- pay_secure:
144
- login: LOGIN
145
- password: PASSWORD
146
-
147
- plugnpay:
148
- login: LOGIN
149
- password: PASSWORD
150
-
151
- sage_pay:
152
- login: LOGIN
153
-
154
- # Working credentials, no need to replace
155
- psigate:
156
- login: teststore
157
- password: psigate1234
158
-
159
- psl_card:
160
- login: LOGIN
161
-
162
- # PSL doesn't want the test data made public
163
- psl_maestro:
164
- number:
165
- month:
166
- year:
167
- verification_value:
168
- issue_number:
169
-
170
- psl_maestro_address:
171
- address1:
172
- address2:
173
- city:
174
- state:
175
- zip:
176
-
177
- psl_solo:
178
- number:
179
- month:
180
- year:
181
- verification_value:
182
- issue_number:
183
-
184
- psl_solo_address:
185
- address1:
186
- city:
187
- state:
188
- zip:
189
-
190
- psl_visa:
191
- number:
192
- month:
193
- year:
194
- verification_value:
195
-
196
- psl_visa_address:
197
- address1:
198
- address2:
199
- address3:
200
- city:
201
- zip:
202
-
203
- psl_visa_debit:
204
- first_name:
205
- last_name:
206
- number:
207
- month:
208
- year:
209
- verification_value:
210
-
211
- psl_visa_debit_address:
212
- address1:
213
- address2:
214
- address3:
215
- city:
216
- state:
217
- zip:
218
-
219
- quickpay:
220
- login: 89898989
221
- password: "n5KrR5e2538awi9hUk6728LHTQ6E4uG1z4IFSb2pPN9j76DqJ2vA4698X315M1cd"
222
-
223
- realex:
224
- login: X
225
- password: Y
226
-
227
- realex_with_account:
228
- login: X
229
- password: Y
230
- account: testaccount
231
-
232
- # Realex doesn't provide public testing data
233
- # Fill in the card numbers with the Realex test
234
- # data.
235
- realex_visa:
236
- number:
237
- month: '6'
238
- year: '2020'
239
- verification_value: '123'
240
-
241
- realex_visa_declined:
242
- number:
243
- month: '6'
244
- year: '2020'
245
- verification_value: '123'
246
-
247
- realex_visa_referral_a:
248
- number:
249
- month: '6'
250
- year: '2020'
251
- verification_value: '123'
252
-
253
- realex_visa_referral_b:
254
- number:
255
- month: '6'
256
- year: '2020'
257
- verification_value: '123'
258
-
259
- realex_visa_coms_error:
260
- number:
261
- month: '6'
262
- year: '2020'
263
- verification_value: '123'
264
-
265
- realex_mastercard:
266
- number:
267
- month: '6'
268
- year: '2020'
269
- verification_value: '123'
270
-
271
- realex_mastercard_declined:
272
- number:
273
- month: '6'
274
- year: '2020'
275
- verification_value: '123'
276
-
277
- realex_mastercard_referral_a:
278
- number:
279
- month: '6'
280
- year: '2020'
281
- verification_value: '123'
282
-
283
- realex_mastercard_referral_b:
284
- number:
285
- month: '6'
286
- year: '2020'
287
- verification_value: '123'
288
-
289
- realex_mastercard_coms_error:
290
- number:
291
- month: '6'
292
- year: '2020'
293
- verification_value: '123'
294
-
295
- sage:
296
- login: login
297
- password: password
298
-
299
- sallie_mae:
300
- login: TEST0
301
-
302
- secure_pay:
303
- login: LOGIN
304
- password: PASSWORD
305
-
306
- secure_pay_tech:
307
- login: TESTDIGISPL1
308
- password: d557591484cb2cd12bba445aba420d2c69cd6a88
309
-
310
- secure_pay_au:
311
- login:
312
- password:
313
-
314
- # Replace with your serial numbers for the skipjack test environment
315
- skipjack:
316
- login: X
317
- password: Y
318
-
319
- trans_first:
320
- login: LOGIN
321
- password: PASSWORD
322
-
323
- transax:
324
- login: demo
325
- password: password
326
-
327
- # Working credentials, no need to replace
328
- trust_commerce:
329
- login: 'TestMerchant'
330
- password: 'password'
331
-
332
- # Working credentials, no need to replace
333
- usa_epay:
334
- login: 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu'
335
-
336
- # Working credentials, no need to replace
337
- verify:
338
- login: 'demo'
339
- password: 'password'
340
-
341
- viaklix:
342
- login: LOGIN
343
- password: PASSWORD
344
- user: USER
345
-
346
- # Working test credentials, no need to replace
347
- wirecard:
348
- login: 56500
349
- password: TestXAPTER
350
-
351
- # replace with your Merchant eSolutions developer profile credentials
352
- merchant_esolutions:
353
- login: "profile_id"
354
- password: "profile_key"
355
-
@@ -1,460 +0,0 @@
1
- require 'test_helper'
2
- require 'pp'
3
-
4
- class AuthorizeNetCimTest < Test::Unit::TestCase
5
- def setup
6
- Base.mode = :test
7
-
8
- @gateway = AuthorizeNetCimGateway.new(fixtures(:authorize_net))
9
- @amount = 100
10
- @credit_card = credit_card('4242424242424242')
11
- @payment = {
12
- :credit_card => @credit_card
13
- }
14
- @profile = {
15
- :merchant_customer_id => 'Up to 20 chars', # Optional
16
- :description => 'Up to 255 Characters', # Optional
17
- :email => 'Up to 255 Characters', # Optional
18
- :payment_profiles => { # Optional
19
- :customer_type => 'individual', # Optional
20
- :bill_to => @address,
21
- :payment => @payment
22
- },
23
- :ship_to_list => {
24
- :first_name => 'John',
25
- :last_name => 'Doe',
26
- :company => 'Widgets, Inc',
27
- :address1 => '1234 Fake Street',
28
- :city => 'Anytown',
29
- :state => 'MD',
30
- :zip => '12345',
31
- :country => 'USA',
32
- :phone_number => '(123)123-1234', # Optional - Up to 25 digits (no letters)
33
- :fax_number => '(123)123-1234' # Optional - Up to 25 digits (no letters)
34
- }
35
- }
36
- @options = {
37
- :ref_id => '1234', # Optional
38
- :profile => @profile
39
- }
40
- end
41
-
42
- def teardown
43
- if @customer_profile_id
44
- assert response = @gateway.delete_customer_profile(:customer_profile_id => @customer_profile_id)
45
- assert_success response
46
- @customer_profile_id = nil
47
- end
48
- end
49
-
50
- def test_successful_profile_create_get_update_and_delete
51
- assert response = @gateway.create_customer_profile(@options)
52
- @customer_profile_id = response.authorization
53
-
54
- assert_success response
55
- assert response.test?
56
-
57
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
58
- assert response.test?
59
- assert_success response
60
- assert_equal @customer_profile_id, response.authorization
61
- assert_equal 'Successful.', response.message
62
- assert response.params['profile']['payment_profiles']['customer_payment_profile_id'] =~ /\d+/, 'The customer_payment_profile_id should be a number'
63
- assert_equal "XXXX#{@credit_card.last_digits}", response.params['profile']['payment_profiles']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in #{@credit_card.last_digits}"
64
- assert_equal @profile[:merchant_customer_id], response.params['profile']['merchant_customer_id']
65
- assert_equal @profile[:description], response.params['profile']['description']
66
- assert_equal @profile[:email], response.params['profile']['email']
67
- assert_equal @profile[:payment_profiles][:customer_type], response.params['profile']['payment_profiles']['customer_type']
68
- assert_equal @profile[:ship_to_list][:phone_number], response.params['profile']['ship_to_list']['phone_number']
69
- assert_equal @profile[:ship_to_list][:company], response.params['profile']['ship_to_list']['company']
70
-
71
- assert response = @gateway.update_customer_profile(:profile => {:customer_profile_id => @customer_profile_id, :email => 'new email address'})
72
- assert response.test?
73
- assert_success response
74
- assert_nil response.authorization
75
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
76
- assert_nil response.params['profile']['merchant_customer_id']
77
- assert_nil response.params['profile']['description']
78
- assert_equal 'new email address', response.params['profile']['email']
79
- end
80
-
81
- def test_successful_create_customer_profile_transaction_auth_only_and_then_capture_only_requests
82
- assert response = @gateway.create_customer_profile(@options)
83
- @customer_profile_id = response.authorization
84
-
85
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
86
- @customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
87
-
88
- assert response = @gateway.create_customer_profile_transaction(
89
- :transaction => {
90
- :customer_profile_id => @customer_profile_id,
91
- :customer_payment_profile_id => @customer_payment_profile_id,
92
- :type => :auth_only,
93
- :amount => @amount
94
- }
95
- )
96
-
97
- assert response.test?
98
- assert_success response
99
- assert_nil response.authorization
100
- assert_equal "This transaction has been approved.", response.params['direct_response']['message']
101
- assert response.params['direct_response']['approval_code'] =~ /\w{6}/
102
- assert_equal "auth_only", response.params['direct_response']['transaction_type']
103
- assert_equal "100.00", response.params['direct_response']['amount']
104
- assert_match /\d+/, response.params['direct_response']['transaction_id']
105
-
106
- approval_code = response.params['direct_response']['approval_code']
107
-
108
- # Capture the previously authorized funds
109
-
110
- assert response = @gateway.create_customer_profile_transaction(
111
- :transaction => {
112
- :customer_profile_id => @customer_profile_id,
113
- :customer_payment_profile_id => @customer_payment_profile_id,
114
- :type => :capture_only,
115
- :amount => @amount,
116
- :approval_code => approval_code
117
- }
118
- )
119
-
120
- assert response.test?
121
- assert_success response
122
- assert_nil response.authorization
123
- assert_equal "This transaction has been approved.", response.params['direct_response']['message']
124
- assert_equal approval_code, response.params['direct_response']['approval_code']
125
- assert_equal "capture_only", response.params['direct_response']['transaction_type']
126
- assert_equal "100.00", response.params['direct_response']['amount']
127
- end
128
-
129
- def test_successful_create_customer_profile_transaction_auth_capture_request
130
- assert response = @gateway.create_customer_profile(@options)
131
- @customer_profile_id = response.authorization
132
-
133
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
134
- @customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
135
-
136
- assert response = @gateway.create_customer_profile_transaction(
137
- :transaction => {
138
- :customer_profile_id => @customer_profile_id,
139
- :customer_payment_profile_id => @customer_payment_profile_id,
140
- :type => :auth_capture,
141
- :order => {
142
- :invoice_number => '1234',
143
- :description => 'Test Order Description',
144
- :purchase_order_number => '4321'
145
- },
146
- :amount => @amount
147
- }
148
- )
149
-
150
- assert response.test?
151
- assert_success response
152
- assert_nil response.authorization
153
- assert_equal "This transaction has been approved.", response.params['direct_response']['message']
154
- assert response.params['direct_response']['approval_code'] =~ /\w{6}/
155
- assert_equal "auth_capture", response.params['direct_response']['transaction_type']
156
- assert_equal "100.00", response.params['direct_response']['amount']
157
- assert_equal response.params['direct_response']['invoice_number'], '1234'
158
- assert_equal response.params['direct_response']['order_description'], 'Test Order Description'
159
- assert_equal response.params['direct_response']['purchase_order_number'], '4321'
160
- end
161
-
162
- def test_successful_create_customer_payment_profile_request
163
- payment_profile = @options[:profile].delete(:payment_profiles)
164
- assert response = @gateway.create_customer_profile(@options)
165
- @customer_profile_id = response.authorization
166
-
167
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
168
- assert_nil response.params['profile']['payment_profiles']
169
-
170
- assert response = @gateway.create_customer_payment_profile(
171
- :customer_profile_id => @customer_profile_id,
172
- :payment_profile => payment_profile
173
- )
174
-
175
- assert response.test?
176
- assert_success response
177
- assert_nil response.authorization
178
- assert customer_payment_profile_id = response.params['customer_payment_profile_id']
179
- assert customer_payment_profile_id =~ /\d+/, "The customerPaymentProfileId should be numeric. It was #{customer_payment_profile_id}"
180
- end
181
-
182
- def test_successful_create_customer_payment_profile_request_with_bank_account
183
- payment_profile = @options[:profile].delete(:payment_profiles)
184
- assert response = @gateway.create_customer_profile(@options)
185
- @customer_profile_id = response.authorization
186
-
187
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
188
- assert_nil response.params['profile']['payment_profiles']
189
-
190
- assert response = @gateway.create_customer_payment_profile(
191
- :customer_profile_id => @customer_profile_id,
192
- :payment_profile => {
193
- :customer_type => 'individual', # Optional
194
- :bill_to => @address,
195
- :payment => {
196
- :bank_account => {
197
- :account_type => :checking,
198
- :name_on_account => 'John Doe',
199
- :echeck_type => :ccd,
200
- :bank_name => 'Bank of America',
201
- :routing_number => '123456789',
202
- :account_number => '12345'
203
- }
204
- },
205
- :drivers_license => {
206
- :state => 'MD',
207
- :number => '12345',
208
- :date_of_birth => '1981-3-31'
209
- },
210
- :tax_id => '123456789'
211
- }
212
- )
213
-
214
- assert response.test?
215
- assert_success response
216
- assert_nil response.authorization
217
- assert customer_payment_profile_id = response.params['customer_payment_profile_id']
218
- assert customer_payment_profile_id =~ /\d+/, "The customerPaymentProfileId should be numeric. It was #{customer_payment_profile_id}"
219
- end
220
-
221
- def test_successful_create_customer_shipping_address_request
222
- shipping_address = @options[:profile].delete(:ship_to_list)
223
- assert response = @gateway.create_customer_profile(@options)
224
- @customer_profile_id = response.authorization
225
-
226
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
227
- assert_nil response.params['profile']['ship_to_list']
228
-
229
- assert response = @gateway.create_customer_shipping_address(
230
- :customer_profile_id => @customer_profile_id,
231
- :address => shipping_address
232
- )
233
-
234
- assert response.test?
235
- assert_success response
236
- assert_nil response.authorization
237
- assert customer_address_id = response.params['customer_address_id']
238
- assert customer_address_id =~ /\d+/, "The customerAddressId should be numeric. It was #{customer_address_id}"
239
- end
240
-
241
- def test_successful_get_customer_profile_with_multiple_payment_profiles
242
- second_payment_profile = {
243
- :customer_type => 'individual',
244
- :bill_to => @address,
245
- :payment => {
246
- :credit_card => credit_card('1234123412341234')
247
- }
248
- }
249
- assert response = @gateway.create_customer_profile(@options)
250
- @customer_profile_id = response.authorization
251
-
252
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
253
-
254
- assert response = @gateway.create_customer_payment_profile(
255
- :customer_profile_id => @customer_profile_id,
256
- :payment_profile => second_payment_profile
257
- )
258
-
259
- assert response.test?
260
- assert_success response
261
- assert_nil response.authorization
262
- assert customer_payment_profile_id = response.params['customer_payment_profile_id']
263
- assert customer_payment_profile_id =~ /\d+/, "The customerPaymentProfileId should be numeric. It was #{customer_payment_profile_id}"
264
-
265
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
266
- assert_equal 2, response.params['profile']['payment_profiles'].size
267
- assert_equal 'XXXX4242', response.params['profile']['payment_profiles'][0]['payment']['credit_card']['card_number']
268
- assert_equal 'XXXX1234', response.params['profile']['payment_profiles'][1]['payment']['credit_card']['card_number']
269
- end
270
-
271
- def test_successful_delete_customer_payment_profile_request
272
- assert response = @gateway.create_customer_profile(@options)
273
- @customer_profile_id = response.authorization
274
-
275
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
276
- assert customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
277
-
278
- assert response = @gateway.delete_customer_payment_profile(
279
- :customer_profile_id => @customer_profile_id,
280
- :customer_payment_profile_id => customer_payment_profile_id
281
- )
282
-
283
- assert response.test?
284
- assert_success response
285
- assert_nil response.authorization
286
-
287
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
288
- assert_nil response.params['profile']['payment_profiles']
289
- end
290
-
291
- def test_successful_delete_customer_shipping_address_request
292
- assert response = @gateway.create_customer_profile(@options)
293
- @customer_profile_id = response.authorization
294
-
295
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
296
- assert customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
297
-
298
- assert response = @gateway.delete_customer_shipping_address(
299
- :customer_profile_id => @customer_profile_id,
300
- :customer_address_id => customer_address_id
301
- )
302
-
303
- assert response.test?
304
- assert_success response
305
- assert_nil response.authorization
306
-
307
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
308
- assert_nil response.params['profile']['ship_to_list']
309
- end
310
-
311
- def test_successful_get_customer_payment_profile_request
312
- assert response = @gateway.create_customer_profile(@options)
313
- @customer_profile_id = response.authorization
314
-
315
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
316
- assert customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
317
-
318
- assert response = @gateway.get_customer_payment_profile(
319
- :customer_profile_id => @customer_profile_id,
320
- :customer_payment_profile_id => customer_payment_profile_id
321
- )
322
-
323
- assert response.test?
324
- assert_success response
325
- assert_nil response.authorization
326
- assert response.params['payment_profile']['customer_payment_profile_id'] =~ /\d+/, 'The customer_payment_profile_id should be a number'
327
- assert_equal "XXXX#{@credit_card.last_digits}", response.params['payment_profile']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in #{@credit_card.last_digits}"
328
- assert_equal @profile[:payment_profiles][:customer_type], response.params['payment_profile']['customer_type']
329
- end
330
-
331
- def test_successful_get_customer_shipping_address_request
332
- assert response = @gateway.create_customer_profile(@options)
333
- @customer_profile_id = response.authorization
334
-
335
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
336
- assert customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
337
-
338
- assert response = @gateway.get_customer_shipping_address(
339
- :customer_profile_id => @customer_profile_id,
340
- :customer_address_id => customer_address_id
341
- )
342
-
343
- assert response.test?
344
- assert_success response
345
- assert_nil response.authorization
346
- assert response.params['address']['customer_address_id'] =~ /\d+/, 'The customer_address_id should be a number'
347
- assert_equal @profile[:ship_to_list][:city], response.params['address']['city']
348
- end
349
-
350
- def test_successful_update_customer_payment_profile_request
351
- # Create a new Customer Profile with Payment Profile
352
- assert response = @gateway.create_customer_profile(@options)
353
- @customer_profile_id = response.authorization
354
-
355
- # Get the customerPaymentProfileId
356
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
357
- assert customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
358
-
359
- # Get the customerPaymentProfile
360
- assert response = @gateway.get_customer_payment_profile(
361
- :customer_profile_id => @customer_profile_id,
362
- :customer_payment_profile_id => customer_payment_profile_id
363
- )
364
-
365
- # The value before updating
366
- assert_equal "XXXX4242", response.params['payment_profile']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in 4242"
367
-
368
- #Update the payment profile
369
- assert response = @gateway.update_customer_payment_profile(
370
- :customer_profile_id => @customer_profile_id,
371
- :payment_profile => {
372
- :customer_payment_profile_id => customer_payment_profile_id,
373
- :payment => {
374
- :credit_card => credit_card('1234123412341234')
375
- }
376
- }
377
- )
378
- assert response.test?
379
- assert_success response
380
- assert_nil response.authorization
381
-
382
- # Get the updated payment profile
383
- assert response = @gateway.get_customer_payment_profile(
384
- :customer_profile_id => @customer_profile_id,
385
- :customer_payment_profile_id => customer_payment_profile_id
386
- )
387
-
388
- # Show that the payment profile was updated
389
- assert_equal "XXXX1234", response.params['payment_profile']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in: 1234"
390
- # Show that fields that were left out of the update were cleared
391
- assert_nil response.params['payment_profile']['customer_type']
392
- end
393
-
394
- def test_successful_update_customer_shipping_address_request
395
- # Create a new Customer Profile with Shipping Address
396
- assert response = @gateway.create_customer_profile(@options)
397
- @customer_profile_id = response.authorization
398
-
399
- # Get the customerAddressId
400
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
401
- assert customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
402
-
403
- # Get the customerShippingAddress
404
- assert response = @gateway.get_customer_shipping_address(
405
- :customer_profile_id => @customer_profile_id,
406
- :customer_address_id => customer_address_id
407
- )
408
-
409
- assert address = response.params['address']
410
- # The value before updating
411
- assert_equal "1234 Fake Street", address['address']
412
-
413
- # Update the address and remove the phone_number
414
- new_address = address.symbolize_keys.merge!(
415
- :address => '5678 Fake Street'
416
- )
417
- new_address.delete(:phone_number)
418
-
419
- #Update the shipping address
420
- assert response = @gateway.update_customer_shipping_address(
421
- :customer_profile_id => @customer_profile_id,
422
- :address => new_address
423
- )
424
- assert response.test?
425
- assert_success response
426
- assert_nil response.authorization
427
-
428
- # Get the updated shipping address
429
- assert response = @gateway.get_customer_shipping_address(
430
- :customer_profile_id => @customer_profile_id,
431
- :customer_address_id => customer_address_id
432
- )
433
-
434
- # Show that the shipping address was updated
435
- assert_equal "5678 Fake Street", response.params['address']['address']
436
- # Show that fields that were left out of the update were cleared
437
- assert_nil response.params['address']['phone_number']
438
- end
439
-
440
- def test_successful_validate_customer_payment_profile_request
441
- assert response = @gateway.create_customer_profile(@options)
442
- @customer_profile_id = response.authorization
443
-
444
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
445
- assert @customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
446
- assert @customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
447
-
448
- assert response = @gateway.validate_customer_payment_profile(
449
- :customer_profile_id => @customer_profile_id,
450
- :customer_payment_profile_id => @customer_payment_profile_id,
451
- :customer_address_id => @customer_address_id,
452
- :validation_mode => :live
453
- )
454
-
455
- assert response.test?
456
- assert_success response
457
- assert_nil response.authorization
458
- assert_equal "This transaction has been approved.", response.params['direct_response']['message']
459
- end
460
- end