smulube-activemerchant 1.5.1.4 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +9 -0
  3. data/CONTRIBUTORS +5 -1
  4. data/gem-public_cert.pem +18 -18
  5. data/lib/active_merchant.rb +9 -9
  6. data/lib/active_merchant/billing/gateways/braintree.rb +11 -11
  7. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -0
  8. data/lib/active_merchant/billing/gateways/braintree_blue.rb +210 -0
  9. data/lib/active_merchant/billing/gateways/braintree_orange.rb +17 -0
  10. data/lib/active_merchant/billing/gateways/payflow_nvp_uk.rb +10 -5
  11. data/lib/active_merchant/billing/integrations/action_view_helper.rb +1 -1
  12. data/lib/active_merchant/common.rb +14 -0
  13. data/lib/active_merchant/{lib → common}/connection.rb +2 -5
  14. data/lib/active_merchant/{lib → common}/country.rb +1 -1
  15. data/lib/active_merchant/common/error.rb +26 -0
  16. data/lib/active_merchant/common/post_data.rb +24 -0
  17. data/lib/active_merchant/{lib → common}/posts_data.rb +0 -0
  18. data/lib/active_merchant/{lib → common}/requires_parameters.rb +0 -0
  19. data/lib/active_merchant/{lib → common}/utils.rb +0 -0
  20. data/lib/active_merchant/{lib → common}/validateable.rb +0 -0
  21. data/lib/active_merchant/version.rb +1 -1
  22. data/lib/active_merchant/version.rb.orig +7 -0
  23. data/lib/activemerchant.rb +1 -0
  24. data/lib/support/outbound_hosts.rb +25 -0
  25. metadata +175 -493
  26. metadata.gz.sig +0 -0
  27. data/.gitignore +0 -7
  28. data/Rakefile +0 -85
  29. data/generators/gateway/USAGE +0 -5
  30. data/generators/gateway/gateway_generator.rb +0 -61
  31. data/generators/gateway/templates/gateway.rb +0 -77
  32. data/generators/gateway/templates/gateway_test.rb +0 -49
  33. data/generators/gateway/templates/remote_gateway_test.rb +0 -57
  34. data/generators/integration/USAGE +0 -5
  35. data/generators/integration/integration_generator.rb +0 -68
  36. data/generators/integration/templates/helper.rb +0 -34
  37. data/generators/integration/templates/helper_test.rb +0 -54
  38. data/generators/integration/templates/integration.rb +0 -18
  39. data/generators/integration/templates/module_test.rb +0 -9
  40. data/generators/integration/templates/notification.rb +0 -100
  41. data/generators/integration/templates/notification_test.rb +0 -41
  42. data/init.rb +0 -3
  43. data/lib/active_merchant/lib/error.rb +0 -4
  44. data/lib/active_merchant/lib/post_data.rb +0 -22
  45. data/script/destroy +0 -14
  46. data/script/generate +0 -14
  47. data/test/fixtures.yml +0 -360
  48. data/test/remote/gateways/remote_authorize_net_cim_test.rb +0 -460
  49. data/test/remote/gateways/remote_authorize_net_test.rb +0 -145
  50. data/test/remote/gateways/remote_beanstream_interac_test.rb +0 -53
  51. data/test/remote/gateways/remote_beanstream_test.rb +0 -150
  52. data/test/remote/gateways/remote_braintree_test.rb +0 -147
  53. data/test/remote/gateways/remote_card_stream_test.rb +0 -148
  54. data/test/remote/gateways/remote_cyber_source_test.rb +0 -146
  55. data/test/remote/gateways/remote_data_cash_test.rb +0 -356
  56. data/test/remote/gateways/remote_efsnet_test.rb +0 -81
  57. data/test/remote/gateways/remote_elavon_test.rb +0 -66
  58. data/test/remote/gateways/remote_eway_test.rb +0 -74
  59. data/test/remote/gateways/remote_exact_test.rb +0 -60
  60. data/test/remote/gateways/remote_first_pay_test.rb +0 -87
  61. data/test/remote/gateways/remote_garanti_test.rb +0 -58
  62. data/test/remote/gateways/remote_instapay_test.rb +0 -61
  63. data/test/remote/gateways/remote_jetpay_test.rb +0 -103
  64. data/test/remote/gateways/remote_linkpoint_test.rb +0 -121
  65. data/test/remote/gateways/remote_merchant_e_solutions_test.rb +0 -173
  66. data/test/remote/gateways/remote_merchant_ware_test.rb +0 -113
  67. data/test/remote/gateways/remote_modern_payments_cim_test.rb +0 -58
  68. data/test/remote/gateways/remote_modern_payments_test.rb +0 -57
  69. data/test/remote/gateways/remote_moneris_test.rb +0 -82
  70. data/test/remote/gateways/remote_net_registry_test.rb +0 -85
  71. data/test/remote/gateways/remote_netbilling_test.rb +0 -70
  72. data/test/remote/gateways/remote_ogone_test.rb +0 -115
  73. data/test/remote/gateways/remote_pay_junction_test.rb +0 -143
  74. data/test/remote/gateways/remote_pay_secure_test.rb +0 -39
  75. data/test/remote/gateways/remote_payflow_express_test.rb +0 -50
  76. data/test/remote/gateways/remote_payflow_nvp_uk_test.rb +0 -57
  77. data/test/remote/gateways/remote_payflow_test.rb +0 -237
  78. data/test/remote/gateways/remote_payflow_uk_test.rb +0 -173
  79. data/test/remote/gateways/remote_payment_express_test.rb +0 -136
  80. data/test/remote/gateways/remote_paypal_express_test.rb +0 -49
  81. data/test/remote/gateways/remote_paypal_test.rb +0 -191
  82. data/test/remote/gateways/remote_plugnpay_test.rb +0 -72
  83. data/test/remote/gateways/remote_psigate_test.rb +0 -50
  84. data/test/remote/gateways/remote_psl_card_test.rb +0 -123
  85. data/test/remote/gateways/remote_quickpay_test.rb +0 -190
  86. data/test/remote/gateways/remote_realex_test.rb +0 -224
  87. data/test/remote/gateways/remote_sage_bankcard_test.rb +0 -109
  88. data/test/remote/gateways/remote_sage_pay_test.rb +0 -219
  89. data/test/remote/gateways/remote_sage_test.rb +0 -87
  90. data/test/remote/gateways/remote_sage_virtual_check_test.rb +0 -62
  91. data/test/remote/gateways/remote_sallie_mae_test.rb +0 -51
  92. data/test/remote/gateways/remote_secure_pay_au_test.rb +0 -40
  93. data/test/remote/gateways/remote_secure_pay_tech_test.rb +0 -37
  94. data/test/remote/gateways/remote_secure_pay_test.rb +0 -28
  95. data/test/remote/gateways/remote_skipjack_test.rb +0 -105
  96. data/test/remote/gateways/remote_trans_first_test.rb +0 -34
  97. data/test/remote/gateways/remote_transax_test.rb +0 -112
  98. data/test/remote/gateways/remote_trust_commerce_test.rb +0 -152
  99. data/test/remote/gateways/remote_usa_epay_test.rb +0 -46
  100. data/test/remote/gateways/remote_verifi_test.rb +0 -107
  101. data/test/remote/gateways/remote_viaklix_test.rb +0 -43
  102. data/test/remote/gateways/remote_wirecard_test.rb +0 -111
  103. data/test/remote/integrations/remote_gestpay_integration_test.rb +0 -37
  104. data/test/remote/integrations/remote_paypal_integration_test.rb +0 -26
  105. data/test/test_helper.rb +0 -184
  106. data/test/unit/avs_result_test.rb +0 -59
  107. data/test/unit/base_test.rb +0 -54
  108. data/test/unit/check_test.rb +0 -88
  109. data/test/unit/connection_test.rb +0 -137
  110. data/test/unit/country_code_test.rb +0 -33
  111. data/test/unit/country_test.rb +0 -64
  112. data/test/unit/credit_card_formatting_test.rb +0 -19
  113. data/test/unit/credit_card_methods_test.rb +0 -192
  114. data/test/unit/credit_card_test.rb +0 -318
  115. data/test/unit/cvv_result_test.rb +0 -33
  116. data/test/unit/expiry_date_test.rb +0 -32
  117. data/test/unit/gateways/authorize_net_cim_test.rb +0 -676
  118. data/test/unit/gateways/authorize_net_test.rb +0 -290
  119. data/test/unit/gateways/beanstream_interac_test.rb +0 -51
  120. data/test/unit/gateways/beanstream_test.rb +0 -144
  121. data/test/unit/gateways/bogus_test.rb +0 -58
  122. data/test/unit/gateways/braintree_test.rb +0 -118
  123. data/test/unit/gateways/card_stream_test.rb +0 -90
  124. data/test/unit/gateways/cyber_source_test.rb +0 -188
  125. data/test/unit/gateways/data_cash_test.rb +0 -133
  126. data/test/unit/gateways/efsnet_test.rb +0 -123
  127. data/test/unit/gateways/elavon_test.rb +0 -139
  128. data/test/unit/gateways/eway_test.rb +0 -118
  129. data/test/unit/gateways/exact_test.rb +0 -156
  130. data/test/unit/gateways/first_pay_test.rb +0 -125
  131. data/test/unit/gateways/garanti_test.rb +0 -86
  132. data/test/unit/gateways/gateway_test.rb +0 -48
  133. data/test/unit/gateways/instapay_test.rb +0 -102
  134. data/test/unit/gateways/jetpay_test.rb +0 -185
  135. data/test/unit/gateways/linkpoint_test.rb +0 -197
  136. data/test/unit/gateways/merchant_e_solutions_test.rb +0 -169
  137. data/test/unit/gateways/merchant_ware_test.rb +0 -188
  138. data/test/unit/gateways/modern_payments_cim_test.rb +0 -162
  139. data/test/unit/gateways/moneris_test.rb +0 -158
  140. data/test/unit/gateways/net_registry_test.rb +0 -416
  141. data/test/unit/gateways/netbilling_test.rb +0 -54
  142. data/test/unit/gateways/ogone_test.rb +0 -319
  143. data/test/unit/gateways/pay_junction_test.rb +0 -123
  144. data/test/unit/gateways/pay_secure_test.rb +0 -71
  145. data/test/unit/gateways/payflow_express_test.rb +0 -173
  146. data/test/unit/gateways/payflow_express_uk_test.rb +0 -86
  147. data/test/unit/gateways/payflow_nvp_uk_test.rb +0 -205
  148. data/test/unit/gateways/payflow_test.rb +0 -305
  149. data/test/unit/gateways/payflow_uk_test.rb +0 -30
  150. data/test/unit/gateways/payment_express_test.rb +0 -195
  151. data/test/unit/gateways/paypal_express_test.rb +0 -389
  152. data/test/unit/gateways/paypal_test.rb +0 -569
  153. data/test/unit/gateways/plugnpay_test.rb +0 -86
  154. data/test/unit/gateways/psigate_test.rb +0 -169
  155. data/test/unit/gateways/psl_card_test.rb +0 -64
  156. data/test/unit/gateways/quickpay_test.rb +0 -112
  157. data/test/unit/gateways/realex_test.rb +0 -151
  158. data/test/unit/gateways/sage_bankcard_test.rb +0 -196
  159. data/test/unit/gateways/sage_pay_test.rb +0 -139
  160. data/test/unit/gateways/sage_virtual_check_test.rb +0 -71
  161. data/test/unit/gateways/sallie_mae_test.rb +0 -53
  162. data/test/unit/gateways/secure_pay_au_test.rb +0 -207
  163. data/test/unit/gateways/secure_pay_tech_test.rb +0 -44
  164. data/test/unit/gateways/secure_pay_test.rb +0 -101
  165. data/test/unit/gateways/skip_jack_test.rb +0 -228
  166. data/test/unit/gateways/trans_first_test.rb +0 -112
  167. data/test/unit/gateways/trust_commerce_test.rb +0 -90
  168. data/test/unit/gateways/usa_epay_test.rb +0 -128
  169. data/test/unit/gateways/verifi_test.rb +0 -96
  170. data/test/unit/gateways/viaklix_test.rb +0 -78
  171. data/test/unit/gateways/wirecard_test.rb +0 -250
  172. data/test/unit/generators/test_gateway_generator.rb +0 -46
  173. data/test/unit/generators/test_generator_helper.rb +0 -20
  174. data/test/unit/generators/test_integration_generator.rb +0 -53
  175. data/test/unit/integrations/action_view_helper_test.rb +0 -50
  176. data/test/unit/integrations/bogus_module_test.rb +0 -20
  177. data/test/unit/integrations/chronopay_module_test.rb +0 -13
  178. data/test/unit/integrations/gestpay_module_test.rb +0 -14
  179. data/test/unit/integrations/helpers/bogus_helper_test.rb +0 -28
  180. data/test/unit/integrations/helpers/chronopay_helper_test.rb +0 -110
  181. data/test/unit/integrations/helpers/gestpay_helper_test.rb +0 -100
  182. data/test/unit/integrations/helpers/hi_trust_helper_test.rb +0 -16
  183. data/test/unit/integrations/helpers/nochex_helper_test.rb +0 -53
  184. data/test/unit/integrations/helpers/paypal_helper_test.rb +0 -171
  185. data/test/unit/integrations/helpers/quickpay_helper_test.rb +0 -40
  186. data/test/unit/integrations/helpers/two_checkout_helper_test.rb +0 -92
  187. data/test/unit/integrations/hi_trust_module_test.rb +0 -13
  188. data/test/unit/integrations/nochex_module_test.rb +0 -13
  189. data/test/unit/integrations/notifications/chronopay_notification_test.rb +0 -66
  190. data/test/unit/integrations/notifications/gestpay_notification_test.rb +0 -60
  191. data/test/unit/integrations/notifications/hi_trust_notification_test.rb +0 -59
  192. data/test/unit/integrations/notifications/nochex_notification_test.rb +0 -51
  193. data/test/unit/integrations/notifications/notification_test.rb +0 -54
  194. data/test/unit/integrations/notifications/paypal_notification_test.rb +0 -85
  195. data/test/unit/integrations/notifications/quickpay_notification_test.rb +0 -69
  196. data/test/unit/integrations/notifications/two_checkout_notification_test.rb +0 -55
  197. data/test/unit/integrations/paypal_module_test.rb +0 -28
  198. data/test/unit/integrations/quickpay_module_test.rb +0 -9
  199. data/test/unit/integrations/returns/chronopay_return_test.rb +0 -11
  200. data/test/unit/integrations/returns/gestpay_return_test.rb +0 -10
  201. data/test/unit/integrations/returns/hi_trust_return_test.rb +0 -24
  202. data/test/unit/integrations/returns/nochex_return_test.rb +0 -10
  203. data/test/unit/integrations/returns/paypal_return_test.rb +0 -10
  204. data/test/unit/integrations/returns/return_test.rb +0 -11
  205. data/test/unit/integrations/returns/two_checkout_return_test.rb +0 -24
  206. data/test/unit/integrations/two_checkout_module_test.rb +0 -13
  207. data/test/unit/post_data_test.rb +0 -55
  208. data/test/unit/posts_data_test.rb +0 -48
  209. data/test/unit/response_test.rb +0 -28
  210. data/test/unit/utils_test.rb +0 -7
  211. data/test/unit/validateable_test.rb +0 -60
