activemerchant 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +310 -294
  3. data/CONTRIBUTERS +13 -0
  4. data/README +55 -31
  5. data/Rakefile +21 -13
  6. data/lib/active_merchant.rb +7 -0
  7. data/lib/active_merchant/billing/avs_result.rb +95 -0
  8. data/lib/active_merchant/billing/base.rb +8 -3
  9. data/lib/active_merchant/billing/check.rb +61 -0
  10. data/lib/active_merchant/billing/credit_card.rb +104 -80
  11. data/lib/active_merchant/billing/credit_card_formatting.rb +11 -8
  12. data/lib/active_merchant/billing/credit_card_methods.rb +76 -32
  13. data/lib/active_merchant/billing/cvv_result.rb +38 -0
  14. data/lib/active_merchant/billing/expiry_date.rb +28 -0
  15. data/lib/active_merchant/billing/gateway.rb +47 -111
  16. data/lib/active_merchant/billing/gateways/authorize_net.rb +508 -121
  17. data/lib/active_merchant/billing/gateways/bogus.rb +26 -32
  18. data/lib/active_merchant/billing/gateways/brain_tree.rb +82 -70
  19. data/lib/active_merchant/billing/gateways/card_stream.rb +43 -15
  20. data/lib/active_merchant/billing/gateways/cyber_source.rb +9 -29
  21. data/lib/active_merchant/billing/gateways/data_cash.rb +18 -38
  22. data/lib/active_merchant/billing/gateways/efsnet.rb +23 -50
  23. data/lib/active_merchant/billing/gateways/eway.rb +8 -19
  24. data/lib/active_merchant/billing/gateways/exact.rb +17 -25
  25. data/lib/active_merchant/billing/gateways/linkpoint.rb +18 -25
  26. data/lib/active_merchant/billing/gateways/moneris.rb +9 -39
  27. data/lib/active_merchant/billing/gateways/net_registry.rb +113 -182
  28. data/lib/active_merchant/billing/gateways/netbilling.rb +168 -0
  29. data/lib/active_merchant/billing/gateways/pay_junction.rb +52 -73
  30. data/lib/active_merchant/billing/gateways/pay_secure.rb +120 -0
  31. data/lib/active_merchant/billing/gateways/payflow.rb +13 -14
  32. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +55 -37
  33. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +4 -0
  34. data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -4
  35. data/lib/active_merchant/billing/gateways/payment_express.rb +11 -30
  36. data/lib/active_merchant/billing/gateways/paypal.rb +3 -14
  37. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +36 -16
  38. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -2
  39. data/lib/active_merchant/billing/gateways/plugnpay.rb +7 -15
  40. data/lib/active_merchant/billing/gateways/protx.rb +24 -25
  41. data/lib/active_merchant/billing/gateways/psigate.rb +34 -71
  42. data/lib/active_merchant/billing/gateways/psl_card.rb +24 -19
  43. data/lib/active_merchant/billing/gateways/quickpay.rb +10 -24
  44. data/lib/active_merchant/billing/gateways/realex.rb +7 -19
  45. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +113 -0
  46. data/lib/active_merchant/billing/gateways/skip_jack.rb +437 -0
  47. data/lib/active_merchant/billing/gateways/trans_first.rb +5 -14
  48. data/lib/active_merchant/billing/gateways/trust_commerce.rb +100 -39
  49. data/lib/active_merchant/billing/gateways/usa_epay.rb +60 -55
  50. data/lib/active_merchant/billing/gateways/verifi.rb +32 -39
  51. data/lib/active_merchant/billing/gateways/viaklix.rb +31 -37
  52. data/lib/active_merchant/billing/integrations.rb +2 -0
  53. data/lib/active_merchant/billing/integrations/bogus.rb +5 -0
  54. data/lib/active_merchant/billing/integrations/bogus/return.rb +10 -0
  55. data/lib/active_merchant/billing/integrations/chronopay.rb +5 -0
  56. data/lib/active_merchant/billing/integrations/chronopay/return.rb +10 -0
  57. data/lib/active_merchant/billing/integrations/gestpay.rb +5 -0
  58. data/lib/active_merchant/billing/integrations/gestpay/return.rb +10 -0
  59. data/lib/active_merchant/billing/integrations/hi_trust.rb +26 -0
  60. data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +58 -0
  61. data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +57 -0
  62. data/lib/active_merchant/billing/integrations/hi_trust/return.rb +67 -0
  63. data/lib/active_merchant/billing/integrations/nochex.rb +5 -0
  64. data/lib/active_merchant/billing/integrations/nochex/return.rb +10 -0
  65. data/lib/active_merchant/billing/integrations/paypal.rb +5 -0
  66. data/lib/active_merchant/billing/integrations/paypal/return.rb +10 -0
  67. data/lib/active_merchant/billing/integrations/return.rb +35 -0
  68. data/lib/active_merchant/billing/integrations/two_checkout.rb +5 -0
  69. data/lib/active_merchant/billing/integrations/two_checkout/return.rb +17 -0
  70. data/lib/active_merchant/billing/response.rb +12 -8
  71. data/lib/active_merchant/lib/posts_data.rb +39 -7
  72. data/lib/active_merchant/lib/requires_parameters.rb +2 -3
  73. data/lib/active_merchant/lib/utils.rb +18 -0
  74. data/lib/active_merchant/lib/validateable.rb +3 -3
  75. data/lib/support/gateway_support.rb +22 -9
  76. data/script/destroy +14 -0
  77. data/script/generate +7 -7
  78. data/test/fixtures.yml +25 -3
  79. data/test/remote/gateways/remote_authorize_net_test.rb +145 -0
  80. data/test/remote/gateways/remote_brain_tree_test.rb +118 -0
  81. data/test/{remote_tests → remote/gateways}/remote_card_stream_test.rb +56 -68
  82. data/test/{remote_tests → remote/gateways}/remote_cyber_source_test.rb +21 -32
  83. data/test/{remote_tests → remote/gateways}/remote_data_cash_test.rb +2 -2
  84. data/test/{remote_tests → remote/gateways}/remote_efsnet_test.rb +22 -34
  85. data/test/{remote_tests → remote/gateways}/remote_eway_test.rb +18 -15
  86. data/test/{remote_tests → remote/gateways}/remote_exact_test.rb +20 -19
  87. data/test/{remote_tests → remote/gateways}/remote_linkpoint_test.rb +31 -63
  88. data/test/remote/gateways/remote_moneris_test.rb +82 -0
  89. data/test/{remote_tests → remote/gateways}/remote_net_registry_test.rb +19 -54
  90. data/test/remote/gateways/remote_netbilling_test.rb +70 -0
  91. data/test/{remote_tests → remote/gateways}/remote_pay_junction_test.rb +41 -60
  92. data/test/remote/gateways/remote_pay_secure_test.rb +39 -0
  93. data/test/{remote_tests → remote/gateways}/remote_payflow_express_test.rb +2 -2
  94. data/test/{remote_tests → remote/gateways}/remote_payflow_test.rb +34 -38
  95. data/test/{remote_tests → remote/gateways}/remote_payflow_uk_test.rb +13 -12
  96. data/test/{remote_tests → remote/gateways}/remote_payment_express_test.rb +26 -36
  97. data/test/{remote_tests → remote/gateways}/remote_paypal_express_test.rb +3 -3
  98. data/test/{remote_tests → remote/gateways}/remote_paypal_test.rb +25 -21
  99. data/test/{remote_tests → remote/gateways}/remote_plugnpay_test.rb +18 -16
  100. data/test/{remote_tests → remote/gateways}/remote_protx_test.rb +33 -33
  101. data/test/remote/gateways/remote_psigate_test.rb +50 -0
  102. data/test/{remote_tests → remote/gateways}/remote_psl_card_test.rb +27 -26
  103. data/test/{remote_tests → remote/gateways}/remote_quickpay_test.rb +48 -48
  104. data/test/{remote_tests → remote/gateways}/remote_realex_test.rb +30 -33
  105. data/test/remote/gateways/remote_secure_pay_tech_test.rb +37 -0
  106. data/test/remote/gateways/remote_secure_pay_test.rb +28 -0
  107. data/test/remote/gateways/remote_skipjack_test.rb +105 -0
  108. data/test/{remote_tests → remote/gateways}/remote_trans_first_test.rb +7 -10
  109. data/test/remote/gateways/remote_trust_commerce_test.rb +152 -0
  110. data/test/{remote_tests → remote/gateways}/remote_usa_epay_test.rb +11 -22
  111. data/test/{remote_tests → remote/gateways}/remote_verifi_test.rb +27 -27
  112. data/test/{remote_tests → remote/gateways}/remote_viaklix_test.rb +8 -18
  113. data/test/{remote_tests → remote/integrations}/remote_gestpay_integration_test.rb +1 -1
  114. data/test/{remote_tests → remote/integrations}/remote_paypal_integration_test.rb +1 -1
  115. data/test/test_helper.rb +102 -61
  116. data/test/unit/avs_result_test.rb +59 -0
  117. data/test/unit/base_test.rb +33 -39
  118. data/test/unit/check_test.rb +76 -0
  119. data/test/unit/credit_card_formatting_test.rb +10 -15
  120. data/test/unit/credit_card_methods_test.rb +132 -17
  121. data/test/unit/credit_card_test.rb +157 -228
  122. data/test/unit/cvv_result_test.rb +33 -0
  123. data/test/unit/expiry_date_test.rb +21 -0
  124. data/test/unit/gateways/authorize_net_test.rb +180 -40
  125. data/test/unit/gateways/bogus_test.rb +2 -3
  126. data/test/unit/gateways/brain_tree_test.rb +63 -29
  127. data/test/unit/gateways/card_stream_test.rb +59 -6
  128. data/test/unit/gateways/cyber_source_test.rb +59 -40
  129. data/test/unit/gateways/data_cash_test.rb +82 -1
  130. data/test/unit/gateways/efsnet_test.rb +97 -44
  131. data/test/unit/gateways/eway_test.rb +55 -42
  132. data/test/unit/gateways/exact_test.rb +93 -55
  133. data/test/unit/gateways/gateway_test.rb +7 -0
  134. data/test/unit/gateways/linkpoint_test.rb +60 -58
  135. data/test/unit/gateways/moneris_test.rb +67 -76
  136. data/test/unit/gateways/net_registry_test.rb +351 -419
  137. data/test/unit/gateways/netbilling_test.rb +54 -0
  138. data/test/unit/gateways/pay_junction_test.rb +108 -46
  139. data/test/unit/gateways/pay_secure_test.rb +71 -0
  140. data/test/unit/gateways/payflow_express_test.rb +0 -8
  141. data/test/unit/gateways/payflow_test.rb +136 -65
  142. data/test/unit/gateways/payflow_uk_test.rb +0 -38
  143. data/test/unit/gateways/payment_express_test.rb +31 -51
  144. data/test/unit/gateways/paypal_express_test.rb +8 -2
  145. data/test/unit/gateways/paypal_test.rb +213 -54
  146. data/test/unit/gateways/plugnpay_test.rb +39 -32
  147. data/test/unit/gateways/protx_test.rb +45 -33
  148. data/test/unit/gateways/psigate_test.rb +146 -87
  149. data/test/unit/gateways/psl_card_test.rb +37 -24
  150. data/test/unit/gateways/quickpay_test.rb +33 -46
  151. data/test/unit/gateways/realex_test.rb +32 -31
  152. data/test/unit/gateways/secure_pay_tech_test.rb +44 -0
  153. data/test/unit/gateways/secure_pay_test.rb +35 -26
  154. data/test/unit/gateways/skip_jack_test.rb +125 -0
  155. data/test/unit/gateways/trans_first_test.rb +24 -37
  156. data/test/unit/gateways/trust_commerce_test.rb +47 -26
  157. data/test/unit/gateways/usa_epay_test.rb +52 -41
  158. data/test/unit/gateways/verifi_test.rb +41 -35
  159. data/test/unit/gateways/viaklix_test.rb +38 -32
  160. data/test/unit/generators/test_gateway_generator.rb +46 -0
  161. data/test/unit/generators/test_generator_helper.rb +20 -0
  162. data/test/unit/generators/test_integration_generator.rb +53 -0
  163. data/test/unit/integrations/action_view_helper_test.rb +7 -14
  164. data/test/unit/integrations/bogus_module_test.rb +4 -0
  165. data/test/unit/integrations/chronopay_module_test.rb +4 -0
  166. data/test/unit/integrations/gestpay_module_test.rb +4 -0
  167. data/test/unit/integrations/helpers/hi_trust_helper_test.rb +16 -0
  168. data/test/unit/integrations/hi_trust_module_test.rb +13 -0
  169. data/test/unit/integrations/nochex_module_test.rb +4 -0
  170. data/test/unit/integrations/notifications/hi_trust_notification_test.rb +38 -0
  171. data/test/unit/integrations/paypal_module_test.rb +4 -0
  172. data/test/unit/integrations/returns/chronopay_return_test.rb +11 -0
  173. data/test/unit/integrations/returns/gestpay_return_test.rb +10 -0
  174. data/test/unit/integrations/returns/hi_trust_return_test.rb +24 -0
  175. data/test/unit/integrations/returns/nochex_return_test.rb +10 -0
  176. data/test/unit/integrations/returns/paypal_return_test.rb +10 -0
  177. data/test/unit/integrations/returns/return_test.rb +11 -0
  178. data/test/unit/integrations/returns/two_checkout_return_test.rb +24 -0
  179. data/test/unit/integrations/two_checkout_module_test.rb +4 -0
  180. data/test/unit/posts_data_test.rb +86 -0
  181. data/test/unit/response_test.rb +15 -1
  182. data/test/unit/utils_test.rb +7 -0
  183. data/test/unit/validateable_test.rb +10 -6
  184. metadata +180 -142
  185. metadata.gz.sig +0 -0
  186. data/lib/active_merchant/billing/gateways/paypal/api_cert_chain.crt +0 -35
  187. data/script/generator/base.rb +0 -45
  188. data/script/generator/generator.rb +0 -24
  189. data/script/generator/generators/gateway/gateway_generator.rb +0 -14
  190. data/script/generator/generators/gateway/templates/gateway.rb +0 -73
  191. data/script/generator/generators/gateway/templates/gateway_test.rb +0 -41
  192. data/script/generator/generators/gateway/templates/remote_gateway_test.rb +0 -56
  193. data/script/generator/generators/integration/integration_generator.rb +0 -25
  194. data/script/generator/generators/integration/templates/helper.rb +0 -34
  195. data/script/generator/generators/integration/templates/helper_test.rb +0 -54
  196. data/script/generator/generators/integration/templates/integration.rb +0 -18
  197. data/script/generator/generators/integration/templates/module_test.rb +0 -9
  198. data/script/generator/generators/integration/templates/notification.rb +0 -100
  199. data/script/generator/generators/integration/templates/notification_test.rb +0 -41
  200. data/script/generator/manifest.rb +0 -20
  201. data/test/remote_tests/remote_authorize_net_test.rb +0 -113
  202. data/test/remote_tests/remote_brain_tree_test.rb +0 -78
  203. data/test/remote_tests/remote_moneris_test.rb +0 -110
  204. data/test/remote_tests/remote_psigate_test.rb +0 -87
  205. data/test/remote_tests/remote_secure_pay_test.rb +0 -36
  206. data/test/remote_tests/remote_trust_commerce_test.rb +0 -136
