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
@@ -1,197 +0,0 @@
1
- require 'test_helper'
2
-
3
- class LinkpointTest < Test::Unit::TestCase
4
- def setup
5
- Base.mode = :test
6
-
7
- @gateway = LinkpointGateway.new(
8
- :login => 123123,
9
- :pem => 'PEM'
10
- )
11
-
12
- @credit_card = credit_card('4111111111111111')
13
- @options = { :order_id => 1000, :billing_address => address }
14
- end
15
-
16
- def test_credit_card_formatting
17
- assert_equal '04', @gateway.send(:format_creditcard_expiry_year, 2004)
18
- assert_equal '04', @gateway.send(:format_creditcard_expiry_year, '2004')
19
- assert_equal '04', @gateway.send(:format_creditcard_expiry_year, 4)
20
- assert_equal '04', @gateway.send(:format_creditcard_expiry_year, '04')
21
- end
22
-
23
- def test_successful_authorization
24
- @gateway.expects(:ssl_post).returns(successful_authorization_response)
25
-
26
- assert response = @gateway.authorize(@amount, @credit_card, @options)
27
- assert_instance_of Response, response
28
- assert_success response
29
- assert_equal '1000', response.authorization
30
- end
31
-
32
- def test_successful_capture
33
- @gateway.expects(:ssl_post).returns(successful_capture_response)
34
-
35
- assert response = @gateway.capture(@email, '1000', @options)
36
- assert_instance_of Response, response
37
- assert_success response
38
- assert_equal '1000', response.authorization
39
- end
40
-
41
- def test_successful_purchase
42
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
43
-
44
- assert response = @gateway.purchase(@amount, @credit_card, @options)
45
- assert_instance_of Response, response
46
- assert_success response
47
- assert_equal '1000', response.authorization
48
- end
49
-
50
- def test_failed_purchase
51
- @gateway.expects(:ssl_post).returns(failed_purchase_response)
52
-
53
- assert response = @gateway.purchase(@amount, @credit_card, @options)
54
- assert_failure response
55
- end
56
-
57
- def test_recurring
58
- @gateway.expects(:ssl_post).returns(successful_recurring_response)
59
-
60
- assert response = @gateway.recurring(2400, @credit_card, :order_id => 1003, :installments => 12, :startdate => "immediate", :periodicity => :monthly)
61
- assert_success response
62
- end
63
-
64
- def test_amount_style
65
- assert_equal '10.34', @gateway.send(:amount, 1034)
66
-
67
- assert_raise(ArgumentError) do
68
- @gateway.send(:amount, '10.34')
69
- end
70
- end
71
-
72
- def test_purchase_is_valid_xml
73
- parameters = @gateway.send(:parameters, 1000, @credit_card, :ordertype => "SALE", :order_id => 1004,
74
- :billing_address => {
75
- :address1 => '1313 lucky lane',
76
- :city => 'Lost Angeles',
77
- :state => 'CA',
78
- :zip => '90210'
79
- }
80
- )
81
-
82
- assert data = @gateway.send(:post_data, @amount, @credit_card, @options)
83
- assert REXML::Document.new(data)
84
- end
85
-
86
- def test_recurring_is_valid_xml
87
- parameters = @gateway.send(:parameters, 1000, @credit_card, :ordertype => "SALE", :action => "SUBMIT", :installments => 12, :startdate => "immediate", :periodicity => "monthly", :order_id => 1006,
88
- :billing_address => {
89
- :address1 => '1313 lucky lane',
90
- :city => 'Lost Angeles',
91
- :state => 'CA',
92
- :zip => '90210'
93
- }
94
- )
95
- assert data = @gateway.send(:post_data, @amount, @credit_card, @options)
96
- assert REXML::Document.new(data)
97
- end
98
-
99
- def test_line_items_are_valid_xml
100
- options = {:ordertype => "SALE", :action => "SUBMIT", :installments => 12, :startdate => "immediate", :periodicity => "monthly", :order_id => 1006,
101
- :billing_address => {
102
- :address1 => '1313 lucky lane',
103
- :city => 'Lost Angeles',
104
- :state => 'CA',
105
- :zip => '90210'
106
- },
107
- :line_items => [{:id => '123456', :description => "Logo T-Shirt", :price =>
108
- "12.00", :quantity => '1', :options => [{:name => "Color", :value =>
109
- "Red"}, {:name => "Size", :value => "XL"}]},{:id => '111', :description => "keychain", :price => "3.00", :quantity => '1'}]}
110
-
111
-
112
- assert data = @gateway.send(:post_data, @amount, @credit_card, options)
113
- assert REXML::Document.new(data)
114
- end
115
-
116
- def test_declined_purchase_is_valid_xml
117
- @gateway = LinkpointGateway.new(:login => 123123, :pem => 'PEM')
118
-
119
- parameters = @gateway.send(:parameters, 1000, @credit_card, :ordertype => "SALE", :order_id => 1005,
120
- :billing_address => {
121
- :address1 => '1313 lucky lane',
122
- :city => 'Lost Angeles',
123
- :state => 'CA',
124
- :zip => '90210'
125
- }
126
- )
127
-
128
- assert data = @gateway.send(:post_data, @amount, @credit_card, @options)
129
- assert REXML::Document.new(data)
130
- end
131
-
132
- def test_overriding_test_mode
133
- Base.gateway_mode = :production
134
-
135
- gateway = LinkpointGateway.new(
136
- :login => 'LOGIN',
137
- :pem => 'PEM',
138
- :test => true
139
- )
140
-
141
- assert gateway.test?
142
- end
143
-
144
- def test_using_production_mode
145
- Base.gateway_mode = :production
146
-
147
- gateway = LinkpointGateway.new(
148
- :login => 'LOGIN',
149
- :pem => 'PEM'
150
- )
151
-
152
- assert !gateway.test?
153
- end
154
-
155
- def test_supported_countries
156
- assert_equal ['US'], LinkpointGateway.supported_countries
157
- end
158
-
159
- def test_supported_card_types
160
- assert_equal [:visa, :master, :american_express, :discover], LinkpointGateway.supported_cardtypes
161
- end
162
-
163
- def test_avs_result
164
- @gateway.expects(:ssl_post).returns(successful_authorization_response)
165
-
166
- response = @gateway.purchase(@amount, @credit_card, @options)
167
- assert_equal 'N', response.avs_result['code']
168
- end
169
-
170
- def test_cvv_result
171
- @gateway.expects(:ssl_post).returns(successful_authorization_response)
172
-
173
- response = @gateway.purchase(@amount, @credit_card, @options)
174
- assert_equal 'M', response.cvv_result['code']
175
- end
176
-
177
- private
178
- def successful_authorization_response
179
- '<r_csp>CSI</r_csp><r_time>Sun Jan 6 21:41:31 2008</r_time><r_ref>0004486182</r_ref><r_error/><r_ordernum>1000</r_ordernum><r_message>APPROVED</r_message><r_code>1234560004486182:NNNM:100018312899:</r_code><r_tdate>1199680890</r_tdate><r_score/><r_authresponse/><r_approved>APPROVED</r_approved><r_avs>NNNM</r_avs>'
180
- end
181
-
182
- def successful_capture_response
183
- '<r_csp>CSI</r_csp><r_time>Wed Dec 2 13:57:19 2009</r_time><r_ref>0009554566</r_ref><r_error></r_error><r_ordernum>1000</r_ordernum><r_message>ACCEPTED</r_message><r_code>0000000009554566: :9554566:</r_code><r_tdate>1259780240</r_tdate><r_score></r_score><r_authresponse></r_authresponse><r_approved>APPROVED</r_approved><r_avs> </r_avs>'
184
- end
185
-
186
- def successful_purchase_response
187
- '<r_csp>CSI</r_csp><r_time>Sun Jan 6 21:45:22 2008</r_time><r_ref>0004486195</r_ref><r_error></r_error><r_ordernum>1000</r_ordernum><r_message>APPROVED</r_message><r_code>1234560004486195:NNNM:100018312912:</r_code><r_tdate>1199681121</r_tdate><r_score></r_score><r_authresponse></r_authresponse><r_approved>APPROVED</r_approved><r_avs>NNNM</r_avs>'
188
- end
189
-
190
- def failed_purchase_response
191
- '<r_csp></r_csp><r_time>Sun Jan 6 21:50:51 2008</r_time><r_ref></r_ref><r_error>SGS-002300: Invalid credit card type.</r_error><r_ordernum>2aec6babe076111deb2c94c21181d9fe</r_ordernum><r_message></r_message><r_code></r_code><r_tdate></r_tdate><r_score></r_score><r_authresponse></r_authresponse><r_approved>DECLINED</r_approved><r_avs></r_avs>'
192
- end
193
-
194
- def successful_recurring_response
195
- '<r_csp>CSI</r_csp><r_time>Sun Jan 6 21:49:00 2008</r_time><r_ref>0004486198</r_ref><r_error></r_error><r_ordernum>2206b7c9a31de5fb077913134011059d</r_ordernum><r_message>APPROVED</r_message><r_code>1234560004486198:NNNM:100018312915:</r_code><r_tdate>1199681339</r_tdate><r_score></r_score><r_authresponse></r_authresponse><r_approved>APPROVED</r_approved><r_avs>NNN</r_avs>'
196
- end
197
- end
@@ -1,169 +0,0 @@
1
- require 'test_helper'
2
-
3
- class MerchantESolutionsTest < Test::Unit::TestCase
4
- def setup
5
- Base.gateway_mode = :test
6
-
7
- @gateway = MerchantESolutionsGateway.new(
8
- :login => 'login',
9
- :password => 'password'
10
- )
11
-
12
- @credit_card = credit_card
13
- @amount = 100
14
-
15
- @options = {
16
- :order_id => '1',
17
- :billing_address => address,
18
- :description => 'Store Purchase'
19
- }
20
- end
21
-
22
- def test_successful_purchase
23
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
24
- assert response = @gateway.purchase(@amount, @credit_card, @options)
25
- assert_instance_of Response, response
26
- assert_success response
27
- assert_equal '5547cc97dae23ea6ad1a4abd33445c91', response.authorization
28
- assert response.test?
29
- end
30
-
31
- def test_unsuccessful_purchase
32
- @gateway.expects(:ssl_post).returns(failed_purchase_response)
33
- assert response = @gateway.purchase(@amount, @credit_card, @options)
34
- assert_failure response
35
- assert response.test?
36
- end
37
-
38
- def test_authorization
39
- @gateway.expects(:ssl_post).returns(successful_authorization_response)
40
- assert response = @gateway.authorize(@amount, @credit_card, @options)
41
- assert response.success?
42
- assert_equal '42e52603e4c83a55890fbbcfb92b8de1', response.authorization
43
- assert response.test?
44
- end
45
-
46
- def test_capture
47
- @gateway.expects(:ssl_post).returns(successful_capture_response)
48
- assert response = @gateway.capture(@amount, '42e52603e4c83a55890fbbcfb92b8de1', @options)
49
- assert response.success?
50
- assert_equal '42e52603e4c83a55890fbbcfb92b8de1', response.authorization
51
- assert response.test?
52
- end
53
-
54
- def test_credit
55
- @gateway.expects(:ssl_post).returns(successful_credit_response)
56
- assert response = @gateway.authorize(@amount, @credit_card, @options)
57
- assert response.success?
58
- assert_equal '0a5ca4662ac034a59595acb61e8da025', response.authorization
59
- assert response.test?
60
- end
61
-
62
- def test_void
63
- @gateway.expects(:ssl_post).returns(successful_void_response)
64
- assert response = @gateway.void('42e52603e4c83a55890fbbcfb92b8de1')
65
- assert response.success?
66
- assert_equal '1b08845c6dee3fa1a73fee2a009d33a7', response.authorization
67
- assert response.test?
68
- end
69
-
70
- def test_store
71
- @gateway.expects(:ssl_post).returns(successful_store_response)
72
- assert response = @gateway.store(@credit_card)
73
- assert response.success?
74
- assert_equal 'ae641b57b19b3bb89faab44191479872', response.authorization
75
- assert response.test?
76
- end
77
-
78
- def test_unstore
79
- @gateway.expects(:ssl_post).returns(successful_unstore_response)
80
- assert response = @gateway.unstore('ae641b57b19b3bb89faab44191479872')
81
- assert response.success?
82
- assert_equal 'd79410c91b4b31ba99f5a90558565df9', response.authorization
83
- assert response.test?
84
- end
85
-
86
- def test_successful_avs_check
87
- @gateway.expects(:ssl_post).returns(successful_purchase_response + '&avs_result=Y')
88
- assert response = @gateway.purchase(@amount, @credit_card, @options)
89
- assert_equal response.avs_result['code'], "Y"
90
- assert_equal response.avs_result['message'], "Street address and 5-digit postal code match."
91
- assert_equal response.avs_result['street_match'], "Y"
92
- assert_equal response.avs_result['postal_match'], "Y"
93
- end
94
-
95
- def test_unsuccessful_avs_check_with_bad_street_address
96
- @gateway.expects(:ssl_post).returns(successful_purchase_response + '&avs_result=Z')
97
- assert response = @gateway.purchase(@amount, @credit_card, @options)
98
- assert_equal response.avs_result['code'], "Z"
99
- assert_equal response.avs_result['message'], "Street address does not match, but 5-digit postal code matches."
100
- assert_equal response.avs_result['street_match'], "N"
101
- assert_equal response.avs_result['postal_match'], "Y"
102
- end
103
-
104
- def test_unsuccessful_avs_check_with_bad_zip
105
- @gateway.expects(:ssl_post).returns(successful_purchase_response + '&avs_result=A')
106
- assert response = @gateway.purchase(@amount, @credit_card, @options)
107
- assert_equal response.avs_result['code'], "A"
108
- assert_equal response.avs_result['message'], "Street address matches, but 5-digit and 9-digit postal code do not match."
109
- assert_equal response.avs_result['street_match'], "Y"
110
- assert_equal response.avs_result['postal_match'], "N"
111
- end
112
-
113
- def test_successful_cvv_check
114
- @gateway.expects(:ssl_post).returns(successful_purchase_response + '&cvv2_result=M')
115
- assert response = @gateway.purchase(@amount, @credit_card, @options)
116
- assert_equal response.cvv_result['code'], "M"
117
- assert_equal response.cvv_result['message'], "Match"
118
- end
119
-
120
- def test_unsuccessful_cvv_check
121
- @gateway.expects(:ssl_post).returns(failed_purchase_response + '&cvv2_result=N')
122
- assert response = @gateway.purchase(@amount, @credit_card, @options)
123
- assert_equal response.cvv_result['code'], "N"
124
- assert_equal response.cvv_result['message'], "No Match"
125
- end
126
-
127
- def test_supported_countries
128
- assert_equal ['US'], MerchantESolutionsGateway.supported_countries
129
- end
130
-
131
- def test_supported_card_types
132
- assert_equal [:visa, :master, :american_express, :discover, :jcb], MerchantESolutionsGateway.supported_cardtypes
133
- end
134
-
135
- private
136
-
137
- def successful_purchase_response
138
- 'transaction_id=5547cc97dae23ea6ad1a4abd33445c91&error_code=000&auth_response_text=Exact Match&auth_code=12345A'
139
- end
140
-
141
- def successful_authorization_response
142
- 'transaction_id=42e52603e4c83a55890fbbcfb92b8de1&error_code=000&auth_response_text=Exact Match&auth_code=12345A'
143
- end
144
-
145
- def successful_credit_response
146
- 'transaction_id=0a5ca4662ac034a59595acb61e8da025&error_code=000&auth_response_text=Credit Approved'
147
- end
148
-
149
- def successful_void_response
150
- 'transaction_id=1b08845c6dee3fa1a73fee2a009d33a7&error_code=000&auth_response_text=Void Request Accepted'
151
- end
152
-
153
- def successful_capture_response
154
- 'transaction_id=42e52603e4c83a55890fbbcfb92b8de1&error_code=000&auth_response_text=Settle Request Accepted'
155
- end
156
-
157
- def successful_store_response
158
- 'transaction_id=ae641b57b19b3bb89faab44191479872&error_code=000&auth_response_text=Card Data Stored'
159
- end
160
-
161
- def successful_unstore_response
162
- 'transaction_id=d79410c91b4b31ba99f5a90558565df9&error_code=000&auth_response_text=Stored Card Data Deleted'
163
- end
164
-
165
- def failed_purchase_response
166
- 'transaction_id=error&error_code=101&auth_response_text=Invalid%20I%20or%20Key%20Incomplete%20Request'
167
- end
168
-
169
- end
@@ -1,188 +0,0 @@
1
- require 'test_helper'
2
-
3
- class MerchantWareTest < Test::Unit::TestCase
4
- def setup
5
- @gateway = MerchantWareGateway.new(
6
- :login => 'login',
7
- :password => 'password',
8
- :name => 'name'
9
- )
10
-
11
- @credit_card = credit_card
12
- @amount = 100
13
-
14
- @options = {
15
- :order_id => '1',
16
- :billing_address => address
17
- }
18
- end
19
-
20
- def test_successful_authorization
21
- @gateway.expects(:ssl_post).returns(successful_authorization_response)
22
-
23
- assert response = @gateway.authorize(@amount, @credit_card, @options)
24
- assert_instance_of Response, response
25
- assert_success response
26
-
27
- assert_equal '4706382;1', response.authorization
28
- assert_equal "APPROVED", response.message
29
- assert response.test?
30
- end
31
-
32
- def test_soap_fault_during_authorization
33
- response_500 = stub(:code => "500", :message => "Internal Server Error", :body => fault_authorization_response)
34
- @gateway.expects(:ssl_post).raises(ActiveMerchant::ResponseError.new(response_500))
35
-
36
- assert response = @gateway.authorize(@amount, @credit_card, @options)
37
- assert_instance_of Response, response
38
- assert_failure response
39
- assert response.test?
40
-
41
- assert_nil response.authorization
42
- assert_equal "Server was unable to process request. ---> strPAN should be at least 13 to at most 19 characters in size. Parameter name: strPAN", response.message
43
- assert_equal response_500.code, response.params["http_code"]
44
- assert_equal response_500.message, response.params["http_message"]
45
- end
46
-
47
- def test_failed_authorization
48
- @gateway.expects(:ssl_post).returns(failed_authorization_response)
49
-
50
- assert response = @gateway.authorize(@amount, @credit_card, @options)
51
- assert_instance_of Response, response
52
- assert_failure response
53
- assert response.test?
54
-
55
- assert_nil response.authorization
56
- assert_equal "transaction type not supported by version", response.message
57
- assert_equal "FAILED", response.params["status"]
58
- assert_equal "1014", response.params["failure_code"]
59
- end
60
-
61
- def test_failed_void
62
- @gateway.expects(:ssl_post).returns(failed_void_response)
63
-
64
- assert response = @gateway.void("1")
65
- assert_instance_of Response, response
66
- assert_failure response
67
- assert response.test?
68
-
69
- assert_nil response.authorization
70
- assert_equal "decline", response.message
71
- assert_equal "DECLINED", response.params["status"]
72
- assert_equal "1012", response.params["failure_code"]
73
- end
74
-
75
- def test_avs_result
76
- @gateway.expects(:ssl_post).returns(successful_authorization_response)
77
-
78
- response = @gateway.authorize(@amount, @credit_card, @options)
79
- assert_equal 'N', response.avs_result['code']
80
- end
81
-
82
- def test_cvv_result
83
- @gateway.expects(:ssl_post).returns(successful_authorization_response)
84
-
85
- response = @gateway.authorize(@amount, @credit_card, @options)
86
- assert_equal 'M', response.cvv_result['code']
87
- end
88
-
89
- private
90
-
91
- def successful_authorization_response
92
- <<-XML
93
- <?xml version="1.0" encoding="utf-8"?>
94
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
95
- <soap:Body>
96
- <IssueKeyedPreAuthResponse xmlns="http://merchantwarehouse.com/MerchantWARE/Client/TransactionRetail">
97
- <IssueKeyedPreAuthResult>
98
- <ReferenceID>4706382</ReferenceID>
99
- <OrderNumber>1</OrderNumber>
100
- <TXDate>7/3/2009 2:05:04 AM</TXDate>
101
- <ApprovalStatus>APPROVED</ApprovalStatus>
102
- <AuthCode>VI0100</AuthCode>
103
- <CardHolder>Longbob Longsen</CardHolder>
104
- <Amount>1.00</Amount>
105
- <Type>5</Type>
106
- <CardNumber>************4242</CardNumber>
107
- <CardType>0</CardType>
108
- <AVSResponse>N</AVSResponse>
109
- <CVResponse>M</CVResponse>
110
- <POSEntryType>1</POSEntryType>
111
- </IssueKeyedPreAuthResult>
112
- </IssueKeyedPreAuthResponse>
113
- </soap:Body>
114
- </soap:Envelope>
115
- XML
116
- end
117
-
118
- def fault_authorization_response
119
- <<-XML
120
- <?xml version="1.0" encoding="utf-8"?>
121
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
122
- <soap:Body>
123
- <soap:Fault>
124
- <faultcode>soap:Server</faultcode>
125
- <faultstring>Server was unable to process request. ---&gt; strPAN should be at least 13 to at most 19 characters in size.
126
- Parameter name: strPAN</faultstring>
127
- <detail/>
128
- </soap:Fault>
129
- </soap:Body>
130
- </soap:Envelope>
131
- XML
132
- end
133
-
134
- def failed_authorization_response
135
- <<-XML
136
- <?xml version="1.0" encoding="utf-8"?>
137
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
138
- <soap:Body>
139
- <IssueKeyedPreAuthResponse xmlns="http://merchantwarehouse.com/MerchantWARE/Client/TransactionRetail">
140
- <IssueKeyedPreAuthResult>
141
- <ReferenceID/>
142
- <OrderNumber>1</OrderNumber>
143
- <TXDate>7/3/2009 3:04:33 AM</TXDate>
144
- <ApprovalStatus>FAILED;1014;transaction type not supported by version</ApprovalStatus>
145
- <AuthCode/>
146
- <CardHolder>Longbob Longsen</CardHolder>
147
- <Amount>1.00</Amount>
148
- <Type>5</Type>
149
- <CardNumber>*********0123</CardNumber>
150
- <CardType>0</CardType>
151
- <AVSResponse/>
152
- <CVResponse/>
153
- <POSEntryType>1</POSEntryType>
154
- </IssueKeyedPreAuthResult>
155
- </IssueKeyedPreAuthResponse>
156
- </soap:Body>
157
- </soap:Envelope>
158
- XML
159
- end
160
-
161
- def failed_void_response
162
- <<-XML
163
- <?xml version="1.0" encoding="utf-8"?>
164
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
165
- <soap:Body>
166
- <IssueVoidResponse xmlns="http://merchantwarehouse.com/MerchantWARE/Client/TransactionRetail">
167
- <IssueVoidResult>
168
- <ReferenceID>4707277</ReferenceID>
169
- <OrderNumber/>
170
- <TXDate>7/3/2009 3:28:38 AM</TXDate>
171
- <ApprovalStatus>DECLINED;1012;decline</ApprovalStatus>
172
- <AuthCode/>
173
- <CardHolder/>
174
- <Amount/>
175
- <Type>3</Type>
176
- <CardNumber/>
177
- <CardType>0</CardType>
178
- <AVSResponse/>
179
- <CVResponse/>
180
- <POSEntryType>0</POSEntryType>
181
- </IssueVoidResult>
182
- </IssueVoidResponse>
183
- </soap:Body>
184
- </soap:Envelope>
185
- XML
186
- end
187
-
188
- end