@@ -1,185 +0,0 @@
1
- require 'test_helper'
2
-
3
- class JetpayTest < Test::Unit::TestCase
4
- include ActiveMerchant::Billing
5
-
6
- def setup
7
- Base.gateway_mode = :test
8
-
9
- @gateway = JetpayGateway.new(:login => 'login')
10
-
11
- @credit_card = credit_card
12
- @amount = 100
13
-
14
- @options = {
15
- :order_id => '1',
16
- :billing_address => address(:country => 'US'),
17
- :shipping_address => address(:country => 'US'),
18
- :email => 'test@test.com',
19
- :ip => '127.0.0.1',
20
- :order_id => '12345',
21
- :tax => 7
22
- }
23
- end
24
-
25
- def test_successful_purchase
26
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
27
-
28
- assert response = @gateway.purchase(@amount, @credit_card, @options)
29
- assert_success response
30
-
31
- assert_equal '707a4f1750d8dc03bd;TEST47;100', response.authorization
32
- assert_equal('TEST47', response.params["approval"])
33
- assert response.test?
34
- end
35
-
36
- def test_unsuccessful_request
37
- @gateway.expects(:ssl_post).returns(failed_purchase_response)
38
-
39
- assert response = @gateway.purchase(@amount, @credit_card, @options)
40
- assert_failure response
41
- assert_equal('7605f7c5d6e8f74deb;;100', response.authorization)
42
- assert response.test?
43
- end
44
-
45
- def test_successful_authorize
46
- @gateway.expects(:ssl_post).returns(successful_authorize_response)
47
-
48
- assert response = @gateway.authorize(@amount, @credit_card, @options)
49
- assert_success response
50
-
51
- assert_equal('010327153017T10018;502F6B;100', response.authorization)
52
- assert_equal('502F6B', response.params["approval"])
53
- assert response.test?
54
- end
55
-
56
- def test_successful_capture
57
- @gateway.expects(:ssl_post).returns(successful_capture_response)
58
-
59
- assert response = @gateway.capture(1111, "010327153017T10018;502F7B;1111")
60
- assert_success response
61
-
62
- assert_equal('010327153017T10018;502F6B;1111', response.authorization)
63
- assert_equal('502F6B', response.params["approval"])
64
- assert response.test?
65
- end
66
-
67
- def test_successful_void
68
- # no need for csv
69
- card = credit_card('4242424242424242', :verification_value => nil)
70
-
71
- @gateway.expects(:ssl_post).returns(successful_void_response)
72
-
73
- assert response = @gateway.void('010327153x17T10418;502F7B;500')
74
- assert_success response
75
-
76
- assert_equal('010327153x17T10418;502F7B;500', response.authorization)
77
- assert_equal('502F7B', response.params["approval"])
78
- assert response.test?
79
- end
80
-
81
- def test_successful_credit
82
- # no need for csv
83
- card = credit_card('4242424242424242', :verification_value => nil)
84
-
85
- @gateway.expects(:ssl_post).returns(successful_credit_response)
86
-
87
- # linked credit
88
- assert response = @gateway.credit(9900, '010327153017T10017')
89
- assert_success response
90
-
91
- assert_equal('010327153017T10017;002F6B;9900', response.authorization)
92
- assert_equal('002F6B', response.params['approval'])
93
- assert response.test?
94
-
95
- # unlinked credit
96
- @gateway.expects(:ssl_post).returns(successful_credit_response)
97
-
98
- assert response = @gateway.credit(9900, card)
99
- assert_success response
100
- end
101
-
102
- def test_avs_result
103
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
104
-
105
- response = @gateway.purchase(@amount, @credit_card)
106
- assert_equal 'Y', response.avs_result['code']
107
- end
108
-
109
- def test_cvv_result
110
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
111
-
112
- response = @gateway.purchase(@amount, @credit_card)
113
- assert_equal 'P', response.cvv_result['code']
114
- end
115
-
116
-
117
- private
118
- def successful_purchase_response
119
- <<-EOF
120
- <JetPayResponse><TransactionID>707a4f1750d8dc03bd</TransactionID>
121
- <ActionCode>000</ActionCode>
122
- <Approval>TEST47</Approval>
123
- <CVV2>P</CVV2>
124
- <ResponseText>APPROVED</ResponseText>
125
- <AddressMatch>Y</AddressMatch>
126
- <ZipMatch>Y</ZipMatch>
127
- <AVS>Y</AVS>
128
- </JetPayResponse>
129
- EOF
130
- end
131
-
132
- def failed_purchase_response
133
- <<-EOF
134
- <JetPayResponse>
135
- <TransactionID>7605f7c5d6e8f74deb</TransactionID>
136
- <ActionCode>005</ActionCode>
137
- <ResponseText>DECLINED</ResponseText>
138
- </JetPayResponse>
139
- EOF
140
- end
141
-
142
- def successful_authorize_response
143
- <<-EOF
144
- <JetPayResponse>
145
- <TransactionID>010327153017T10018</TransactionID>
146
- <ActionCode>000</ActionCode>
147
- <Approval>502F6B</Approval>
148
- <ResponseText>APPROVED</ResponseText>
149
- </JetPayResponse>
150
- EOF
151
- end
152
-
153
- def successful_capture_response
154
- <<-EOF
155
- <JetPayResponse>
156
- <TransactionID>010327153017T10018</TransactionID>
157
- <ActionCode>000</ActionCode>
158
- <Approval>502F6B</Approval>
159
- <ResponseText>APPROVED</ResponseText>
160
- </JetPayResponse>
161
- EOF
162
- end
163
-
164
- def successful_void_response
165
- <<-EOF
166
- <JetPayResponse>
167
- <TransactionID>010327153x17T10418</TransactionID>
168
- <ActionCode>000</ActionCode>
169
- <Approval>502F7B</Approval>
170
- <ResponseText>VOID PROCESSED</ResponseText>
171
- </JetPayResponse>
172
- EOF
173
- end
174
-
175
- def successful_credit_response
176
- <<-EOF
177
- <JetPayResponse>
178
- <TransactionID>010327153017T10017</TransactionID>
179
- <ActionCode>000</ActionCode>
180
- <Approval>002F6B</Approval>
181
- <ResponseText>APPROVED</ResponseText>
182
- </JetPayResponse>
183
- EOF
184
- end
185
- end
@@ -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, :jcb, :diners_club], 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