@@ -1,24 +1,21 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
1
+ require File.dirname(__FILE__) + '/../../test_helper'
2
2
 
3
3
  class RemoteTransFirstTest < Test::Unit::TestCase
4
- AMOUNT = 100
5
4
 
6
5
  def setup
7
6
  @gateway = TransFirstGateway.new(fixtures(:trans_first))
8
7
 
9
- @creditcard = credit_card('4111111111111111')
10
-
8
+ @credit_card = credit_card('4111111111111111')
9
+ @amount = 100
11
10
  @options = {
12
- :order_id => generate_order_id,
11
+ :order_id => generate_unique_id,
13
12
  :invoice => 'ActiveMerchant Sale',
14
- :address => { :address1 => '1234 Shady Brook Lane',
15
- :zip => '90210'
16
- }
13
+ :billing_address => address
17
14
  }
18
15
  end
19
16
 
20
17
  def test_successful_purchase
21
- assert response = @gateway.purchase(AMOUNT, @creditcard, @options)
18
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
22
19
  assert_equal 'test transaction', response.message
23
20
  assert response.test?
24
21
  assert_success response
@@ -30,7 +27,7 @@ class RemoteTransFirstTest < Test::Unit::TestCase
30
27
  :login => '',
31
28
  :password => ''
32
29
  )
