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,33 @@
1
+ require 'test_helper'
2
+
3
+ class CVVResultTest < Test::Unit::TestCase
4
+ def test_nil_data
5
+ result = CVVResult.new(nil)
6
+ assert_nil result.code
7
+ assert_nil result.message
8
+ end
9
+
10
+ def test_blank_data
11
+ result = CVVResult.new('')
12
+ assert_nil result.code
13
+ assert_nil result.message
14
+ end
15
+
16
+ def test_successful_match
17
+ result = CVVResult.new('M')
18
+ assert_equal 'M', result.code
19
+ assert_equal CVVResult.messages['M'], result.message
20
+ end
21
+
22
+ def test_failed_match
23
+ result = CVVResult.new('N')
24
+ assert_equal 'N', result.code
25
+ assert_equal CVVResult.messages['N'], result.message
26
+ end
27
+
28
+ def test_to_hash
29
+ result = CVVResult.new('M').to_hash
30
+ assert_equal 'M', result['code']
31
+ assert_equal CVVResult.messages['M'], result['message']
32
+ end
33
+ end
@@ -0,0 +1,32 @@
1
+ require 'test_helper'
2
+
3
+ class ExpiryDateTest < Test::Unit::TestCase
4
+ def test_should_be_expired
5
+ last_month = 2.months.ago
6
+ date = CreditCard::ExpiryDate.new(last_month.month, last_month.year)
7
+ assert date.expired?
8
+ end
9
+
10
+ def test_today_should_not_be_expired
11
+ today = Time.now.utc
12
+ date = CreditCard::ExpiryDate.new(today.month, today.year)
13
+ assert_false date.expired?
14
+ end
15
+
16
+ def test_dates_in_the_future_should_not_be_expired
17
+ next_month = 1.month.from_now
18
+ date = CreditCard::ExpiryDate.new(next_month.month, next_month.year)
19
+ assert_false date.expired?
20
+ end
21
+
22
+ def test_invalid_date
23
+ expiry = CreditCard::ExpiryDate.new(13, 2009)
24
+ assert_equal Time.at(0).utc, expiry.expiration
25
+ end
26
+
27
+ def test_month_and_year_coerced_to_integer
28
+ expiry = CreditCard::ExpiryDate.new("13", "2009")
29
+ assert_equal 13, expiry.month
30
+ assert_equal 2009, expiry.year
31
+ end
32
+ end
@@ -0,0 +1,676 @@
1
+ require 'test_helper'
2
+
3
+ class AuthorizeNetCimTest < Test::Unit::TestCase
4
+ def setup
5
+ @gateway = AuthorizeNetCimGateway.new(
6
+ :login => 'X',
7
+ :password => 'Y'
8
+ )
9
+ @amount = 100
10
+ @credit_card = credit_card
11
+ @address = address
12
+ @customer_profile_id = '3187'
13
+ @customer_payment_profile_id = '7813'
14
+ @customer_address_id = '4321'
15
+ @payment = {
16
+ :credit_card => @credit_card
17
+ }
18
+ @profile = {
19
+ :merchant_customer_id => 'Up to 20 chars', # Optional
20
+ :description => 'Up to 255 Characters', # Optional
21
+ :email => 'Up to 255 Characters', # Optional
22
+ :payment_profiles => { # Optional
23
+ :customer_type => 'individual or business', # Optional
24
+ :bill_to => @address,
25
+ :payment => @payment
26
+ },
27
+ :ship_to_list => {
28
+ :first_name => 'John',
29
+ :last_name => 'Doe',
30
+ :company => 'Widgets, Inc',
31
+ :address1 => '1234 Fake Street',
32
+ :city => 'Anytown',
33
+ :state => 'MD',
34
+ :zip => '12345',
35
+ :country => 'USA',
36
+ :phone_number => '(123)123-1234', # Optional - Up to 25 digits (no letters)
37
+ :fax_number => '(123)123-1234' # Optional - Up to 25 digits (no letters)
38
+ }
39
+ }
40
+ @options = {
41
+ :ref_id => '1234', # Optional
42
+ :profile => @profile
43
+ }
44
+ end
45
+
46
+ def test_expdate_formatting
47
+ assert_equal '2009-09', @gateway.send(:expdate, credit_card('4111111111111111', :month => "9", :year => "2009"))
48
+ assert_equal '2013-11', @gateway.send(:expdate, credit_card('4111111111111111', :month => "11", :year => "2013"))
49
+ end
50
+
51
+ def test_should_create_customer_profile_request
52
+ @gateway.expects(:ssl_post).returns(successful_create_customer_profile_response)
53
+
54
+ assert response = @gateway.create_customer_profile(@options)
55
+ assert_instance_of Response, response
56
+ assert_success response
57
+ assert_equal @customer_profile_id, response.authorization
58
+ assert_equal "Successful.", response.message
59
+ end
60
+
61
+ def test_should_create_customer_payment_profile_request
62
+ @gateway.expects(:ssl_post).returns(successful_create_customer_payment_profile_response)
63
+
64
+ assert response = @gateway.create_customer_payment_profile(
65
+ :customer_profile_id => @customer_profile_id,
66
+ :payment_profile => {
67
+ :customer_type => 'individual',
68
+ :bill_to => @address,
69
+ :payment => @payment
70
+ },
71
+ :validation_mode => :test
72
+ )
73
+ assert_instance_of Response, response
74
+ assert_success response
75
+ assert_equal @customer_payment_profile_id, response.params['customer_payment_profile_id']
76
+ assert_equal "This output is only present if the ValidationMode input parameter is passed with a value of testMode or liveMode", response.params['validation_direct_response']
77
+ end
78
+
79
+ def test_should_create_customer_shipping_address_request
80
+ @gateway.expects(:ssl_post).returns(successful_create_customer_shipping_address_response)
81
+
82
+ assert response = @gateway.create_customer_shipping_address(
83
+ :customer_profile_id => @customer_profile_id,
84
+ :address => {
85
+ :first_name => 'John',
86
+ :last_name => 'Doe',
87
+ :company => 'Widgets, Inc',
88
+ :address1 => '1234 Fake Street',
89
+ :city => 'Anytown',
90
+ :state => 'MD',
91
+ :country => 'USA',
92
+ :phone_number => '(123)123-1234',
93
+ :fax_number => '(123)123-1234'
94
+ }
95
+ )
96
+ assert_instance_of Response, response
97
+ assert_success response
98
+ assert_nil response.authorization
99
+ assert_equal 'customerAddressId', response.params['customer_address_id']
100
+ end
101
+
102
+ def test_should_create_customer_profile_transaction_auth_only_and_then_capture_only_requests
103
+ @gateway.expects(:ssl_post).returns(successful_create_customer_profile_transaction_response(:auth_only))
104
+
105
+ assert response = @gateway.create_customer_profile_transaction(
106
+ :transaction => {
107
+ :customer_profile_id => @customer_profile_id,
108
+ :customer_payment_profile_id => @customer_payment_profile_id,
109
+ :type => :auth_only,
110
+ :amount => @amount
111
+ }
112
+ )
113
+ assert_instance_of Response, response
114
+ assert_success response
115
+ assert_nil response.authorization
116
+ assert_equal 'This transaction has been approved.', response.params['direct_response']['message']
117
+ assert_equal 'auth_only', response.params['direct_response']['transaction_type']
118
+ assert_equal 'Gw4NGI', approval_code = response.params['direct_response']['approval_code']
119
+ assert_equal '508223659', response.params['direct_response']['transaction_id']
120
+
121
+ assert_equal '1', response.params['direct_response']['response_code']
122
+ assert_equal '1', response.params['direct_response']['response_subcode']
123
+ assert_equal '1', response.params['direct_response']['response_reason_code']
124
+ assert_equal 'Y', response.params['direct_response']['avs_response']
125
+ assert_equal '', response.params['direct_response']['invoice_number']
126
+ assert_equal '', response.params['direct_response']['order_description']
127
+ assert_equal '100.00', response.params['direct_response']['amount']
128
+ assert_equal 'CC', response.params['direct_response']['method']
129
+ assert_equal 'Up to 20 chars', response.params['direct_response']['customer_id']
130
+ assert_equal '', response.params['direct_response']['first_name']
131
+ assert_equal '', response.params['direct_response']['last_name']
132
+ assert_equal '', response.params['direct_response']['company']
133
+ assert_equal '', response.params['direct_response']['address']
134
+ assert_equal '', response.params['direct_response']['city']
135
+ assert_equal '', response.params['direct_response']['state']
136
+ assert_equal '', response.params['direct_response']['zip_code']
137
+ assert_equal '', response.params['direct_response']['country']
138
+ assert_equal '', response.params['direct_response']['phone']
139
+ assert_equal '', response.params['direct_response']['fax']
140
+ assert_equal 'Up to 255 Characters', response.params['direct_response']['email_address']
141
+ assert_equal '', response.params['direct_response']['ship_to_first_name']
142
+ assert_equal '', response.params['direct_response']['ship_to_last_name']
143
+ assert_equal '', response.params['direct_response']['ship_to_company']
144
+ assert_equal '', response.params['direct_response']['ship_to_address']
145
+ assert_equal '', response.params['direct_response']['ship_to_city']
146
+ assert_equal '', response.params['direct_response']['ship_to_state']
147
+ assert_equal '', response.params['direct_response']['ship_to_zip_code']
148
+ assert_equal '', response.params['direct_response']['ship_to_country']
149
+ assert_equal '', response.params['direct_response']['tax']
150
+ assert_equal '', response.params['direct_response']['duty']
151
+ assert_equal '', response.params['direct_response']['freight']
152
+ assert_equal '', response.params['direct_response']['tax_exempt']
153
+ assert_equal '', response.params['direct_response']['purchase_order_number']
154
+ assert_equal '6E5334C13C78EA078173565FD67318E4', response.params['direct_response']['md5_hash']
155
+ assert_equal '', response.params['direct_response']['card_code']
156
+ assert_equal '2', response.params['direct_response']['cardholder_authentication_verification_response']
157
+
158
+ @gateway.expects(:ssl_post).returns(successful_create_customer_profile_transaction_response(:capture_only))
159
+
160
+ assert response = @gateway.create_customer_profile_transaction(
161
+ :transaction => {
162
+ :customer_profile_id => @customer_profile_id,
163
+ :customer_payment_profile_id => @customer_payment_profile_id,
164
+ :type => :capture_only,
165
+ :amount => @amount,
166
+ :approval_code => approval_code
167
+ }
168
+ )
169
+ assert_instance_of Response, response
170
+ assert_success response
171
+ assert_nil response.authorization
172
+ assert_equal 'This transaction has been approved.', response.params['direct_response']['message']
173
+ end
174
+
175
+ def test_should_create_customer_profile_transaction_auth_capture_request
176
+ @gateway.expects(:ssl_post).returns(successful_create_customer_profile_transaction_response(:auth_capture))
177
+
178
+ assert response = @gateway.create_customer_profile_transaction(
179
+ :transaction => {
180
+ :customer_profile_id => @customer_profile_id,
181
+ :customer_payment_profile_id => @customer_payment_profile_id,
182
+ :type => :auth_capture,
183
+ :order => {
184
+ :invoice_number => '1234',
185
+ :description => 'Test Order Description',
186
+ :purchase_order_number => '4321'
187
+ },
188
+ :amount => @amount
189
+ }
190
+ )
191
+ assert_instance_of Response, response
192
+ assert_success response
193
+ assert_nil response.authorization
194
+ assert_equal 'This transaction has been approved.', response.params['direct_response']['message']
195
+ end
196
+
197
+ def test_should_delete_customer_profile_request
198
+ @gateway.expects(:ssl_post).returns(successful_delete_customer_profile_response)
199
+
200
+ assert response = @gateway.delete_customer_profile(:customer_profile_id => @customer_profile_id)
201
+ assert_instance_of Response, response
202
+ assert_success response
203
+ assert_equal @customer_profile_id, response.authorization
204
+ end
205
+
206
+ def test_should_delete_customer_payment_profile_request
207
+ @gateway.expects(:ssl_post).returns(successful_delete_customer_payment_profile_response)
208
+
209
+ assert response = @gateway.delete_customer_payment_profile(:customer_profile_id => @customer_profile_id, :customer_payment_profile_id => @customer_payment_profile_id)
210
+ assert_instance_of Response, response
211
+ assert_success response
212
+ assert_nil response.authorization
213
+ end
214
+
215
+ def test_should_delete_customer_shipping_address_request
216
+ @gateway.expects(:ssl_post).returns(successful_delete_customer_shipping_address_response)
217
+
218
+ assert response = @gateway.delete_customer_shipping_address(:customer_profile_id => @customer_profile_id, :customer_address_id => @customer_address_id)
219
+ assert_instance_of Response, response
220
+ assert_success response
221
+ assert_nil response.authorization
222
+ end
223
+
224
+ def test_should_get_customer_profile_request
225
+ @gateway.expects(:ssl_post).returns(successful_get_customer_profile_response)
226
+
227
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
228
+ assert_instance_of Response, response
229
+ assert_success response
230
+ assert_equal @customer_profile_id, response.authorization
231
+ end
232
+
233
+ def test_should_get_customer_profile_request_with_multiple_payment_profiles
234
+ @gateway.expects(:ssl_post).returns(successful_get_customer_profile_response_with_multiple_payment_profiles)
235
+
236
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
237
+ assert_instance_of Response, response
238
+ assert_success response
239
+
240
+ assert_equal @customer_profile_id, response.authorization
241
+ assert_equal 2, response.params['profile']['payment_profiles'].size
242
+ end
243
+
244
+ def test_should_get_customer_payment_profile_request
245
+ @gateway.expects(:ssl_post).returns(successful_get_customer_payment_profile_response)
246
+
247
+ assert response = @gateway.get_customer_payment_profile(
248
+ :customer_profile_id => @customer_profile_id,
249
+ :customer_payment_profile_id => @customer_payment_profile_id
250
+ )
251
+ assert_instance_of Response, response
252
+ assert_success response
253
+ assert_nil response.authorization
254
+ assert_equal @customer_payment_profile_id, response.params['profile']['payment_profiles']['customer_payment_profile_id']
255
+ end
256
+
257
+ def test_should_get_customer_shipping_address_request
258
+ @gateway.expects(:ssl_post).returns(successful_get_customer_shipping_address_response)
259
+
260
+ assert response = @gateway.get_customer_shipping_address(
261
+ :customer_profile_id => @customer_profile_id,
262
+ :customer_address_id => @customer_address_id
263
+ )
264
+ assert_instance_of Response, response
265
+ assert_success response
266
+ assert_nil response.authorization
267
+ end
268
+
269
+ def test_should_update_customer_profile_request
270
+ @gateway.expects(:ssl_post).returns(successful_update_customer_profile_response)
271
+
272
+ assert response = @gateway.update_customer_profile(
273
+ :profile => {
274
+ :customer_profile_id => @customer_profile_id,
275
+ :email => 'new email address'
276
+ }
277
+ )
278
+ assert_instance_of Response, response
279
+ assert_success response
280
+ assert_equal @customer_profile_id, response.authorization
281
+ end
282
+
283
+ def test_should_update_customer_payment_profile_request
284
+ @gateway.expects(:ssl_post).returns(successful_update_customer_payment_profile_response)
285
+
286
+ assert response = @gateway.update_customer_payment_profile(
287
+ :customer_profile_id => @customer_profile_id,
288
+ :payment_profile => {
289
+ :customer_payment_profile_id => @customer_payment_profile_id,
290
+ :customer_type => 'business'
291
+ }
292
+ )
293
+ assert_instance_of Response, response
294
+ assert_success response
295
+ assert_nil response.authorization
296
+ end
297
+
298
+ def test_should_update_customer_shipping_address_request
299
+ @gateway.expects(:ssl_post).returns(successful_update_customer_shipping_address_response)
300
+
301
+ assert response = @gateway.update_customer_shipping_address(
302
+ :customer_profile_id => @customer_profile_id,
303
+ :address => {
304
+ :customer_address_id => @customer_address_id,
305
+ :city => 'New City'
306
+ }
307
+ )
308
+ assert_instance_of Response, response
309
+ assert_success response
310
+ assert_nil response.authorization
311
+ end
312
+
313
+ def test_should_validate_customer_payment_profile_request
314
+ @gateway.expects(:ssl_post).returns(successful_validate_customer_payment_profile_response)
315
+
316
+ assert response = @gateway.validate_customer_payment_profile(
317
+ :customer_profile_id => @customer_profile_id,
318
+ :customer_payment_profile_id => @customer_payment_profile_id,
319
+ :customer_address_id => @customer_address_id,
320
+ :validation_mode => :live
321
+ )
322
+ assert_instance_of Response, response
323
+ assert_success response
324
+ assert_nil response.authorization
325
+ assert_equal 'This transaction has been approved.', response.params['direct_response']['message']
326
+ end
327
+
328
+ private
329
+
330
+ def successful_create_customer_profile_response
331
+ <<-XML
332
+ <?xml version="1.0" encoding="utf-8" ?>
333
+ <createCustomerProfileResponse
334
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
335
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
336
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
337
+ <refId>refid1</refId>
338
+ <messages>
339
+ <resultCode>Ok</resultCode>
340
+ <message>
341
+ <code>I00001</code>
342
+ <text>Successful.</text>
343
+ </message>
344
+ </messages>
345
+ <customerProfileId>#{@customer_profile_id}</customerProfileId>
346
+ </createCustomerProfileResponse>
347
+ XML
348
+ end
349
+
350
+ def successful_create_customer_payment_profile_response
351
+ <<-XML
352
+ <?xml version="1.0" encoding="utf-8" ?>
353
+ <createCustomerPaymentProfileResponse
354
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
355
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
356
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
357
+ <refId>refid1</refId>
358
+ <messages>
359
+ <resultCode>Ok</resultCode>
360
+ <message>
361
+ <code>I00001</code>
362
+ <text>Successful.</text>
363
+ </message>
364
+ </messages>
365
+ <customerPaymentProfileId>#{@customer_payment_profile_id}</customerPaymentProfileId>
366
+ <validationDirectResponse>This output is only present if the ValidationMode input parameter is passed with a value of testMode or liveMode</validationDirectResponse>
367
+ </createCustomerPaymentProfileResponse>
368
+ XML
369
+ end
370
+
371
+ def successful_create_customer_shipping_address_response
372
+ <<-XML
373
+ <?xml version="1.0" encoding="utf-8" ?>
374
+ <createCustomerShippingAddressResponse
375
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
376
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
377
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
378
+ <refId>refid1</refId>
379
+ <messages>
380
+ <resultCode>Ok</resultCode>
381
+ <message>
382
+ <code>I00001</code>
383
+ <text>Successful.</text>
384
+ </message>
385
+ </messages>
386
+ <customerAddressId>customerAddressId</customerAddressId>
387
+ </createCustomerShippingAddressResponse>
388
+ XML
389
+ end
390
+
391
+ def successful_delete_customer_profile_response
392
+ <<-XML
393
+ <?xml version="1.0" encoding="utf-8" ?>
394
+ <deleteCustomerProfileResponse
395
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
396
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
397
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
398
+ <refId>refid1</refId>
399
+ <messages>
400
+ <resultCode>Ok</resultCode>
401
+ <message>
402
+ <code>I00001</code>
403
+ <text>Successful.</text>
404
+ </message>
405
+ </messages>
406
+ <customerProfileId>#{@customer_profile_id}</customerProfileId>
407
+ </deleteCustomerProfileResponse>
408
+ XML
409
+ end
410
+
411
+ def successful_delete_customer_payment_profile_response
412
+ <<-XML
413
+ <?xml version="1.0" encoding="utf-8" ?>
414
+ <deleteCustomerPaymentProfileResponse
415
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
416
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
417
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
418
+ <refId>refid1</refId>
419
+ <messages>
420
+ <resultCode>Ok</resultCode>
421
+ <message>
422
+ <code>I00001</code>
423
+ <text>Successful.</text>
424
+ </message>
425
+ </messages>
426
+ </deleteCustomerPaymentProfileResponse>
427
+ XML
428
+ end
429
+
430
+ def successful_delete_customer_shipping_address_response
431
+ <<-XML
432
+ <?xml version="1.0" encoding="utf-8" ?>
433
+ <deleteCustomerShippingAddressResponse
434
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
435
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
436
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
437
+ <refId>refid1</refId>
438
+ <messages>
439
+ <resultCode>Ok</resultCode>
440
+ <message>
441
+ <code>I00001</code>
442
+ <text>Successful.</text>
443
+ </message>
444
+ </messages>
445
+ </deleteCustomerShippingAddressResponse>
446
+ XML
447
+ end
448
+
449
+ def successful_get_customer_profile_response
450
+ <<-XML
451
+ <?xml version="1.0" encoding="utf-8" ?>
452
+ <getCustomerProfileResponse
453
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
454
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
455
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
456
+ <refId>refid1</refId>
457
+ <messages>
458
+ <resultCode>Ok</resultCode>
459
+ <message>
460
+ <code>I00001</code>
461
+ <text>Successful.</text>
462
+ </message>
463
+ </messages>
464
+ <customerProfileId>#{@customer_profile_id}</customerProfileId>
465
+ <profile>
466
+ <paymentProfiles>
467
+ <customerPaymentProfileId>123456</customerPaymentProfileId>
468
+ <payment>
469
+ <creditCard>
470
+ <cardNumber>#{@credit_card.number}</cardNumber>
471
+ <expirationDate>#{@gateway.send(:expdate, @credit_card)}</expirationDate>
472
+ </creditCard>
473
+ </payment>
474
+ </paymentProfiles>
475
+ </profile>
476
+ </getCustomerProfileResponse>
477
+ XML
478
+ end
479
+
480
+ def successful_get_customer_profile_response_with_multiple_payment_profiles
481
+ <<-XML
482
+ <?xml version="1.0" encoding="utf-8"?>
483
+ <getCustomerProfileResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
484
+ <messages>
485
+ <resultCode>Ok</resultCode>
486
+ <message>
487
+ <code>I00001</code>
488
+ <text>Successful.</text>
489
+ </message>
490
+ </messages>
491
+ <profile>
492
+ <merchantCustomerId>Up to 20 chars</merchantCustomerId>
493
+ <description>Up to 255 Characters</description>
494
+ <email>Up to 255 Characters</email>
495
+ <customerProfileId>#{@customer_profile_id}</customerProfileId>
496
+ <paymentProfiles>
497
+ <customerPaymentProfileId>1000</customerPaymentProfileId>
498
+ <payment>
499
+ <creditCard>
500
+ <cardNumber>#{@credit_card.number}</cardNumber>
501
+ <expirationDate>#{@gateway.send(:expdate, @credit_card)}</expirationDate>
502
+ </creditCard>
503
+ </payment>
504
+ </paymentProfiles>
505
+ <paymentProfiles>
506
+ <customerType>individual</customerType>
507
+ <customerPaymentProfileId>1001</customerPaymentProfileId>
508
+ <payment>
509
+ <creditCard>
510
+ <cardNumber>XXXX1234</cardNumber>
511
+ <expirationDate>XXXX</expirationDate>
512
+ </creditCard>
513
+ </payment>
514
+ </paymentProfiles>
515
+ </profile>
516
+ </getCustomerProfileResponse>
517
+ XML
518
+ end
519
+
520
+ def successful_get_customer_payment_profile_response
521
+ <<-XML
522
+ <?xml version="1.0" encoding="utf-8" ?>
523
+ <getCustomerPaymentProfileResponse
524
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
525
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
526
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
527
+ <refId>refid1</refId>
528
+ <messages>
529
+ <resultCode>Ok</resultCode>
530
+ <message>
531
+ <code>I00001</code>
532
+ <text>Successful.</text>
533
+ </message>
534
+ </messages>
535
+ <profile>
536
+ <paymentProfiles>
537
+ <customerPaymentProfileId>#{@customer_payment_profile_id}</customerPaymentProfileId>
538
+ <payment>
539
+ <creditCard>
540
+ <cardNumber>#{@credit_card.number}</cardNumber>
541
+ <expirationDate>#{@gateway.send(:expdate, @credit_card)}</expirationDate>
542
+ </creditCard>
543
+ </payment>
544
+ </paymentProfiles>
545
+ </profile>
546
+ </getCustomerPaymentProfileResponse>
547
+ XML
548
+ end
549
+
550
+ def successful_get_customer_shipping_address_response
551
+ <<-XML
552
+ <?xml version="1.0" encoding="utf-8" ?>
553
+ <getCustomerShippingAddressResponse
554
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
555
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
556
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
557
+ <refId>refid1</refId>
558
+ <messages>
559
+ <resultCode>Ok</resultCode>
560
+ <message>
561
+ <code>I00001</code>
562
+ <text>Successful.</text>
563
+ </message>
564
+ </messages>
565
+ <address>
566
+ <customerAddressId>#{@customer_address_id}</customerAddressId>
567
+ </address>
568
+ </getCustomerShippingAddressResponse>
569
+ XML
570
+ end
571
+
572
+ def successful_update_customer_profile_response
573
+ <<-XML
574
+ <?xml version="1.0" encoding="utf-8" ?>
575
+ <updateCustomerProfileResponse
576
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
577
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
578
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
579
+ <refId>refid1</refId>
580
+ <messages>
581
+ <resultCode>Ok</resultCode>
582
+ <message>
583
+ <code>I00001</code>
584
+ <text>Successful.</text>
585
+ </message>
586
+ </messages>
587
+ <customerProfileId>#{@customer_profile_id}</customerProfileId>
588
+ </updateCustomerProfileResponse>
589
+ XML
590
+ end
591
+
592
+ def successful_update_customer_payment_profile_response
593
+ <<-XML
594
+ <?xml version="1.0" encoding="utf-8" ?>
595
+ <updateCustomerPaymentProfileResponse
596
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
597
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
598
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
599
+ <refId>refid1</refId>
600
+ <messages>
601
+ <resultCode>Ok</resultCode>
602
+ <message>
603
+ <code>I00001</code>
604
+ <text>Successful.</text>
605
+ </message>
606
+ </messages>
607
+ </updateCustomerPaymentProfileResponse>
608
+ XML
609
+ end
610
+
611
+ def successful_update_customer_shipping_address_response
612
+ <<-XML
613
+ <?xml version="1.0" encoding="utf-8" ?>
614
+ <updateCustomerShippingAddressResponse
615
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
616
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
617
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
618
+ <refId>refid1</refId>
619
+ <messages>
620
+ <resultCode>Ok</resultCode>
621
+ <message>
622
+ <code>I00001</code>
623
+ <text>Successful.</text>
624
+ </message>
625
+ </messages>
626
+ </updateCustomerShippingAddressResponse>
627
+ XML
628
+ end
629
+
630
+ SUCCESSFUL_DIRECT_RESPONSE = {
631
+ :auth_only => '1,1,1,This transaction has been approved.,Gw4NGI,Y,508223659,,,100.00,CC,auth_only,Up to 20 chars,,,,,,,,,,,Up to 255 Characters,,,,,,,,,,,,,,6E5334C13C78EA078173565FD67318E4,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
632
+ :capture_only => '1,1,1,This transaction has been approved.,,Y,508223660,,,100.00,CC,capture_only,Up to 20 chars,,,,,,,,,,,Up to 255 Characters,,,,,,,,,,,,,,6E5334C13C78EA078173565FD67318E4,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
633
+ :auth_capture => '1,1,1,This transaction has been approved.,d1GENk,Y,508223661,32968c18334f16525227,Store purchase,1.00,CC,auth_capture,,Longbob,Longsen,,,,,,,,,,,,,,,,,,,,,,,269862C030129C1173727CC10B1935ED,P,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,'
634
+ }
635
+
636
+ def successful_create_customer_profile_transaction_response(transaction_type)
637
+ <<-XML
638
+ <?xml version="1.0" encoding="utf-8" ?>
639
+ <createCustomerProfileTransactionResponse
640
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
641
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
642
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
643
+ <refId>refid1</refId>
644
+ <messages>
645
+ <resultCode>Ok</resultCode>
646
+ <message>
647
+ <code>I00001</code>
648
+ <text>Successful.</text>
649
+ </message>
650
+ </messages>
651
+ <directResponse>#{SUCCESSFUL_DIRECT_RESPONSE[transaction_type]}</directResponse>
652
+ </createCustomerProfileTransactionResponse>
653
+ XML
654
+ end
655
+
656
+ def successful_validate_customer_payment_profile_response
657
+ <<-XML
658
+ <?xml version="1.0" encoding="utf-8" ?>
659
+ <validateCustomerPaymentProfileResponse
660
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
661
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
662
+ xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
663
+ <refId>refid1</refId>
664
+ <messages>
665
+ <resultCode>Ok</resultCode>
666
+ <message>
667
+ <code>I00001</code>
668
+ <text>Successful.</text>
669
+ </message>
670
+ </messages>
671
+ <directResponse>1,1,1,This transaction has been approved.,DEsVh8,Y,508276300,none,Test transaction for ValidateCustomerPaymentProfile.,0.01,CC,auth_only,Up to 20 chars,,,,,,,,,,,Up to 255 Characters,John,Doe,Widgets, Inc,1234 Fake Street,Anytown,MD,12345,USA,0.0000,0.0000,0.0000,TRUE,none,7EB3A44624C0C10FAAE47E276B48BF17,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,</directResponse>
672
+ </validateCustomerPaymentProfileResponse>
673
+ XML
674
+ end
675
+
676
+ end