activemerchant 1.4.2 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +78 -0
  3. data/{CONTRIBUTERS → CONTRIBUTORS} +44 -0
  4. data/{README → README.rdoc} +4 -1
  5. data/Rakefile +7 -13
  6. data/lib/active_merchant.rb +11 -21
  7. data/lib/active_merchant/billing/avs_result.rb +13 -10
  8. data/lib/active_merchant/billing/base.rb +2 -2
  9. data/lib/active_merchant/billing/check.rb +1 -1
  10. data/lib/active_merchant/billing/credit_card_methods.rb +2 -2
  11. data/lib/active_merchant/billing/expiry_date.rb +10 -4
  12. data/lib/active_merchant/billing/gateway.rb +7 -6
  13. data/lib/active_merchant/billing/gateways.rb +18 -3
  14. data/lib/active_merchant/billing/gateways/authorize_net.rb +20 -12
  15. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +40 -6
  16. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb.orig +736 -0
  17. data/lib/active_merchant/billing/gateways/braintree.rb +6 -211
  18. data/lib/active_merchant/billing/gateways/data_cash.rb +5 -7
  19. data/lib/active_merchant/billing/gateways/elavon.rb +134 -0
  20. data/lib/active_merchant/billing/gateways/eway.rb +7 -2
  21. data/lib/active_merchant/billing/gateways/first_pay.rb +172 -0
  22. data/lib/active_merchant/billing/gateways/instapay.rb +164 -0
  23. data/lib/active_merchant/billing/gateways/jetpay.rb +270 -0
  24. data/lib/active_merchant/billing/gateways/linkpoint.rb +65 -12
  25. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +154 -0
  26. data/lib/active_merchant/billing/gateways/merchant_ware.rb +283 -0
  27. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +12 -6
  28. data/lib/active_merchant/billing/gateways/ogone.rb +279 -0
  29. data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
  30. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/payflow_express.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/payment_express.rb +20 -32
  34. data/lib/active_merchant/billing/gateways/paypal.rb +22 -9
  35. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
  36. data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
  37. data/lib/active_merchant/billing/gateways/psl_card.rb +4 -6
  38. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +7 -1
  39. data/lib/active_merchant/billing/gateways/{protx.rb → sage_pay.rb} +60 -35
  40. data/lib/active_merchant/billing/gateways/sallie_mae.rb +144 -0
  41. data/lib/active_merchant/billing/gateways/secure_pay.rb +1 -1
  42. data/lib/active_merchant/billing/gateways/skip_jack.rb +23 -10
  43. data/lib/active_merchant/billing/gateways/smart_ps.rb +265 -0
  44. data/lib/active_merchant/billing/gateways/transax.rb +25 -0
  45. data/lib/active_merchant/billing/gateways/viaklix.rb +38 -14
  46. data/lib/active_merchant/billing/gateways/wirecard.rb +15 -2
  47. data/lib/active_merchant/billing/integrations.rb +18 -11
  48. data/lib/active_merchant/billing/integrations/bogus.rb +4 -3
  49. data/lib/active_merchant/billing/integrations/chronopay.rb +4 -3
  50. data/lib/active_merchant/billing/integrations/chronopay/notification.rb +3 -1
  51. data/lib/active_merchant/billing/integrations/gestpay.rb +4 -5
  52. data/lib/active_merchant/billing/integrations/gestpay/notification.rb +3 -1
  53. data/lib/active_merchant/billing/integrations/hi_trust.rb +4 -3
  54. data/lib/active_merchant/billing/integrations/nochex.rb +4 -3
  55. data/lib/active_merchant/billing/integrations/nochex/notification.rb +1 -1
  56. data/lib/active_merchant/billing/integrations/paypal.rb +3 -4
  57. data/lib/active_merchant/billing/integrations/paypal/helper.rb +9 -8
  58. data/lib/active_merchant/billing/integrations/quickpay.rb +2 -3
  59. data/lib/active_merchant/billing/integrations/quickpay/helper.rb +1 -1
  60. data/lib/active_merchant/billing/integrations/two_checkout.rb +3 -3
  61. data/lib/active_merchant/lib/connection.rb +170 -0
  62. data/lib/active_merchant/lib/country.rb +4 -1
  63. data/lib/active_merchant/lib/posts_data.rb +22 -84
  64. data/test/fixtures.yml +39 -1
  65. data/test/remote/gateways/remote_authorize_net_cim_test.rb +2 -1
  66. data/test/remote/gateways/remote_authorize_net_test.rb +1 -1
  67. data/test/remote/gateways/remote_beanstream_interac_test.rb +1 -1
  68. data/test/remote/gateways/remote_beanstream_test.rb +1 -1
  69. data/test/remote/gateways/remote_braintree_test.rb +2 -9
  70. data/test/remote/gateways/remote_card_stream_test.rb +1 -1
  71. data/test/remote/gateways/remote_cyber_source_test.rb +1 -1
  72. data/test/remote/gateways/remote_data_cash_test.rb +1 -2
  73. data/test/remote/gateways/remote_efsnet_test.rb +1 -1
  74. data/test/remote/gateways/remote_elavon_test.rb +66 -0
  75. data/test/remote/gateways/remote_eway_test.rb +1 -1
  76. data/test/remote/gateways/remote_exact_test.rb +1 -1
  77. data/test/remote/gateways/remote_first_pay_test.rb +87 -0
  78. data/test/remote/gateways/remote_instapay_test.rb +61 -0
  79. data/test/remote/gateways/remote_jetpay_test.rb +103 -0
  80. data/test/remote/gateways/remote_linkpoint_test.rb +11 -2
  81. data/test/remote/gateways/remote_merchant_e_solutions_test.rb +173 -0
  82. data/test/remote/gateways/remote_merchant_ware_test.rb +113 -0
  83. data/test/remote/gateways/remote_modern_payments_cim_test.rb +1 -1
  84. data/test/remote/gateways/remote_modern_payments_test.rb +23 -9
  85. data/test/remote/gateways/remote_moneris_test.rb +1 -1
  86. data/test/remote/gateways/remote_net_registry_test.rb +1 -1
  87. data/test/remote/gateways/remote_netbilling_test.rb +1 -1
  88. data/test/remote/gateways/remote_ogone_test.rb +115 -0
  89. data/test/remote/gateways/remote_pay_junction_test.rb +1 -1
  90. data/test/remote/gateways/remote_pay_secure_test.rb +1 -1
  91. data/test/remote/gateways/remote_payflow_express_test.rb +1 -1
  92. data/test/remote/gateways/remote_payflow_test.rb +1 -1
  93. data/test/remote/gateways/remote_payflow_uk_test.rb +1 -1
  94. data/test/remote/gateways/remote_payment_express_test.rb +17 -7
  95. data/test/remote/gateways/remote_paypal_express_test.rb +1 -1
  96. data/test/remote/gateways/remote_paypal_test.rb +26 -2
  97. data/test/remote/gateways/remote_plugnpay_test.rb +1 -1
  98. data/test/remote/gateways/remote_psigate_test.rb +1 -1
  99. data/test/remote/gateways/remote_psl_card_test.rb +1 -3
  100. data/test/remote/gateways/remote_quickpay_test.rb +1 -1
  101. data/test/remote/gateways/remote_realex_test.rb +1 -1
  102. data/test/remote/gateways/remote_sage_bankcard_test.rb +1 -1
  103. data/test/remote/gateways/remote_sage_pay_test.rb +219 -0
  104. data/test/remote/gateways/remote_sage_test.rb +1 -1
  105. data/test/remote/gateways/remote_sage_virtual_check_test.rb +1 -1
  106. data/test/remote/gateways/remote_sallie_mae_test.rb +51 -0
  107. data/test/remote/gateways/remote_secure_pay_au_test.rb +1 -1
  108. data/test/remote/gateways/remote_secure_pay_tech_test.rb +1 -1
  109. data/test/remote/gateways/remote_secure_pay_test.rb +2 -2
  110. data/test/remote/gateways/remote_skipjack_test.rb +1 -1
  111. data/test/remote/gateways/remote_trans_first_test.rb +1 -1
  112. data/test/remote/gateways/remote_transax_test.rb +112 -0
  113. data/test/remote/gateways/remote_trust_commerce_test.rb +1 -1
  114. data/test/remote/gateways/remote_usa_epay_test.rb +1 -1
  115. data/test/remote/gateways/remote_verifi_test.rb +1 -1
  116. data/test/remote/gateways/remote_viaklix_test.rb +1 -1
  117. data/test/remote/gateways/remote_wirecard_test.rb +34 -0
  118. data/test/remote/integrations/remote_gestpay_integration_test.rb +1 -1
  119. data/test/remote/integrations/remote_paypal_integration_test.rb +1 -1
  120. data/test/test_helper.rb +81 -89
  121. data/test/unit/avs_result_test.rb +1 -1
  122. data/test/unit/base_test.rb +1 -2
  123. data/test/unit/check_test.rb +1 -1
  124. data/test/unit/connection_test.rb +129 -0
  125. data/test/unit/country_code_test.rb +1 -1
  126. data/test/unit/country_test.rb +1 -1
  127. data/test/unit/credit_card_formatting_test.rb +1 -1
  128. data/test/unit/credit_card_methods_test.rb +10 -1
  129. data/test/unit/credit_card_test.rb +1 -1
  130. data/test/unit/cvv_result_test.rb +1 -1
  131. data/test/unit/expiry_date_test.rb +13 -2
  132. data/test/unit/gateways/authorize_net_cim_test.rb +39 -1
  133. data/test/unit/gateways/authorize_net_test.rb +1 -1
  134. data/test/unit/gateways/beanstream_interac_test.rb +1 -1
  135. data/test/unit/gateways/beanstream_test.rb +1 -1
  136. data/test/unit/gateways/bogus_test.rb +1 -1
  137. data/test/unit/gateways/braintree_test.rb +16 -14
  138. data/test/unit/gateways/card_stream_test.rb +1 -1
  139. data/test/unit/gateways/cyber_source_test.rb +1 -1
  140. data/test/unit/gateways/data_cash_test.rb +2 -1
  141. data/test/unit/gateways/efsnet_test.rb +1 -1
  142. data/test/unit/gateways/elavon_test.rb +139 -0
  143. data/test/unit/gateways/eway_test.rb +1 -1
  144. data/test/unit/gateways/exact_test.rb +1 -1
  145. data/test/unit/gateways/first_pay_test.rb +125 -0
  146. data/test/unit/gateways/gateway_test.rb +1 -1
  147. data/test/unit/gateways/instapay_test.rb +102 -0
  148. data/test/unit/gateways/jetpay_test.rb +185 -0
  149. data/test/unit/gateways/linkpoint_test.rb +37 -7
  150. data/test/unit/gateways/merchant_e_solutions_test.rb +169 -0
  151. data/test/unit/gateways/merchant_ware_test.rb +188 -0
  152. data/test/unit/gateways/modern_payments_cim_test.rb +25 -34
  153. data/test/unit/gateways/moneris_test.rb +1 -1
  154. data/test/unit/gateways/net_registry_test.rb +1 -1
  155. data/test/unit/gateways/netbilling_test.rb +1 -1
  156. data/test/unit/gateways/ogone_test.rb +319 -0
  157. data/test/unit/gateways/pay_junction_test.rb +1 -1
  158. data/test/unit/gateways/pay_secure_test.rb +1 -1
  159. data/test/unit/gateways/payflow_express_test.rb +2 -2
  160. data/test/unit/gateways/payflow_express_uk_test.rb +73 -1
  161. data/test/unit/gateways/payflow_test.rb +1 -1
  162. data/test/unit/gateways/payflow_uk_test.rb +1 -1
  163. data/test/unit/gateways/payment_express_test.rb +3 -3
  164. data/test/unit/gateways/paypal_express_test.rb +1 -1
  165. data/test/unit/gateways/paypal_test.rb +50 -1
  166. data/test/unit/gateways/plugnpay_test.rb +1 -1
  167. data/test/unit/gateways/psigate_test.rb +1 -1
  168. data/test/unit/gateways/psl_card_test.rb +1 -1
  169. data/test/unit/gateways/quickpay_test.rb +1 -1
  170. data/test/unit/gateways/realex_test.rb +1 -1
  171. data/test/unit/gateways/sage_bankcard_test.rb +36 -2
  172. data/test/unit/gateways/{protx_test.rb → sage_pay_test.rb} +49 -32
  173. data/test/unit/gateways/sage_virtual_check_test.rb +1 -1
  174. data/test/unit/gateways/sallie_mae_test.rb +53 -0
  175. data/test/unit/gateways/secure_pay_au_test.rb +1 -1
  176. data/test/unit/gateways/secure_pay_tech_test.rb +1 -1
  177. data/test/unit/gateways/secure_pay_test.rb +24 -10
  178. data/test/unit/gateways/skip_jack_test.rb +81 -1
  179. data/test/unit/gateways/trans_first_test.rb +1 -1
  180. data/test/unit/gateways/trust_commerce_test.rb +1 -1
  181. data/test/unit/gateways/usa_epay_test.rb +1 -1
  182. data/test/unit/gateways/verifi_test.rb +1 -1
  183. data/test/unit/gateways/viaklix_test.rb +1 -1
  184. data/test/unit/gateways/wirecard_test.rb +19 -1
  185. data/test/unit/generators/test_generator_helper.rb +1 -1
  186. data/test/unit/integrations/action_view_helper_test.rb +1 -1
  187. data/test/unit/integrations/bogus_module_test.rb +1 -1
  188. data/test/unit/integrations/chronopay_module_test.rb +1 -1
  189. data/test/unit/integrations/gestpay_module_test.rb +1 -1
  190. data/test/unit/integrations/helpers/bogus_helper_test.rb +1 -1
  191. data/test/unit/integrations/helpers/chronopay_helper_test.rb +1 -1
  192. data/test/unit/integrations/helpers/gestpay_helper_test.rb +1 -1
  193. data/test/unit/integrations/helpers/hi_trust_helper_test.rb +1 -1
  194. data/test/unit/integrations/helpers/nochex_helper_test.rb +1 -1
  195. data/test/unit/integrations/helpers/paypal_helper_test.rb +11 -2
  196. data/test/unit/integrations/helpers/quickpay_helper_test.rb +1 -1
  197. data/test/unit/integrations/helpers/two_checkout_helper_test.rb +1 -1
  198. data/test/unit/integrations/hi_trust_module_test.rb +1 -1
  199. data/test/unit/integrations/nochex_module_test.rb +1 -1
  200. data/test/unit/integrations/notifications/chronopay_notification_test.rb +1 -1
  201. data/test/unit/integrations/notifications/gestpay_notification_test.rb +1 -1
  202. data/test/unit/integrations/notifications/hi_trust_notification_test.rb +1 -1
  203. data/test/unit/integrations/notifications/nochex_notification_test.rb +2 -2
  204. data/test/unit/integrations/notifications/notification_test.rb +1 -1
  205. data/test/unit/integrations/notifications/paypal_notification_test.rb +1 -1
  206. data/test/unit/integrations/notifications/quickpay_notification_test.rb +1 -1
  207. data/test/unit/integrations/notifications/two_checkout_notification_test.rb +1 -1
  208. data/test/unit/integrations/paypal_module_test.rb +1 -1
  209. data/test/unit/integrations/quickpay_module_test.rb +1 -1
  210. data/test/unit/integrations/returns/chronopay_return_test.rb +1 -1
  211. data/test/unit/integrations/returns/gestpay_return_test.rb +1 -1
  212. data/test/unit/integrations/returns/hi_trust_return_test.rb +1 -1
  213. data/test/unit/integrations/returns/nochex_return_test.rb +1 -1
  214. data/test/unit/integrations/returns/paypal_return_test.rb +1 -1
  215. data/test/unit/integrations/returns/return_test.rb +1 -1
  216. data/test/unit/integrations/returns/two_checkout_return_test.rb +1 -1
  217. data/test/unit/integrations/two_checkout_module_test.rb +1 -1
  218. data/test/unit/post_data_test.rb +1 -1
  219. data/test/unit/posts_data_test.rb +14 -66
  220. data/test/unit/response_test.rb +1 -1
  221. data/test/unit/utils_test.rb +1 -1
  222. data/test/unit/validateable_test.rb +1 -1
  223. metadata +41 -45
  224. metadata.gz.sig +0 -0
  225. data/test/extra/binding_of_caller.rb +0 -80
  226. data/test/extra/breakpoint.rb +0 -547
  227. data/test/remote/gateways/remote_protx_test.rb +0 -184
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class SkipJackTest < Test::Unit::TestCase
4
4
 