33
- assert response = gateway.purchase(AMOUNT, @creditcard, @options)
30
+ assert response = gateway.purchase(@amount, @credit_card, @options)
34
31
  assert_equal 'invalid account', response.message
35
32
  assert_failure response
36
33
  end
@@ -0,0 +1,152 @@
1
+ require File.dirname(__FILE__) + '/../../test_helper'
2
+
3
+ class TrustCommerceTest < Test::Unit::TestCase
4
+ def setup
5
+ @gateway = TrustCommerceGateway.new(fixtures(:trust_commerce))
6
+
7
+ @credit_card = credit_card('4111111111111111')
8
+
9
+ @amount = 100
10
+
11
+ @valid_verification_value = '123'
12
+ @invalid_verification_value = '1234'
13
+
14
+ @valid_address = {
15
+ :address1 => '123 Test St.',
16
+ :address2 => nil,
17
+ :city => 'Somewhere',
18
+ :state => 'CA',
19
+ :zip => '90001'
20
+ }
21
+
22
+ @invalid_address = {
23
+ :address1 => '187 Apple Tree Lane.',
24
+ :address2 => nil,
25
+ :city => 'Woodside',
26
+ :state => 'CA',
27
+ :zip => '94062'
28
+ }
29
+
30
+ @options = {
31
+ :ip => '10.10.10.10',
32
+ :order_id => '#1000.1',
33
+ :email => 'cody@example.com',
34
+ :billing_address => @valid_address,
35
+ :shipping_address => @valid_address
36
+ }
37
+ end
38
+
39
+ def test_bad_login
40
+ @gateway.options[:login] = 'X'
41
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
42
+
43
+ assert_equal Response, response.class
44
+ assert_equal ["error",
45
+ "offenders",
46
+ "status"], response.params.keys.sort
47
+
48
+ assert_match /A field was improperly formatted, such as non-digit characters in a number field/, response.message
49
+
50
+ assert_failure response
51
+ end
52
+
53
+ def test_successful_purchase_with_avs
54
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
55
+ assert_equal 'Y', response.avs_result['code']
56
+ assert_match /The transaction was successful/, response.message
57
+
58
+ assert_success response
59
+ assert !response.authorization.blank?
60
+ end
61
+
62
+ def test_unsuccessful_purchase_with_invalid_cvv
63
+ @credit_card.verification_value = @invalid_verification_value
64
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
65
+
66
+ assert_equal Response, response.class
67
+ assert_match /CVV failed; the number provided is not the correct verification number for the card/, response.message
68
+ assert_failure response
69
+ end
70
+
71
+ def test_purchase_with_avs_for_invalid_address
72
+ assert response = @gateway.purchase(@amount, @credit_card, @options.update(:billing_address => @invalid_address))
73
+ assert_equal "N", response.params["avs"]
74
+ assert_match /The transaction was successful/, response.message
75
+ assert_success response
76
+ end
77
+
78
+ def test_successful_authorize_with_avs
79
+ assert response = @gateway.authorize(@amount, @credit_card, :billing_address => @valid_address)
80
+
81
+ assert_equal "Y", response.avs_result["code"]
82
+ assert_match /The transaction was successful/, response.message
83
+
84
+ assert_success response
85
+ assert !response.authorization.blank?
86
+ end
87
+
88
+ def test_unsuccessful_authorize_with_invalid_cvv
89
+ @credit_card.verification_value = @invalid_verification_value
90
+ assert response = @gateway.authorize(@amount, @credit_card, @options)
91
+ assert_match /CVV failed; the number provided is not the correct verification number for the card/, response.message
92
+ assert_failure response
93
+ end
94
+
95
+ def test_authorization_with_avs_for_invalid_address
96
+ assert response = @gateway.authorize(@amount, @credit_card, @options.update(:billing_address => @invalid_address))
97
+ assert_equal "N", response.params["avs"]
98
+ assert_match /The transaction was successful/, response.message
99
+ assert_success response
100
+ end
101
+
102
+ def test_successful_capture
103
+ auth = @gateway.authorize(300, @credit_card)
104
+ assert_success auth
105
+ response = @gateway.capture(300, auth.authorization)
106
+
107
+ assert_success response
108
+ assert_equal 'The transaction was successful', response.message
109
+ assert_equal 'accepted', response.params['status']
110
+ assert response.params['transid']
111
+ end
112
+
113
+ def test_authorization_and_void
114
+ auth = @gateway.authorize(300, @credit_card, @options)
115
+ assert_success auth
116
+
117
+ void = @gateway.void(auth.authorization)
118
+ assert_success void
119
+ assert_equal 'The transaction was successful', void.message
120
+ assert_equal 'accepted', void.params['status']
121
+ assert void.params['transid']
122
+ end
123
+
124
+ def test_successful_credit
125
+ assert response = @gateway.credit(@amount, '011-0022698151')
126
+
127
+ assert_match /The transaction was successful/, response.message
128
+ assert_success response
129
+ end
130
+
131
+ def test_store_failure
132
+ assert response = @gateway.store(@credit_card)
133
+
134
+ assert_equal Response, response.class
135
+ assert_match %r{The merchant can't accept data passed in this field}, response.message
136
+ assert_failure response
137
+ end
138
+
139
+ def test_unstore_failure
140
+ assert response = @gateway.unstore('testme')
141
+
142
+ assert_match %r{The merchant can't accept data passed in this field}, response.message
143
+ assert_failure response
144
+ end
145
+
146
+ def test_recurring_failure
147
+ assert response = @gateway.recurring(@amount, @credit_card, :periodicity => :weekly)
148
+
149
+ assert_match %r{The merchant can't accept data passed in this field}, response.message
150
+ assert_failure response
151
+ end
152
+ end
@@ -1,56 +1,45 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
1
+ require File.dirname(__FILE__) + '/../../test_helper'
2
2
 
3
3
  class RemoveUsaEpayTest < Test::Unit::TestCase
4
- # This key does not work in test mode. I believe test mode is designed
5
- # to work with real credit card numbers, but not charge them.
6
4
  def setup
7
- ActiveMerchant::Billing::Base.gateway_mode = :production
8
-
5
+ Base.gateway_mode = :test
9
6
  @gateway = UsaEpayGateway.new(fixtures(:usa_epay))
10
-
11
7
  @creditcard = credit_card('4000100011112224')
12
-
13
8
  @declined_card = credit_card('4000300011112220')
14
-
15
- @options = { :address => { :address1 => '1234 Shady Brook Lane',
16
- :zip => '90210'
17
- }
18
- }
9
+ @options = { :billing_address => address }
10
+ @amount = 100
19
11
  end
20
12
 
21
13
  def test_successful_purchase
22
- assert response = @gateway.purchase(100, @creditcard, @options)
14
+ assert response = @gateway.purchase(@amount, @creditcard, @options)
23
15
  assert_equal 'Success', response.message
24
16
  assert_success response
25
17
  end
26
18
 
27
19
  def test_unsuccessful_purchase
28
- assert response = @gateway.purchase(100, @declined_card, @options)
20
+ assert response = @gateway.purchase(@amount, @declined_card, @options)
29
21
  assert_equal 'Card Declined', response.message
30
22
  assert_failure response
31
23
  end
32
24
 
33
25
  def test_authorize_and_capture
34
- amount = 100
35
- assert auth = @gateway.authorize(amount, @creditcard, @options)
26
+ assert auth = @gateway.authorize(@amount, @creditcard, @options)
36
27
  assert_success auth
37
28
  assert_equal 'Success', auth.message
38
29
  assert auth.authorization
39
- assert capture = @gateway.capture(amount, auth.authorization)
30
+ assert capture = @gateway.capture(@amount, auth.authorization)
40
31
  assert_success capture
41
32
  end
42
33
 
43
34
  def test_failed_capture
44
- assert response = @gateway.capture(100, '')
35
+ assert response = @gateway.capture(@amount, '')
45
36
  assert_failure response
46
37
  assert_equal 'Unable to find original transaciton.', response.message
47
38
  end
48
39
 
49
40
  def test_invalid_key
50
- gateway = UsaEpayGateway.new({
51
- :login => ''
52
- })
53
- assert response = gateway.purchase(100, @creditcard, @options)
41
+ gateway = UsaEpayGateway.new(:login => '')
42
+ assert response = gateway.purchase(@amount, @creditcard, @options)
54
43
  assert_equal 'Specified source key not found.', response.message
55
44
  assert_failure response
56
45
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
1
+ require File.dirname(__FILE__) + '/../../test_helper'
2
2
 
3
3
  class VerifiTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing
@@ -6,58 +6,60 @@ class VerifiTest < Test::Unit::TestCase
6
6
  def setup
7
7
  @gateway = VerifiGateway.new(fixtures(:verify))
8
8
 
9
- @creditcard = credit_card('4111111111111111')
9
+ @credit_card = credit_card('4111111111111111')
10
10
 
11
11
  # Replace with your login and password for the Verifi test environment
12
12
  @options = {
13
- :order_id => 37,
14
- :email => "test@domain.com",
15
- :address => {
16
- :address1 => '164 Waverley Street',
17
- :address2 => 'APT #7',
18
- :country => 'US',
19
- :city => 'Boulder',
20
- :state => 'CO',
21
- :zip => 12345
22
- }
13
+ :order_id => '37',
14
+ :email => "test@example.com",
15
+ :billing_address => address
23
16
  }
17
+
18
+ @amount = 100
24
19
  end
25
20
 
26
21
  def test_successful_purchase
27
- assert response = @gateway.purchase(100, @creditcard, @options)
22
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
28
23
  assert_success response
29
24
  assert_equal 'Transaction was Approved', response.message
30
25
  assert !response.authorization.blank?
31
26
  end
32
27
 
28
+ def test_unsuccessful_purchase
29
+ @credit_card.number = 'invalid'
30
+
31
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
32
+ assert_failure response
33
+ assert_equal 'Transaction was Rejected by Gateway', response.message
34
+ end
35
+
33
36
  # FOR SOME REASON Verify DOESN'T MIND EXPIRED CARDS
34
37
  # I talked to support and they said that they are loose on expiration dates being expired.
35
38
  def test_expired_credit_card
36
- @creditcard.year = (Time.now.year - 3)
37
- assert response = @gateway.purchase(100, @creditcard, @options)
39
+ @credit_card.year = (Time.now.year - 3)
40
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
38
41
  assert_success response
39
42
  assert_equal 'Transaction was Approved', response.message
40
43
  end
41
44
 
42
45
  def test_successful_authorization
43
- assert response = @gateway.authorize(100, @creditcard, @options)
46
+ assert response = @gateway.authorize(@amount, @credit_card, @options)
44
47
  assert_success response
45
48
  assert_equal 'Transaction was Approved', response.message
46
49
  assert response.authorization
47
50
  end
48
51
 
49
52
  def test_authorization_and_capture
50
- amount = 100
51
- assert authorization = @gateway.authorize(amount, @creditcard, @options)
53
+ assert authorization = @gateway.authorize(@amount, @credit_card, @options)
52
54
  assert_success authorization
53
55
  assert authorization
54
- assert capture = @gateway.capture(amount, authorization.authorization, @options)
56
+ assert capture = @gateway.capture(@amount, authorization.authorization, @options)
55
57
  assert_success capture
56
58
  assert_equal 'Transaction was Approved', capture.message
57
59
  end
58
60
 
59
61
  def test_authorization_and_void
60
- assert authorization = @gateway.authorize(100, @creditcard, @options)
62
+ assert authorization = @gateway.authorize(@amount, @credit_card, @options)
61
63
  assert_success authorization
62
64
  assert authorization
63
65
  assert void = @gateway.void(authorization.authorization, @options)
@@ -67,14 +69,13 @@ class VerifiTest < Test::Unit::TestCase
67
69
 
68
70
  # Credits are not enabled on test accounts, so this should always fail
69
71
  def test_credit
70
- assert response = @gateway.credit(100, @creditcard, @options)
72
+ assert response = @gateway.credit(@amount, @credit_card, @options)
71
73
  assert_match /Credits are not enabled/, response.params['responsetext']
72
74
  assert_failure response
73
75
  end
74
76
 
75
77
  def test_authorization_and_void
76
- amount = 100
77
- assert authorization = @gateway.authorize(amount, @creditcard, @options)
78
+ assert authorization = @gateway.authorize(@amount, @credit_card, @options)
78
79
  assert_success authorization
79
80
  assert void = @gateway.void(authorization.authorization, @options)
80
81
  assert_success void
@@ -83,11 +84,10 @@ class VerifiTest < Test::Unit::TestCase
83
84
  end
84
85
 
85
86
  def test_purchase_and_credit
86
- amount = 100
87
- assert purchase = @gateway.purchase(amount, @creditcard, @options)
87
+ assert purchase = @gateway.purchase(@amount, @credit_card, @options)
88
88
  assert_success purchase
89
89
 
90
- assert credit = @gateway.credit(amount, purchase.authorization, @options)
90
+ assert credit = @gateway.credit(@amount, purchase.authorization, @options)
91
91
  assert_success credit
92
92
  assert_equal 'Transaction was Approved', credit.message
93
93
  end
@@ -98,7 +98,7 @@ class VerifiTest < Test::Unit::TestCase
98
98
  :password => 'Y'
99
99
  )
100
100
 
101
- assert response = gateway.purchase(100, @creditcard, @options)
101
+ assert response = gateway.purchase(@amount, @credit_card, @options)
102
102
  assert_equal 'Transaction was Rejected by Gateway', response.message
103
103
  assert_equal 'Authentication Failed', response.params['responsetext']
104
104
 
@@ -1,33 +1,23 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
1
+ require File.dirname(__FILE__) + '/../../test_helper'
2
2
 
3
3
  class RemoteViaklixTest < Test::Unit::TestCase
4
- include ActiveMerchant::Billing
5
-
6
-
7
4
  def setup
8
5
  @gateway = ViaklixGateway.new(fixtures(:viaklix))
9
6
 
10
- @credit_card = credit_card('4242424242424242')
11
-
7
+ @credit_card = credit_card
12
8
  @bad_credit_card = credit_card('invalid')
13
9
 
14
10
  @options = {
15
11
  :order_id => '#1000.1',
16
12
  :email => "paul@domain.com",
17
13
  :description => 'Test Transaction',
18
- :address => {
19
- :address1 => '164 Waverley Street',
20
- :address2 => 'APT #7',
21
- :country => 'US',
22
- :city => 'Boulder',
23
- :state => 'CO',
24
- :zip => '12345'
25
- }
14
+ :billing_address => address
26
15
  }
16
+ @amount = 100
27
17
  end
28
18
 
29
19
  def test_successful_purchase
30
- assert response = @gateway.purchase(100, @credit_card, @options)
20
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
31
21
 
32
22
  assert_success response
33
23
  assert response.test?
@@ -36,7 +26,7 @@ class RemoteViaklixTest < Test::Unit::TestCase
36
26
  end
37
27
 
38
28
  def test_failed_purchase
39
- assert response = @gateway.purchase(100, @bad_credit_card, @options)
29
+ assert response = @gateway.purchase(@amount, @bad_credit_card, @options)
40
30
 
41
31
  assert_failure response
42
32
  assert response.test?
@@ -44,10 +34,10 @@ class RemoteViaklixTest < Test::Unit::TestCase
44
34
  end
45
35
 
46
36
  def test_credit
47
- assert purchase = @gateway.purchase(100, @credit_card, @options)
37
+ assert purchase = @gateway.purchase(@amount, @credit_card, @options)
48
38
  assert_success purchase
49
39
 
50
- assert credit = @gateway.credit(100, @credit_card)
40
+ assert credit = @gateway.credit(@amount, @credit_card)
51
41
  assert_success credit
52
42
  end
53
43
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
1
+ require File.dirname(__FILE__) + '/../../test_helper'
2
2
 
3
3
  class RemoteGestpayIntegrationTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations