patmaddox-activemerchant 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. data/CHANGELOG +480 -0
  2. data/CONTRIBUTORS +126 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README +136 -0
  5. data/Rakefile +153 -0
  6. data/gem-public_cert.pem +20 -0
  7. data/init.rb +3 -0
  8. data/lib/active_merchant.rb +66 -0
  9. data/lib/active_merchant/billing/avs_result.rb +98 -0
  10. data/lib/active_merchant/billing/base.rb +57 -0
  11. data/lib/active_merchant/billing/check.rb +68 -0
  12. data/lib/active_merchant/billing/credit_card.rb +159 -0
  13. data/lib/active_merchant/billing/credit_card_formatting.rb +21 -0
  14. data/lib/active_merchant/billing/credit_card_methods.rb +125 -0
  15. data/lib/active_merchant/billing/cvv_result.rb +38 -0
  16. data/lib/active_merchant/billing/expiry_date.rb +34 -0
  17. data/lib/active_merchant/billing/gateway.rb +158 -0
  18. data/lib/active_merchant/billing/gateways.rb +18 -0
  19. data/lib/active_merchant/billing/gateways/authorize_net.rb +657 -0
  20. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +743 -0
  21. data/lib/active_merchant/billing/gateways/beanstream.rb +102 -0
  22. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +233 -0
  23. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +54 -0
  24. data/lib/active_merchant/billing/gateways/bogus.rb +101 -0
  25. data/lib/active_merchant/billing/gateways/braintree.rb +17 -0
  26. data/lib/active_merchant/billing/gateways/card_stream.rb +230 -0
  27. data/lib/active_merchant/billing/gateways/cyber_source.rb +406 -0
  28. data/lib/active_merchant/billing/gateways/data_cash.rb +595 -0
  29. data/lib/active_merchant/billing/gateways/efsnet.rb +229 -0
  30. data/lib/active_merchant/billing/gateways/elavon.rb +134 -0
  31. data/lib/active_merchant/billing/gateways/eway.rb +277 -0
  32. data/lib/active_merchant/billing/gateways/exact.rb +222 -0
  33. data/lib/active_merchant/billing/gateways/first_pay.rb +172 -0
  34. data/lib/active_merchant/billing/gateways/instapay.rb +164 -0
  35. data/lib/active_merchant/billing/gateways/jetpay.rb +270 -0
  36. data/lib/active_merchant/billing/gateways/linkpoint.rb +449 -0
  37. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +154 -0
  38. data/lib/active_merchant/billing/gateways/merchant_ware.rb +283 -0
  39. data/lib/active_merchant/billing/gateways/modern_payments.rb +36 -0
  40. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +220 -0
  41. data/lib/active_merchant/billing/gateways/moneris.rb +205 -0
  42. data/lib/active_merchant/billing/gateways/net_registry.rb +189 -0
  43. data/lib/active_merchant/billing/gateways/netbilling.rb +168 -0
  44. data/lib/active_merchant/billing/gateways/ogone.rb +279 -0
  45. data/lib/active_merchant/billing/gateways/pay_junction.rb +392 -0
  46. data/lib/active_merchant/billing/gateways/pay_secure.rb +120 -0
  47. data/lib/active_merchant/billing/gateways/payflow.rb +236 -0
  48. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +207 -0
  49. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +39 -0
  50. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
  51. data/lib/active_merchant/billing/gateways/payflow_express.rb +138 -0
  52. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +15 -0
  53. data/lib/active_merchant/billing/gateways/payflow_uk.rb +21 -0
  54. data/lib/active_merchant/billing/gateways/payment_express.rb +230 -0
  55. data/lib/active_merchant/billing/gateways/paypal.rb +121 -0
  56. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +326 -0
  57. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +38 -0
  58. data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
  59. data/lib/active_merchant/billing/gateways/paypal_express.rb +130 -0
  60. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +20 -0
  61. data/lib/active_merchant/billing/gateways/plugnpay.rb +292 -0
  62. data/lib/active_merchant/billing/gateways/psigate.rb +214 -0
  63. data/lib/active_merchant/billing/gateways/psl_card.rb +306 -0
  64. data/lib/active_merchant/billing/gateways/quickpay.rb +213 -0
  65. data/lib/active_merchant/billing/gateways/realex.rb +200 -0
  66. data/lib/active_merchant/billing/gateways/sage.rb +146 -0
  67. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +88 -0
  68. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +116 -0
  69. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +97 -0
  70. data/lib/active_merchant/billing/gateways/sage_pay.rb +308 -0
  71. data/lib/active_merchant/billing/gateways/sallie_mae.rb +144 -0
  72. data/lib/active_merchant/billing/gateways/secure_pay.rb +31 -0
  73. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +157 -0
  74. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +113 -0
  75. data/lib/active_merchant/billing/gateways/skip_jack.rb +452 -0
  76. data/lib/active_merchant/billing/gateways/smart_ps.rb +265 -0
  77. data/lib/active_merchant/billing/gateways/trans_first.rb +127 -0
  78. data/lib/active_merchant/billing/gateways/transax.rb +26 -0
  79. data/lib/active_merchant/billing/gateways/trust_commerce.rb +418 -0
  80. data/lib/active_merchant/billing/gateways/usa_epay.rb +194 -0
  81. data/lib/active_merchant/billing/gateways/verifi.rb +228 -0
  82. data/lib/active_merchant/billing/gateways/viaklix.rb +189 -0
  83. data/lib/active_merchant/billing/gateways/wirecard.rb +318 -0
  84. data/lib/active_merchant/billing/integrations.rb +29 -0
  85. data/lib/active_merchant/billing/integrations/action_view_helper.rb +79 -0
  86. data/lib/active_merchant/billing/integrations/bogus.rb +23 -0
  87. data/lib/active_merchant/billing/integrations/bogus/helper.rb +17 -0
  88. data/lib/active_merchant/billing/integrations/bogus/notification.rb +11 -0
  89. data/lib/active_merchant/billing/integrations/bogus/return.rb +10 -0
  90. data/lib/active_merchant/billing/integrations/chronopay.rb +23 -0
  91. data/lib/active_merchant/billing/integrations/chronopay/helper.rb +81 -0
  92. data/lib/active_merchant/billing/integrations/chronopay/notification.rb +156 -0
  93. data/lib/active_merchant/billing/integrations/chronopay/return.rb +10 -0
  94. data/lib/active_merchant/billing/integrations/gestpay.rb +25 -0
  95. data/lib/active_merchant/billing/integrations/gestpay/common.rb +42 -0
  96. data/lib/active_merchant/billing/integrations/gestpay/helper.rb +70 -0
  97. data/lib/active_merchant/billing/integrations/gestpay/notification.rb +83 -0
  98. data/lib/active_merchant/billing/integrations/gestpay/return.rb +10 -0
  99. data/lib/active_merchant/billing/integrations/helper.rb +93 -0
  100. data/lib/active_merchant/billing/integrations/hi_trust.rb +27 -0
  101. data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +58 -0
  102. data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +59 -0
  103. data/lib/active_merchant/billing/integrations/hi_trust/return.rb +67 -0
  104. data/lib/active_merchant/billing/integrations/nochex.rb +88 -0
  105. data/lib/active_merchant/billing/integrations/nochex/helper.rb +68 -0
  106. data/lib/active_merchant/billing/integrations/nochex/notification.rb +94 -0
  107. data/lib/active_merchant/billing/integrations/nochex/return.rb +10 -0
  108. data/lib/active_merchant/billing/integrations/notification.rb +62 -0
  109. data/lib/active_merchant/billing/integrations/paypal.rb +39 -0
  110. data/lib/active_merchant/billing/integrations/paypal/helper.rb +119 -0
  111. data/lib/active_merchant/billing/integrations/paypal/notification.rb +154 -0
  112. data/lib/active_merchant/billing/integrations/paypal/return.rb +10 -0
  113. data/lib/active_merchant/billing/integrations/quickpay.rb +17 -0
  114. data/lib/active_merchant/billing/integrations/quickpay/helper.rb +72 -0
  115. data/lib/active_merchant/billing/integrations/quickpay/notification.rb +74 -0
  116. data/lib/active_merchant/billing/integrations/return.rb +35 -0
  117. data/lib/active_merchant/billing/integrations/two_checkout.rb +23 -0
  118. data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +59 -0
  119. data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +114 -0
  120. data/lib/active_merchant/billing/integrations/two_checkout/return.rb +17 -0
  121. data/lib/active_merchant/billing/response.rb +32 -0
  122. data/lib/active_merchant/lib/connection.rb +170 -0
  123. data/lib/active_merchant/lib/country.rb +319 -0
  124. data/lib/active_merchant/lib/error.rb +4 -0
  125. data/lib/active_merchant/lib/post_data.rb +22 -0
  126. data/lib/active_merchant/lib/posts_data.rb +47 -0
  127. data/lib/active_merchant/lib/requires_parameters.rb +16 -0
  128. data/lib/active_merchant/lib/utils.rb +18 -0
  129. data/lib/active_merchant/lib/validateable.rb +76 -0
  130. data/lib/certs/cacert.pem +7815 -0
  131. data/lib/support/gateway_support.rb +58 -0
  132. data/script/destroy +14 -0
  133. data/script/generate +14 -0
  134. data/test/fixtures.yml +355 -0
  135. data/test/remote/gateways/remote_authorize_net_cim_test.rb +460 -0
  136. data/test/remote/gateways/remote_authorize_net_test.rb +145 -0
  137. data/test/remote/gateways/remote_beanstream_interac_test.rb +53 -0
  138. data/test/remote/gateways/remote_beanstream_test.rb +150 -0
  139. data/test/remote/gateways/remote_braintree_test.rb +154 -0
  140. data/test/remote/gateways/remote_card_stream_test.rb +148 -0
  141. data/test/remote/gateways/remote_cyber_source_test.rb +144 -0
  142. data/test/remote/gateways/remote_data_cash_test.rb +357 -0
  143. data/test/remote/gateways/remote_efsnet_test.rb +81 -0
  144. data/test/remote/gateways/remote_elavon_test.rb +66 -0
  145. data/test/remote/gateways/remote_eway_test.rb +74 -0
  146. data/test/remote/gateways/remote_exact_test.rb +60 -0
  147. data/test/remote/gateways/remote_first_pay_test.rb +87 -0
  148. data/test/remote/gateways/remote_instapay_test.rb +61 -0
  149. data/test/remote/gateways/remote_jetpay_test.rb +103 -0
  150. data/test/remote/gateways/remote_linkpoint_test.rb +121 -0
  151. data/test/remote/gateways/remote_merchant_e_solutions_test.rb +173 -0
  152. data/test/remote/gateways/remote_merchant_ware_test.rb +113 -0
  153. data/test/remote/gateways/remote_modern_payments_cim_test.rb +58 -0
  154. data/test/remote/gateways/remote_modern_payments_test.rb +57 -0
  155. data/test/remote/gateways/remote_moneris_test.rb +82 -0
  156. data/test/remote/gateways/remote_net_registry_test.rb +85 -0
  157. data/test/remote/gateways/remote_netbilling_test.rb +70 -0
  158. data/test/remote/gateways/remote_ogone_test.rb +115 -0
  159. data/test/remote/gateways/remote_pay_junction_test.rb +143 -0
  160. data/test/remote/gateways/remote_pay_secure_test.rb +39 -0
  161. data/test/remote/gateways/remote_payflow_express_test.rb +50 -0
  162. data/test/remote/gateways/remote_payflow_test.rb +237 -0
  163. data/test/remote/gateways/remote_payflow_uk_test.rb +173 -0
  164. data/test/remote/gateways/remote_payment_express_test.rb +136 -0
  165. data/test/remote/gateways/remote_paypal_express_test.rb +49 -0
  166. data/test/remote/gateways/remote_paypal_test.rb +191 -0
  167. data/test/remote/gateways/remote_plugnpay_test.rb +72 -0
  168. data/test/remote/gateways/remote_psigate_test.rb +50 -0
  169. data/test/remote/gateways/remote_psl_card_test.rb +125 -0
  170. data/test/remote/gateways/remote_quickpay_test.rb +190 -0
  171. data/test/remote/gateways/remote_realex_test.rb +224 -0
  172. data/test/remote/gateways/remote_sage_bankcard_test.rb +109 -0
  173. data/test/remote/gateways/remote_sage_pay_test.rb +219 -0
  174. data/test/remote/gateways/remote_sage_test.rb +87 -0
  175. data/test/remote/gateways/remote_sage_virtual_check_test.rb +62 -0
  176. data/test/remote/gateways/remote_sallie_mae_test.rb +51 -0
  177. data/test/remote/gateways/remote_secure_pay_au_test.rb +40 -0
  178. data/test/remote/gateways/remote_secure_pay_tech_test.rb +37 -0
  179. data/test/remote/gateways/remote_secure_pay_test.rb +28 -0
  180. data/test/remote/gateways/remote_skipjack_test.rb +105 -0
  181. data/test/remote/gateways/remote_trans_first_test.rb +34 -0
  182. data/test/remote/gateways/remote_transax_test.rb +112 -0
  183. data/test/remote/gateways/remote_trust_commerce_test.rb +152 -0
  184. data/test/remote/gateways/remote_usa_epay_test.rb +46 -0
  185. data/test/remote/gateways/remote_verifi_test.rb +107 -0
  186. data/test/remote/gateways/remote_viaklix_test.rb +43 -0
  187. data/test/remote/gateways/remote_wirecard_test.rb +111 -0
  188. data/test/remote/integrations/remote_gestpay_integration_test.rb +37 -0
  189. data/test/remote/integrations/remote_paypal_integration_test.rb +26 -0
  190. data/test/test_helper.rb +182 -0
  191. data/test/unit/avs_result_test.rb +59 -0
  192. data/test/unit/base_test.rb +55 -0
  193. data/test/unit/check_test.rb +88 -0
  194. data/test/unit/connection_test.rb +129 -0
  195. data/test/unit/country_code_test.rb +33 -0
  196. data/test/unit/country_test.rb +64 -0
  197. data/test/unit/credit_card_formatting_test.rb +19 -0
  198. data/test/unit/credit_card_methods_test.rb +179 -0
  199. data/test/unit/credit_card_test.rb +318 -0
  200. data/test/unit/cvv_result_test.rb +33 -0
  201. data/test/unit/expiry_date_test.rb +32 -0
  202. data/test/unit/gateways/authorize_net_cim_test.rb +676 -0
  203. data/test/unit/gateways/authorize_net_test.rb +290 -0
  204. data/test/unit/gateways/beanstream_interac_test.rb +51 -0
  205. data/test/unit/gateways/beanstream_test.rb +108 -0
  206. data/test/unit/gateways/bogus_test.rb +46 -0
  207. data/test/unit/gateways/braintree_test.rb +126 -0
  208. data/test/unit/gateways/card_stream_test.rb +90 -0
  209. data/test/unit/gateways/cyber_source_test.rb +188 -0
  210. data/test/unit/gateways/data_cash_test.rb +133 -0
  211. data/test/unit/gateways/efsnet_test.rb +123 -0
  212. data/test/unit/gateways/elavon_test.rb +139 -0
  213. data/test/unit/gateways/eway_test.rb +118 -0
  214. data/test/unit/gateways/exact_test.rb +156 -0
  215. data/test/unit/gateways/first_pay_test.rb +125 -0
  216. data/test/unit/gateways/gateway_test.rb +48 -0
  217. data/test/unit/gateways/instapay_test.rb +102 -0
  218. data/test/unit/gateways/jetpay_test.rb +185 -0
  219. data/test/unit/gateways/linkpoint_test.rb +197 -0
  220. data/test/unit/gateways/merchant_e_solutions_test.rb +169 -0
  221. data/test/unit/gateways/merchant_ware_test.rb +188 -0
  222. data/test/unit/gateways/modern_payments_cim_test.rb +162 -0
  223. data/test/unit/gateways/moneris_test.rb +158 -0
  224. data/test/unit/gateways/net_registry_test.rb +416 -0
  225. data/test/unit/gateways/netbilling_test.rb +54 -0
  226. data/test/unit/gateways/ogone_test.rb +319 -0
  227. data/test/unit/gateways/pay_junction_test.rb +123 -0
  228. data/test/unit/gateways/pay_secure_test.rb +71 -0
  229. data/test/unit/gateways/payflow_express_test.rb +173 -0
  230. data/test/unit/gateways/payflow_express_uk_test.rb +86 -0
  231. data/test/unit/gateways/payflow_test.rb +305 -0
  232. data/test/unit/gateways/payflow_uk_test.rb +30 -0
  233. data/test/unit/gateways/payment_express_test.rb +195 -0
  234. data/test/unit/gateways/paypal_express_test.rb +382 -0
  235. data/test/unit/gateways/paypal_test.rb +569 -0
  236. data/test/unit/gateways/plugnpay_test.rb +86 -0
  237. data/test/unit/gateways/psigate_test.rb +169 -0
  238. data/test/unit/gateways/psl_card_test.rb +64 -0
  239. data/test/unit/gateways/quickpay_test.rb +112 -0
  240. data/test/unit/gateways/realex_test.rb +151 -0
  241. data/test/unit/gateways/sage_bankcard_test.rb +196 -0
  242. data/test/unit/gateways/sage_pay_test.rb +139 -0
  243. data/test/unit/gateways/sage_virtual_check_test.rb +71 -0
  244. data/test/unit/gateways/sallie_mae_test.rb +53 -0
  245. data/test/unit/gateways/secure_pay_au_test.rb +207 -0
  246. data/test/unit/gateways/secure_pay_tech_test.rb +44 -0
  247. data/test/unit/gateways/secure_pay_test.rb +87 -0
  248. data/test/unit/gateways/skip_jack_test.rb +213 -0
  249. data/test/unit/gateways/trans_first_test.rb +112 -0
  250. data/test/unit/gateways/trust_commerce_test.rb +90 -0
  251. data/test/unit/gateways/usa_epay_test.rb +128 -0
  252. data/test/unit/gateways/verifi_test.rb +96 -0
  253. data/test/unit/gateways/viaklix_test.rb +78 -0
  254. data/test/unit/gateways/wirecard_test.rb +250 -0
  255. data/test/unit/generators/test_gateway_generator.rb +46 -0
  256. data/test/unit/generators/test_generator_helper.rb +20 -0
  257. data/test/unit/generators/test_integration_generator.rb +53 -0
  258. data/test/unit/integrations/action_view_helper_test.rb +50 -0
  259. data/test/unit/integrations/bogus_module_test.rb +20 -0
  260. data/test/unit/integrations/chronopay_module_test.rb +13 -0
  261. data/test/unit/integrations/gestpay_module_test.rb +14 -0
  262. data/test/unit/integrations/helpers/bogus_helper_test.rb +28 -0
  263. data/test/unit/integrations/helpers/chronopay_helper_test.rb +67 -0
  264. data/test/unit/integrations/helpers/gestpay_helper_test.rb +100 -0
  265. data/test/unit/integrations/helpers/hi_trust_helper_test.rb +16 -0
  266. data/test/unit/integrations/helpers/nochex_helper_test.rb +53 -0
  267. data/test/unit/integrations/helpers/paypal_helper_test.rb +171 -0
  268. data/test/unit/integrations/helpers/quickpay_helper_test.rb +40 -0
  269. data/test/unit/integrations/helpers/two_checkout_helper_test.rb +92 -0
  270. data/test/unit/integrations/hi_trust_module_test.rb +13 -0
  271. data/test/unit/integrations/nochex_module_test.rb +13 -0
  272. data/test/unit/integrations/notifications/chronopay_notification_test.rb +66 -0
  273. data/test/unit/integrations/notifications/gestpay_notification_test.rb +60 -0
  274. data/test/unit/integrations/notifications/hi_trust_notification_test.rb +59 -0
  275. data/test/unit/integrations/notifications/nochex_notification_test.rb +51 -0
  276. data/test/unit/integrations/notifications/notification_test.rb +54 -0
  277. data/test/unit/integrations/notifications/paypal_notification_test.rb +85 -0
  278. data/test/unit/integrations/notifications/quickpay_notification_test.rb +69 -0
  279. data/test/unit/integrations/notifications/two_checkout_notification_test.rb +55 -0
  280. data/test/unit/integrations/paypal_module_test.rb +28 -0
  281. data/test/unit/integrations/quickpay_module_test.rb +9 -0
  282. data/test/unit/integrations/returns/chronopay_return_test.rb +11 -0
  283. data/test/unit/integrations/returns/gestpay_return_test.rb +10 -0
  284. data/test/unit/integrations/returns/hi_trust_return_test.rb +24 -0
  285. data/test/unit/integrations/returns/nochex_return_test.rb +10 -0
  286. data/test/unit/integrations/returns/paypal_return_test.rb +10 -0
  287. data/test/unit/integrations/returns/return_test.rb +11 -0
  288. data/test/unit/integrations/returns/two_checkout_return_test.rb +24 -0
  289. data/test/unit/integrations/two_checkout_module_test.rb +13 -0
  290. data/test/unit/post_data_test.rb +55 -0
  291. data/test/unit/posts_data_test.rb +48 -0
  292. data/test/unit/response_test.rb +28 -0
  293. data/test/unit/utils_test.rb +7 -0
  294. data/test/unit/validateable_test.rb +60 -0
  295. metadata +367 -0