@@ -110,6 +110,71 @@ class SkipJackTest < Test::Unit::TestCase
110
110
  assert_equal 'M', response.cvv_result['code']
111
111
  end
112
112
 
113
+ def test_basic_test_url
114
+ @gateway.stubs(:test?).returns(true)
115
+ @gateway.stubs(:advanced?).returns(false)
116
+ assert_equal "https://developer.skipjackic.com/scripts/evolvcc.dll?AuthorizeAPI", @gateway.send(:url_for, :authorization)
117
+ end
118
+
119
+ def test_basic_test_url_non_authorization
120
+ @gateway.stubs(:test?).returns(true)
121
+ @gateway.stubs(:advanced?).returns(false)
122
+ assert_equal "https://developer.skipjackic.com/scripts/evolvcc.dll?SJAPI_TransactionChangeStatusRequest", @gateway.send(:url_for, :change_status)
123
+ end
124
+
125
+ def test_advanced_test_url
126
+ @gateway.stubs(:test?).returns(true)
127
+ @gateway.stubs(:advanced?).returns(true)
128
+ assert_equal "https://developer.skipjackic.com/evolvcc/evolvcc.aspx?AuthorizeAPI", @gateway.send(:url_for, :authorization)
129
+ end
130
+
131
+ def test_advanced_test_url_non_authorization
132
+ @gateway.stubs(:test?).returns(true)
133
+ @gateway.stubs(:advanced?).returns(true)
134
+ assert_equal "https://developer.skipjackic.com/scripts/evolvcc.dll?SJAPI_TransactionChangeStatusRequest", @gateway.send(:url_for, :change_status)
135
+ end
136
+
137
+ def test_basic_live_url
138
+ @gateway.stubs(:test?).returns(false)
139
+ @gateway.stubs(:advanced?).returns(false)
140
+ assert_equal "https://www.skipjackic.com/scripts/evolvcc.dll?AuthorizeAPI", @gateway.send(:url_for, :authorization)
141
+ end
142
+
143
+ def test_basic_live_url_non_authorization
144
+ @gateway.stubs(:test?).returns(false)
145
+ @gateway.stubs(:advanced?).returns(false)
146
+ assert_equal "https://www.skipjackic.com/scripts/evolvcc.dll?SJAPI_TransactionChangeStatusRequest", @gateway.send(:url_for, :change_status)
147
+ end
148
+
149
+ def test_advanced_live_url
150
+ @gateway.stubs(:test?).returns(false)
151
+ @gateway.stubs(:advanced?).returns(true)
152
+ assert_equal "https://www.skipjackic.com/evolvcc/evolvcc.aspx?AuthorizeAPI", @gateway.send(:url_for, :authorization)
153
+ end
154
+
155
+ def test_advanced_live_url_non_authorization
156
+ @gateway.stubs(:test?).returns(false)
157
+ @gateway.stubs(:advanced?).returns(true)
158
+ assert_equal "https://www.skipjackic.com/scripts/evolvcc.dll?SJAPI_TransactionChangeStatusRequest", @gateway.send(:url_for, :change_status)
159
+ end
160
+
161
+ def test_paymentech_authorization_success
162
+ @gateway.expects(:ssl_post).returns(successful_paymentech_authorization_response)
163
+
164
+ assert response = @gateway.authorize(@amount, @credit_card, @options)
165
+ assert_instance_of Response, response
166
+ assert_success response
167
+ assert_equal '40000024585892.109', response.authorization
168
+ end
169
+
170
+ def test_paymentech_authorization_failure
171
+ @gateway.expects(:ssl_post).returns(unsuccessful_paymentech_authorization_response)
172
+
173
+ assert response = @gateway.authorize(@amount, @credit_card, @options)
174
+ assert_instance_of Response, response
175
+ assert_failure response
176
+ end
177
+
113
178
  private
114
179
  def successful_authorization_response
115
180
  <<-CSV
@@ -130,4 +195,19 @@ class SkipJackTest < Test::Unit::TestCase
130
195
  "AUTHCODE","szSerialNumber","szTransactionAmount","szAuthorizationDeclinedMessage","szAVSResponseCode","szAVSResponseMessage","szOrderNumber","szAuthorizationResponseCode","szIsApproved","szCVV2ResponseCode","szCVV2ResponseMessage","szReturnCode","szTransactionFileName","szCAVVResponseCode"\r\n"EMPTY","000386891209","100","","","","b1eec256d0182f29375e0cbae685092d","","0","","","-35","",""
131
196
  CSV
132
197
  end
198
+
199
+ def unsuccessful_paymentech_authorization_response
200
+ <<-CSV
201
+ "AUTHCODE","szSerialNumber","szTransactionAmount","szAuthorizationDeclinedMessage","szAVSResponseCode","szAVSResponseMessage","szOrderNumber","szAuthorizationResponseCode","szIsApproved","szCVV2ResponseCode","szCVV2ResponseMessage","szReturnCode","szTransactionFileName","szCAVVResponseCode",
202
+ "EMPTY","000000000000","1.00","","","","43985b7953199d1f02c3017f948e9f13","","0","","","-83","","",
203
+ CSV
204
+ end
205
+
206
+ def successful_paymentech_authorization_response
207
+ <<-CSV
208
+ "AUTHCODE","szSerialNumber","szTransactionAmount","szAuthorizationDeclinedMessage","szAVSResponseCode","szAVSResponseMessage","szOrderNumber","szAuthorizationResponseCode","szIsApproved","szCVV2ResponseCode","szCVV2ResponseMessage","szReturnCode","szTransactionFileName","szCAVVResponseCode",
209
+ "093223","000000000000","1.00","","Y","Card authorized, exact address match with 5 digit zip code.","5ac0f04e737baea5a5370037afe827f6","093223","1","M","Match","1","40000024585892.109","",
210
+ CSV
211
+ end
133
212
  end
213
+
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class TransFirstTest < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class TrustCommerceTest < Test::Unit::TestCase
4
4
  def setup
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class UsaEpayTest < Test::Unit::TestCase
4
4
  def setup
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class VerifiTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class ViaklixTest < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class WirecardTest < Test::Unit::TestCase
4
4
  TEST_AUTHORIZATION_GUWID = 'C822580121385121429927'
@@ -17,6 +17,16 @@ class WirecardTest < Test::Unit::TestCase
17
17
  :description => 'Wirecard Purchase',
18
18
  :email => 'soleone@example.com'
19
19
  }
20
+
21
+ @address_without_state = {
22
+ :name => 'Jim Smith',
23
+ :address1 => '1234 My Street',
24
+ :company => 'Widgets Inc',
25
+ :city => 'Ottawa',
26
+ :zip => 'K12 P2A',
27
+ :country => 'CA',
28
+ :state => nil,
29
+ }
20
30
  end
21
31
 
22
32
  def test_successful_authorization
@@ -61,6 +71,14 @@ class WirecardTest < Test::Unit::TestCase
61
71
  assert response.message["Could not find referenced transaction for GuWID 1234567890123456789012."]
62
72
  end
63
73
 
74
+ def test_doesnt_raise_an_error_if_no_state_is_provided_in_address
75
+ options = @options.merge(:billing_address => @address_without_state)
76
+ @gateway.expects(:ssl_post).returns(unauthorized_capture_response)
77
+ assert_nothing_raised do
78
+ @gateway.authorize(@amount, @credit_card, options)
79
+ end
80
+ end
81
+
64
82
  private