@@ -0,0 +1,569 @@
1
+ require 'test_helper'
2
+
3
+ class PaypalTest < Test::Unit::TestCase
4
+ def setup
5
+ Base.mode = :test
6
+ PaypalGateway.pem_file = nil
7
+
8
+ @amount = 100
9
+ @gateway = PaypalGateway.new(
10
+ :login => 'cody',
11
+ :password => 'test',
12
+ :pem => 'PEM'
13
+ )
14
+
15
+ @credit_card = credit_card('4242424242424242')
16
+ @options = { :billing_address => address, :ip => '127.0.0.1' }
17
+ end
18
+
19
+ def test_no_ip_address
20
+ assert_raise(ArgumentError){ @gateway.purchase(@amount, @credit_card, :billing_address => address)}
21
+ end
22
+
23
+ def test_successful_purchase
24
+ @gateway.expects(:ssl_post).returns(successful_purchase_response)
25
+
26
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
27
+ assert_instance_of Response, response
28
+ assert_success response
29
+ assert_equal '62U664727W5914806', response.authorization
30
+ assert response.test?
31
+ end
32
+
33
+ def test_successful_reference_purchase
34
+ @gateway.expects(:ssl_post).returns(successful_purchase_response)
35
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
36
+ assert_instance_of Response, response
37
+ assert_success response
38
+ assert_equal '62U664727W5914806', response.authorization
39
+
40
+ ref_id = response.authorization
41
+
42
+ gateway2 = PaypalGateway.new(:login => 'cody', :password => 'test', :pem => 'PEM')
43
+ gateway2.expects(:ssl_post).returns(successful_reference_purchase_response)
44
+ assert response = gateway2.purchase(@amount, ref_id, @options)
45
+ assert_instance_of Response, response
46
+ assert_success response
47
+ assert_equal '62U664727W5915049', response.authorization
48
+ assert response.test?
49
+ end
50
+
51
+ def test_failed_purchase
52
+ @gateway.expects(:ssl_post).returns(failed_purchase_response)
53
+
54
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
55
+ assert_instance_of Response, response
56
+ assert_failure response
57
+ assert response.test?
58
+ end
59
+
60
+ def test_reauthorization
61
+ @gateway.expects(:ssl_post).returns(successful_reauthorization_response)
62
+ response = @gateway.reauthorize(@amount, '32J876265E528623B')
63
+ assert response.success?
64
+ assert_equal('1TX27389GX108740X', response.authorization)
65
+ assert response.test?
66
+ end
67
+
68
+ def test_reauthorization_with_warning
69
+ @gateway.expects(:ssl_post).returns(successful_with_warning_reauthorization_response)
70
+ response = @gateway.reauthorize(@amount, '32J876265E528623B')
71
+ assert response.success?
72
+ assert_equal('1TX27389GX108740X', response.authorization)
73
+ assert response.test?
74
+ end
75
+
76
+ def test_amount_style
77
+ assert_equal '10.34', @gateway.send(:amount, 1034)
78
+
79
+ assert_raise(ArgumentError) do
80
+ @gateway.send(:amount, '10.34')
81
+ end
82
+ end
83
+
84
+ def test_paypal_timeout_error
85
+ @gateway.stubs(:ssl_post).returns(paypal_timeout_error_response)
86
+ response = @gateway.purchase(@amount, @credit_card, @options)
87
+ assert_equal "SOAP-ENV:Server", response.params['faultcode']
88
+ assert_equal "Internal error", response.params['faultstring']
89
+ assert_equal "Timeout processing request", response.params['detail']
90
+ assert_equal "SOAP-ENV:Server: Internal error - Timeout processing request", response.message
91
+ end
92
+
93
+ def test_pem_file_accessor
94
+ PaypalGateway.pem_file = '123456'
95
+ gateway = PaypalGateway.new(:login => 'test', :password => 'test')
96
+ assert_equal '123456', gateway.options[:pem]
97
+ end
98
+
99
+ def test_passed_in_pem_overrides_class_accessor
100
+ PaypalGateway.pem_file = '123456'
101
+ gateway = PaypalGateway.new(:login => 'test', :password => 'test', :pem => 'Clobber')
102
+ assert_equal 'Clobber', gateway.options[:pem]
103
+ end
104
+
105
+ def test_ensure_options_are_transferred_to_express_instance
106
+ PaypalGateway.pem_file = '123456'
107
+ gateway = PaypalGateway.new(:login => 'test', :password => 'password')
108
+ express = gateway.express
109
+ assert_instance_of PaypalExpressGateway, express
110
+ assert_equal 'test', express.options[:login]
111
+ assert_equal 'password', express.options[:password]
112
+ assert_equal '123456', express.options[:pem]
113
+ end
114
+
115
+ def test_supported_countries
116
+ assert_equal ['US'], PaypalGateway.supported_countries
117
+ end
118
+
119
+ def test_supported_card_types
120
+ assert_equal [:visa, :master, :american_express, :discover], PaypalGateway.supported_cardtypes
121
+ end
122
+
123
+ def test_button_source
124
+ PaypalGateway.application_id = 'ActiveMerchant_DC'
125
+
126
+ xml = REXML::Document.new(@gateway.send(:build_sale_or_authorization_request, 'Test', @amount, @credit_card, {}))
127
+ assert_equal 'ActiveMerchant_DC', REXML::XPath.first(xml, '//n2:ButtonSource').text
128
+ end
129
+
130
+ def test_item_total_shipping_handling_and_tax_not_included_unless_all_are_present
131
+ xml = @gateway.send(:build_sale_or_authorization_request, 'Authorization', @amount, @credit_card,
132
+ :tax => @amount,
133
+ :shipping => @amount,
134
+ :handling => @amount
135
+ )
136
+
137
+ doc = REXML::Document.new(xml)
138
+ assert_nil REXML::XPath.first(doc, '//n2:PaymentDetails/n2:TaxTotal')
139
+ end
140
+
141
+ def test_item_total_shipping_handling_and_tax
142
+ xml = @gateway.send(:build_sale_or_authorization_request, 'Authorization', @amount, @credit_card,
143
+ :tax => @amount,
144
+ :shipping => @amount,
145
+ :handling => @amount,
146
+ :subtotal => 200
147
+ )
148
+
149
+ doc = REXML::Document.new(xml)
150
+ assert_equal '1.00', REXML::XPath.first(doc, '//n2:PaymentDetails/n2:TaxTotal').text
151
+ end
152
+
153
+ def test_should_use_test_certificate_endpoint
154
+ gateway = PaypalGateway.new(
155
+ :login => 'cody',
156
+ :password => 'test',
157
+ :pem => 'PEM'
158
+ )
159
+ assert_equal PaypalGateway::URLS[:test][:certificate], gateway.send(:endpoint_url)
160
+ end
161
+
162
+ def test_should_use_live_certificate_endpoint
163
+ gateway = PaypalGateway.new(
164
+ :login => 'cody',
165
+ :password => 'test',
166
+ :pem => 'PEM'
167
+ )
168
+ gateway.expects(:test?).returns(false)
169
+
170
+ assert_equal PaypalGateway::URLS[:live][:certificate], gateway.send(:endpoint_url)
171
+ end
172
+
173
+ def test_should_use_test_signature_endpoint
174
+ gateway = PaypalGateway.new(
175
+ :login => 'cody',
176
+ :password => 'test',
177
+ :signature => 'SIG'
178
+ )
179
+
180
+ assert_equal PaypalGateway::URLS[:test][:signature], gateway.send(:endpoint_url)
181
+ end
182
+
183
+ def test_should_use_live_signature_endpoint
184
+ gateway = PaypalGateway.new(
185
+ :login => 'cody',
186
+ :password => 'test',
187
+ :signature => 'SIG'
188
+ )
189
+ gateway.expects(:test?).returns(false)
190
+
191
+ assert_equal PaypalGateway::URLS[:live][:signature], gateway.send(:endpoint_url)
192
+ end
193
+
194
+ def test_should_raise_argument_when_credentials_not_present
195
+ assert_raises(ArgumentError) do
196
+ PaypalGateway.new(:login => 'cody', :password => 'test')
197
+ end
198
+ end
199
+
200
+ def test_avs_result
201
+ @gateway.expects(:ssl_post).returns(successful_purchase_response)
202
+
203
+ response = @gateway.purchase(@amount, @credit_card, @options)
204
+ assert_equal 'X', response.avs_result['code']
205
+ end
206
+
207
+ def test_cvv_result
208
+ @gateway.expects(:ssl_post).returns(successful_purchase_response)
209
+
210
+ response = @gateway.purchase(@amount, @credit_card, @options)
211
+ assert_equal 'M', response.cvv_result['code']
212
+ end
213
+
214
+ def test_fraud_review
215
+ @gateway.expects(:ssl_post).returns(fraud_review_response)
216
+
217
+ response = @gateway.purchase(@amount, @credit_card, @options)
218
+ assert_success response
219
+ assert_equal "SuccessWithWarning", response.params["ack"]
220
+ assert_equal "Payment Pending your review in Fraud Management Filters", response.message
221
+ assert response.fraud_review?
222
+ end
223
+
224
+ def test_failed_capture_due_to_pending_fraud_review
225
+ @gateway.expects(:ssl_post).returns(failed_capture_due_to_pending_fraud_review)
226
+
227
+ response = @gateway.capture(@amount, 'authorization')
228
+ assert_failure response
229
+ assert_equal "Transaction must be accepted in Fraud Management Filters before capture.", response.message
230
+ end
231
+
232
+ # This occurs when sufficient 3rd party API permissions are not present to make the call for the user
233
+ def test_authentication_failed_response
234
+ @gateway.expects(:ssl_post).returns(authentication_failed_response)
235
+ response = @gateway.purchase(@amount, @credit_card, @options)
236
+ assert_failure response
237
+ assert_equal "10002", response.params["error_codes"]
238
+ assert_equal "You do not have permissions to make this API call", response.message
239
+ end
240
+
241
+ private
242
+ def successful_purchase_response
243
+ <<-RESPONSE
244
+ <?xml version="1.0" encoding="UTF-8"?>
245
+ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:market="urn:ebay:apis:Market" xmlns:auction="urn:ebay:apis:Auction" xmlns:sizeship="urn:ebay:api:PayPalAPI/sizeship.xsd" xmlns:ship="urn:ebay:apis:ship" xmlns:skype="urn:ebay:apis:skype" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI">
246
+ <SOAP-ENV:Header>
247
+ <Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"/>
248
+ <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
249
+ <Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
250
+ <Username xsi:type="xs:string"/>
251
+ <Password xsi:type="xs:string"/>
252
+ <Subject xsi:type="xs:string"/>
253
+ </Credentials>
254
+ </RequesterCredentials>
255
+ </SOAP-ENV:Header>
256
+ <SOAP-ENV:Body id="_0">
257
+ <DoDirectPaymentResponse xmlns="urn:ebay:api:PayPalAPI">
258
+ <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2008-01-06T23:41:25Z</Timestamp>
259
+ <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack>
260
+ <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">fee61882e6f47</CorrelationID>
261
+ <Version xmlns="urn:ebay:apis:eBLBaseComponents">2.000000</Version>
262
+ <Build xmlns="urn:ebay:apis:eBLBaseComponents">1.0006</Build>
263
+ <Amount xsi:type="cc:BasicAmountType" currencyID="USD">3.00</Amount>
264
+ <AVSCode xsi:type="xs:string">X</AVSCode>
265
+ <CVV2Code xsi:type="xs:string">M</CVV2Code>
266
+ <TransactionID>62U664727W5914806</TransactionID>
267
+ </DoDirectPaymentResponse>
268
+ </SOAP-ENV:Body>
269
+ </SOAP-ENV:Envelope>
270
+ RESPONSE
271
+ end
272
+
273
+ def successful_reference_purchase_response
274
+ <<-RESPONSE
275
+ <?xml version="1.0" encoding="UTF-8"?>
276
+ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:market="urn:ebay:apis:Market" xmlns:auction="urn:ebay:apis:Auction" xmlns:sizeship="urn:ebay:api:PayPalAPI/sizeship.xsd" xmlns:ship="urn:ebay:apis:ship" xmlns:skype="urn:ebay:apis:skype" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI">
277
+ <SOAP-ENV:Header>
278
+ <Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"/>
279
+ <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
280
+ <Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
281
+ <Username xsi:type="xs:string"/>
282
+ <Password xsi:type="xs:string"/>
283
+ <Subject xsi:type="xs:string"/>
284
+ </Credentials>
285
+ </RequesterCredentials>
286
+ </SOAP-ENV:Header>
287
+ <SOAP-ENV:Body id="_0">
288
+ <DoReferenceTransactionResponse xmlns="urn:ebay:api:PayPalAPI">
289
+ <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2008-01-06T23:41:25Z</Timestamp>
290
+ <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack>
291
+ <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">fee61882e6f47</CorrelationID>
292
+ <Version xmlns="urn:ebay:apis:eBLBaseComponents">2.000000</Version>
293
+ <Build xmlns="urn:ebay:apis:eBLBaseComponents">1.0006</Build>
294
+ <Amount xsi:type="cc:BasicAmountType" currencyID="USD">3.00</Amount>
295
+ <AVSCode xsi:type="xs:string">X</AVSCode>
296
+ <CVV2Code xsi:type="xs:string">M</CVV2Code>
297
+ <TransactionID>62U664727W5915049</TransactionID>
298
+ </DoReferenceTransactionResponse>
299
+ </SOAP-ENV:Body>
300
+ </SOAP-ENV:Envelope>
301
+ RESPONSE
302
+ end
303
+
304
+ def failed_purchase_response
305
+ <<-RESPONSE
306
+ <?xml version="1.0" encoding="UTF-8"?>
307
+ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:market="urn:ebay:apis:Market" xmlns:auction="urn:ebay:apis:Auction" xmlns:sizeship="urn:ebay:api:PayPalAPI/sizeship.xsd" xmlns:ship="urn:ebay:apis:ship" xmlns:skype="urn:ebay:apis:skype" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI">
308
+ <SOAP-ENV:Header>
309
+ <Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"/>
310
+ <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
311
+ <Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
312
+ <Username xsi:type="xs:string"/>
313
+ <Password xsi:type="xs:string"/>
314
+ <Subject xsi:type="xs:string"/>
315
+ </Credentials>
316
+ </RequesterCredentials>
317
+ </SOAP-ENV:Header>
318
+ <SOAP-ENV:Body id="_0">
319
+ <DoDirectPaymentResponse xmlns="urn:ebay:api:PayPalAPI">
320
+ <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2008-01-06T23:41:25Z</Timestamp>
321
+ <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Failure</Ack>
322
+ <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">fee61882e6f47</CorrelationID>
323
+ <Version xmlns="urn:ebay:apis:eBLBaseComponents">2.000000</Version>
324
+ <Build xmlns="urn:ebay:apis:eBLBaseComponents">1.0006</Build>
325
+ <Amount xsi:type="cc:BasicAmountType" currencyID="USD">3.00</Amount>
326
+ <AVSCode xsi:type="xs:string">X</AVSCode>
327
+ <CVV2Code xsi:type="xs:string">M</CVV2Code>
328
+ </DoDirectPaymentResponse>
329
+ </SOAP-ENV:Body>
330
+ </SOAP-ENV:Envelope>
331
+ RESPONSE
332
+ end
333
+
334
+ def paypal_timeout_error_response
335
+ <<-RESPONSE
336
+ <?xml version='1.0' encoding='UTF-8'?>
337
+ <SOAP-ENV:Envelope xmlns:cc='urn:ebay:apis:CoreComponentTypes' xmlns:sizeship='urn:ebay:api:PayPalAPI/sizeship.xsd' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:saml='urn:oasis:names:tc:SAML:1.0:assertion' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:wsu='http://schemas.xmlsoap.org/ws/2002/07/utility' xmlns:ebl='urn:ebay:apis:eBLBaseComponents' xmlns:ds='http://www.w3.org/2000/09/xmldsig#' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:ns='urn:ebay:api:PayPalAPI' xmlns:market='urn:ebay:apis:Market' xmlns:ship='urn:ebay:apis:ship' xmlns:auction='urn:ebay:apis:Auction' xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/12/secext' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
338
+ <SOAP-ENV:Header>
339
+ <Security xsi:type='wsse:SecurityType' xmlns='http://schemas.xmlsoap.org/ws/2002/12/secext'/>
340
+ <RequesterCredentials xsi:type='ebl:CustomSecurityHeaderType' xmlns='urn:ebay:api:PayPalAPI'>
341
+ <Credentials xsi:type='ebl:UserIdPasswordType' xmlns='urn:ebay:apis:eBLBaseComponents'>
342
+ <Username xsi:type='xs:string'/>
343
+ <Password xsi:type='xs:string'/>
344
+ <Subject xsi:type='xs:string'/>
345
+ </Credentials>
346
+ </RequesterCredentials>
347
+ </SOAP-ENV:Header>
348
+ <SOAP-ENV:Body id='_0'>
349
+ <SOAP-ENV:Fault>
350
+ <faultcode>SOAP-ENV:Server</faultcode>
351
+ <faultstring>Internal error</faultstring>
352
+ <detail>Timeout processing request</detail>
353
+ </SOAP-ENV:Fault>
354
+ </SOAP-ENV:Body>
355
+ </SOAP-ENV:Envelope>
356
+ RESPONSE
357
+ end
358
+
359
+ def successful_reauthorization_response
360
+ <<-RESPONSE
361
+ <?xml version="1.0" encoding="UTF-8"?>
362
+ <SOAP-ENV:Envelope
363
+ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
364
+ xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
365
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
366
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
367
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
368
+ xmlns:cc="urn:ebay:apis:CoreComponentTypes"
369
+ xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"
370
+ xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"
371
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
372
+ xmlns:market="urn:ebay:apis:Market"
373
+ xmlns:auction="urn:ebay:apis:Auction"
374
+ xmlns:sizeship="urn:ebay:api:PayPalAPI/sizeship.xsd"
375
+ xmlns:ship="urn:ebay:apis:ship"
376
+ xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext"
377
+ xmlns:ebl="urn:ebay:apis:eBLBaseComponents"
378
+ xmlns:ns="urn:ebay:api:PayPalAPI">
379
+ <SOAP-ENV:Header>
380
+ <Security
381
+ xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext"
382
+ xsi:type="wsse:SecurityType">
383
+ </Security>
384
+ <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI"
385
+ xsi:type="ebl:CustomSecurityHeaderType">
386
+ <Credentials xmlns="urn:ebay:apis:eBLBaseComponents"
387
+ xsi:type="ebl:UserIdPasswordType">
388
+ <Username xsi:type="xs:string"></Username>
389
+ <Password xsi:type="xs:string"></Password>
390
+ <Subject xsi:type="xs:string"></Subject>
391
+ </Credentials>
392
+ </RequesterCredentials>
393
+ </SOAP-ENV:Header>
394
+ <SOAP-ENV:Body id="_0">
395
+ <DoReauthorizationResponse xmlns="urn:ebay:api:PayPalAPI">
396
+ <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2007-03-04T23:34:42Z</Timestamp>
397
+ <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack>
398
+ <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">e444ddb7b3ed9</CorrelationID>
399
+ <Version xmlns="urn:ebay:apis:eBLBaseComponents">2.000000</Version>
400
+ <Build xmlns="urn:ebay:apis:eBLBaseComponents">1.0006</Build>
401
+ <AuthorizationID xsi:type="ebl:AuthorizationId">1TX27389GX108740X</AuthorizationID>
402
+ </DoReauthorizationResponse>
403
+ </SOAP-ENV:Body>
404
+ </SOAP-ENV:Envelope>
405
+ RESPONSE
406
+ end
407
+
408
+ def successful_with_warning_reauthorization_response
409
+ <<-RESPONSE
410
+ <?xml version="1.0" encoding="UTF-8"?>
411
+ <SOAP-ENV:Envelope
412
+ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
413
+ xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
414
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
415
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
416
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
417
+ xmlns:cc="urn:ebay:apis:CoreComponentTypes"
418
+ xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"
419
+ xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"
420
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
421
+ xmlns:market="urn:ebay:apis:Market"
422
+ xmlns:auction="urn:ebay:apis:Auction"
423
+ xmlns:sizeship="urn:ebay:api:PayPalAPI/sizeship.xsd"
424
+ xmlns:ship="urn:ebay:apis:ship"
425
+ xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext"
426
+ xmlns:ebl="urn:ebay:apis:eBLBaseComponents"
427
+ xmlns:ns="urn:ebay:api:PayPalAPI">
428
+ <SOAP-ENV:Header>
429
+ <Security
430
+ xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext"
431
+ xsi:type="wsse:SecurityType">
432
+ </Security>
433
+ <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI"
434
+ xsi:type="ebl:CustomSecurityHeaderType">
435
+ <Credentials xmlns="urn:ebay:apis:eBLBaseComponents"
436
+ xsi:type="ebl:UserIdPasswordType">
437
+ <Username xsi:type="xs:string"></Username>
438
+ <Password xsi:type="xs:string"></Password>
439
+ <Subject xsi:type="xs:string"></Subject>
440
+ </Credentials>
441
+ </RequesterCredentials>
442
+ </SOAP-ENV:Header>
443
+ <SOAP-ENV:Body id="_0">
444
+ <DoReauthorizationResponse xmlns="urn:ebay:api:PayPalAPI">
445
+ <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2007-03-04T23:34:42Z</Timestamp>
446
+ <Ack xmlns="urn:ebay:apis:eBLBaseComponents">SuccessWithWarning</Ack>
447
+ <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">e444ddb7b3ed9</CorrelationID>
448
+ <Version xmlns="urn:ebay:apis:eBLBaseComponents">2.000000</Version>
449
+ <Build xmlns="urn:ebay:apis:eBLBaseComponents">1.0006</Build>
450
+ <AuthorizationID xsi:type="ebl:AuthorizationId">1TX27389GX108740X</AuthorizationID>
451
+ </DoReauthorizationResponse>
452
+ </SOAP-ENV:Body>
453
+ </SOAP-ENV:Envelope>
454
+ RESPONSE
455
+ end
456
+
457
+ def fraud_review_response
458
+ <<-RESPONSE
459
+ <?xml version="1.0" encoding="UTF-8"?>
460
+ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI">
461
+ <SOAP-ENV:Header>
462
+ <Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"/>
463
+ <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
464
+ <Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
465
+ <Username xsi:type="xs:string"/>
466
+ <Password xsi:type="xs:string"/>
467
+ <Signature xsi:type="xs:string">An5ns1Kso7MWUdW4ErQKJJJ4qi4-Azffuo82oMt-Cv9I8QTOs-lG5sAv</Signature>
468
+ <Subject xsi:type="xs:string"/>
469
+ </Credentials>
470
+ </RequesterCredentials>
471
+ </SOAP-ENV:Header>
472
+ <SOAP-ENV:Body id="_0">
473
+ <DoDirectPaymentResponse xmlns="urn:ebay:api:PayPalAPI">
474
+ <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2008-07-04T19:27:39Z</Timestamp>
475
+ <Ack xmlns="urn:ebay:apis:eBLBaseComponents">SuccessWithWarning</Ack>
476
+ <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">205d8397e7ed</CorrelationID>
477
+ <Errors xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType">
478
+ <ShortMessage xsi:type="xs:string">Payment Pending your review in Fraud Management Filters</ShortMessage>
479
+ <LongMessage xsi:type="xs:string">Payment Pending your review in Fraud Management Filters</LongMessage>
480
+ <ErrorCode xsi:type="xs:token">11610</ErrorCode>
481
+ <SeverityCode xmlns="urn:ebay:apis:eBLBaseComponents">Warning</SeverityCode>
482
+ </Errors>
483
+ <Version xmlns="urn:ebay:apis:eBLBaseComponents">50.0</Version>
484
+ <Build xmlns="urn:ebay:apis:eBLBaseComponents">623197</Build>
485
+ <Amount xsi:type="cc:BasicAmountType" currencyID="USD">1500.00</Amount>
486
+ <AVSCode xsi:type="xs:string">X</AVSCode>
487
+ <CVV2Code xsi:type="xs:string">M</CVV2Code>
488
+ <TransactionID>5V117995ER6796022</TransactionID>
489
+ </DoDirectPaymentResponse>
490
+ </SOAP-ENV:Body>
491
+ </SOAP-ENV:Envelope>
492
+ RESPONSE
493
+ end
494
+
495
+ def failed_capture_due_to_pending_fraud_review
496
+ <<-RESPONSE
497
+ <?xml version="1.0" encoding="UTF-8"?>
498
+ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:market="urn:ebay:apis:Market" xmlns:auction="urn:ebay:apis:Auction" xmlns:sizeship="urn:ebay:api:PayPalAPI/sizeship.xsd" xmlns:ship="urn:ebay:apis:ship" xmlns:skype="urn:ebay:apis:skype" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI">
499
+ <SOAP-ENV:Header>
500
+ <Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"/>
501
+ <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
502
+ <Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
503
+ <Username xsi:type="xs:string"/>
504
+ <Password xsi:type="xs:string"/>
505
+ <Subject xsi:type="xs:string"/>
506
+ </Credentials>
507
+ </RequesterCredentials>
508
+ </SOAP-ENV:Header>
509
+ <SOAP-ENV:Body id="_0">
510
+ <DoCaptureResponse xmlns="urn:ebay:api:PayPalAPI">
511
+ <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2008-07-04T21:45:35Z</Timestamp>
512
+ <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Failure</Ack>
513
+ <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">32a3855bd35b7</CorrelationID>
514
+ <Errors xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType">
515
+ <ShortMessage xsi:type="xs:string">Transaction must be accepted in Fraud Management Filters before capture.</ShortMessage>
516
+ <LongMessage xsi:type="xs:string"/>
517
+ <ErrorCode xsi:type="xs:token">11612</ErrorCode>
518
+ <SeverityCode xmlns="urn:ebay:apis:eBLBaseComponents">Error</SeverityCode>
519
+ </Errors>
520
+ <Version xmlns="urn:ebay:apis:eBLBaseComponents">52.000000</Version>
521
+ <Build xmlns="urn:ebay:apis:eBLBaseComponents">588340</Build>
522
+ <DoCaptureResponseDetails xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:DoCaptureResponseDetailsType">
523
+ <PaymentInfo xsi:type="ebl:PaymentInfoType">
524
+ <TransactionType xsi:type="ebl:PaymentTransactionCodeType">none</TransactionType>
525
+ <PaymentType xsi:type="ebl:PaymentCodeType">none</PaymentType>
526
+ <PaymentStatus xsi:type="ebl:PaymentStatusCodeType">None</PaymentStatus>
527
+ <PendingReason xsi:type="ebl:PendingStatusCodeType">none</PendingReason>
528
+ <ReasonCode xsi:type="ebl:ReversalReasonCodeType">none</ReasonCode>
529
+ </PaymentInfo>
530
+ </DoCaptureResponseDetails>
531
+ </DoCaptureResponse>
532
+ </SOAP-ENV:Body>
533
+ </SOAP-ENV:Envelope>
534
+ RESPONSE
535
+ end
536
+
537
+ def authentication_failed_response
538
+ <<-RESPONSE
539
+ <?xml version="1.0" encoding="UTF-8"?>
540
+ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:market="urn:ebay:apis:Market" xmlns:auction="urn:ebay:apis:Auction" xmlns:sizeship="urn:ebay:api:PayPalAPI/sizeship.xsd" xmlns:ship="urn:ebay:apis:ship" xmlns:skype="urn:ebay:apis:skype" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI">
541
+ <SOAP-ENV:Header>
542
+ <Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"/>
543
+ <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
544
+ <Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
545
+ <Username xsi:type="xs:string"/>
546
+ <Password xsi:type="xs:string"/>
547
+ <Subject xsi:type="xs:string"/>
548
+ </Credentials>
549
+ </RequesterCredentials>
550
+ </SOAP-ENV:Header>
551
+ <SOAP-ENV:Body id="_0">
552
+ <DoDirectPaymentResponse xmlns="urn:ebay:api:PayPalAPI">
553
+ <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2008-08-12T19:40:59Z</Timestamp>
554
+ <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Failure</Ack>
555
+ <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">b874109bfd11</CorrelationID>
556
+ <Errors xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType">
557
+ <ShortMessage xsi:type="xs:string">Authentication/Authorization Failed</ShortMessage>
558
+ <LongMessage xsi:type="xs:string">You do not have permissions to make this API call</LongMessage>
559
+ <ErrorCode xsi:type="xs:token">10002</ErrorCode>
560
+ <SeverityCode xmlns="urn:ebay:apis:eBLBaseComponents">Error</SeverityCode>
561
+ </Errors>
562
+ <Version xmlns="urn:ebay:apis:eBLBaseComponents">52.000000</Version>
563
+ <Build xmlns="urn:ebay:apis:eBLBaseComponents">628921</Build>
564
+ </DoDirectPaymentResponse>
565
+ </SOAP-ENV:Body>
566
+ </SOAP-ENV:Envelope>
567
+ RESPONSE
568
+ end
569
+ end