65
83
 
66
84
  # Authorization success
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
  require 'fileutils'
3
3
 
4
4
  # Must set before requiring generator libs.
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class ActionViewHelperTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations::ActionViewHelper
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class BogusModuleTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class ChronopayModuleTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class GestpayModuleTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class BogusHelperTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class ChronopayHelperTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class GestpayHelperTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class HiTrustHelperTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class NochexHelperTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class PaypalHelperTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -72,12 +72,21 @@ class PaypalHelperTest < Test::Unit::TestCase
72
72
  end
73
73
 
74
74
  def test_phone_parsing
75
- @helper.shipping_address :phone => '111-222-3333'
75
+ @helper.shipping_address :country => 'CA', :phone => '111-222-3333'
76
76
 
77
77
  assert_field 'night_phone_a', '111'
78
78
  assert_field 'night_phone_b', '222'
79
79
  assert_field 'night_phone_c', '3333'
80
80
  end
81
+
82
+
83
+ def test_phone_parsing_for_non_us
84
+ @helper.shipping_address :country => 'UK', :phone => '028 38841670'
85
+
86
+ assert_field 'night_phone_a', nil
87
+ assert_field 'night_phone_b', '02838841670'
88
+ assert_field 'night_phone_c', nil
89
+ end
81
90
 
82
91
 
83
92
  def test_province
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class QuickpayHelperTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class TwoCheckoutHelperTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class HiTrustModuleTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class ChronopayModuleTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class ChronopayNotificationTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class GestpayNotificationTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class HiTrustNotificationTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class NochexNotificationTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -46,6 +46,6 @@ class NochexNotificationTest < Test::Unit::TestCase
46
46
 
47
47
  private
48
48
  def http_raw_data
49
- "transaction_date=27/09/2006 22:30:53&transaction_id=91191&order_id=11&from_email=test2@nochex.com&to_email=test1@nochex.com&amount=31.66&security_key=L254524366479818252491366&status=test&custom="
49
+ "transaction_date=27/09/2006 22:30:53&transaction_id=91191&order_id=11&from_email=test2@nochex.com&to_email=test1@nochex.com&amount=31.6600&security_key=L254524366479818252491366&status=test&custom="
50
50
  end
51
51
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class NotificationTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class PaypalNotificationTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class QuickpayNotificationTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class TwoCheckoutNotificationTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class PaypalModuleTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class QuickpayModuleTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class ChronopayReturnTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class GestpayReturnTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class HiTrustReturnTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class NochexReturnTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class PaypalReturnTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class ReturnTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class TwoCheckoutReturnTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class TwoCheckoutModuleTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class MyPost < PostData
4
4
  self.required_fields = [ :ccnumber, :ccexp, :firstname, :lastname, :username, :password, :order_id, :key, :time ]
@@ -1,14 +1,9 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
2
-
3
- class MockResponse
4
- def body
5
- end
6
- end
1
+ require 'test_helper'
7
2
 
8
3
  class PostsDataTests < Test::Unit::TestCase
9
- URL = 'http://example.com'
10
-
4
+
11
5
  def setup
6
+ @url = 'http://example.com'
12
7
  @gateway = SimpleTestGateway.new
13
8
  end
14
9
 
@@ -17,69 +12,22 @@ class PostsDataTests < Test::Unit::TestCase
17
12
  end
18
13
 
19
14
  def test_single_successful_post
20
- Net::HTTP.any_instance.expects(:post).once.returns(MockResponse.new)
15
+ ActiveMerchant::Connection.any_instance.expects(:request).returns('')
21
16
 
22
17
  assert_nothing_raised do
23
- @gateway.ssl_post(URL, '')
18
+ @gateway.ssl_post(@url, '')
24
19
  end
25
20
  end
26
21
 
27
22
  def test_multiple_successful_posts
28
- responses = [ MockResponse.new, MockResponse.new ]
29
- Net::HTTP.any_instance.expects(:post).times(2).returns(*responses)
30
-
31
- assert_nothing_raised do
32
- @gateway.ssl_post(URL, '')
33
- @gateway.ssl_post(URL, '')
34
- end
35
- end
36
-
37
- def test_unrecoverable_exception
38
- Net::HTTP.any_instance.expects(:post).raises(EOFError)
39
-
40
- assert_raises(ActiveMerchant::ConnectionError) do
41
- @gateway.ssl_post(URL, '')
42
- end
43
- end
44
-
45
- def test_failure_then_success_with_recoverable_exception
46
- Net::HTTP.any_instance.expects(:post).times(2).raises(Errno::ECONNREFUSED).then.returns(MockResponse.new)
23
+ ActiveMerchant::Connection.any_instance.expects(:request).times(2).returns('', '')
47
24
 
48
25
  assert_nothing_raised do
49
- @gateway.ssl_post(URL, '')
26
+ @gateway.ssl_post(@url, '')
27
+ @gateway.ssl_post(@url, '')
50
28
  end
51
29
  end
52
-
53
- def test_failure_limit_reached
54
- Net::HTTP.any_instance.expects(:post).times(ActiveMerchant::PostsData::MAX_RETRIES).raises(Errno::ECONNREFUSED)
55
30
 
56
- assert_raises(ActiveMerchant::ConnectionError) do
57
- @gateway.ssl_post(URL, '')
58
- end
59
- end
60
-
61
- def test_failure_then_success_with_retry_safe_enabled
62
- Net::HTTP.any_instance.expects(:post).times(2).raises(EOFError).then.returns(MockResponse.new)
63
-
64
- @gateway.retry_safe = true
65
-
66
- assert_nothing_raised do
67
- @gateway.ssl_post(URL, '')
68
- end
69
- end
70
-
71
- def test_mixture_of_failures_with_retry_safe_enabled
72
- Net::HTTP.any_instance.expects(:post).times(3).raises(Errno::ECONNRESET).
73
- raises(Errno::ECONNREFUSED).
74
- raises(EOFError)
75
-
76
- @gateway.retry_safe = true
77
-
78
- assert_raises(ActiveMerchant::ConnectionError) do
79
- @gateway.ssl_post(URL, '')
80
- end
81
- end
82
-
83
31
  def test_setting_ssl_strict_outside_class_definition
84
32
  assert_equal SimpleTestGateway.ssl_strict, SubclassGateway.ssl_strict
85
33
  SimpleTestGateway.ssl_strict = !SimpleTestGateway.ssl_strict
@@ -87,14 +35,14 @@ class PostsDataTests < Test::Unit::TestCase
87
35
  end
88
36
 
89
37
  def test_setting_timeouts
90
- @gateway.class.open_timeout=50
91
- @gateway.class.read_timeout=37
92
- Net::HTTP.any_instance.expects(:post).once.returns(MockResponse.new)
93
- Net::HTTP.any_instance.expects(:open_timeout=).with(50)
94
- Net::HTTP.any_instance.expects(:read_timeout=).with(37)
38
+ @gateway.class.open_timeout = 50
39
+ @gateway.class.read_timeout = 37
40
+ ActiveMerchant::Connection.any_instance.expects(:request).returns('')
41
+ ActiveMerchant::Connection.any_instance.expects(:open_timeout=).with(50)
42
+ ActiveMerchant::Connection.any_instance.expects(:read_timeout=).with(37)
95
43
 
96
44
  assert_nothing_raised do
97
- @gateway.ssl_post(URL, '')
45
+ @gateway.ssl_post(@url, '')
98
46
  end
99
47
  end
100
48
  end