ghazel-activemerchant 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. data/CHANGELOG +473 -0
  2. data/CONTRIBUTORS +126 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README +135 -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 +60 -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 +3 -0
  19. data/lib/active_merchant/billing/gateways/authorize_net.rb +657 -0
  20. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +736 -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 +98 -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 +106 -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 +214 -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/paypal_express_recurring.rb +310 -0
  62. data/lib/active_merchant/billing/gateways/plugnpay.rb +292 -0
  63. data/lib/active_merchant/billing/gateways/psigate.rb +214 -0
  64. data/lib/active_merchant/billing/gateways/psl_card.rb +306 -0
  65. data/lib/active_merchant/billing/gateways/quickpay.rb +213 -0
  66. data/lib/active_merchant/billing/gateways/realex.rb +200 -0
  67. data/lib/active_merchant/billing/gateways/sage.rb +146 -0
  68. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +88 -0
  69. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +116 -0
  70. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +97 -0
  71. data/lib/active_merchant/billing/gateways/sage_pay.rb +308 -0
  72. data/lib/active_merchant/billing/gateways/sallie_mae.rb +144 -0
  73. data/lib/active_merchant/billing/gateways/secure_pay.rb +31 -0
  74. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +157 -0
  75. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +113 -0
  76. data/lib/active_merchant/billing/gateways/skip_jack.rb +452 -0
  77. data/lib/active_merchant/billing/gateways/smart_ps.rb +254 -0
  78. data/lib/active_merchant/billing/gateways/trans_first.rb +127 -0
  79. data/lib/active_merchant/billing/gateways/transax.rb +26 -0
  80. data/lib/active_merchant/billing/gateways/trust_commerce.rb +418 -0
  81. data/lib/active_merchant/billing/gateways/usa_epay.rb +194 -0
  82. data/lib/active_merchant/billing/gateways/verifi.rb +228 -0
  83. data/lib/active_merchant/billing/gateways/viaklix.rb +189 -0
  84. data/lib/active_merchant/billing/gateways/wirecard.rb +318 -0
  85. data/lib/active_merchant/billing/integrations.rb +22 -0
  86. data/lib/active_merchant/billing/integrations/action_view_helper.rb +79 -0
  87. data/lib/active_merchant/billing/integrations/bogus.rb +22 -0
  88. data/lib/active_merchant/billing/integrations/bogus/helper.rb +17 -0
  89. data/lib/active_merchant/billing/integrations/bogus/notification.rb +11 -0
  90. data/lib/active_merchant/billing/integrations/bogus/return.rb +10 -0
  91. data/lib/active_merchant/billing/integrations/chronopay.rb +22 -0
  92. data/lib/active_merchant/billing/integrations/chronopay/helper.rb +81 -0
  93. data/lib/active_merchant/billing/integrations/chronopay/notification.rb +156 -0
  94. data/lib/active_merchant/billing/integrations/chronopay/return.rb +10 -0
  95. data/lib/active_merchant/billing/integrations/gestpay.rb +26 -0
  96. data/lib/active_merchant/billing/integrations/gestpay/common.rb +42 -0
  97. data/lib/active_merchant/billing/integrations/gestpay/helper.rb +70 -0
  98. data/lib/active_merchant/billing/integrations/gestpay/notification.rb +83 -0
  99. data/lib/active_merchant/billing/integrations/gestpay/return.rb +10 -0
  100. data/lib/active_merchant/billing/integrations/helper.rb +93 -0
  101. data/lib/active_merchant/billing/integrations/hi_trust.rb +26 -0
  102. data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +58 -0
  103. data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +59 -0
  104. data/lib/active_merchant/billing/integrations/hi_trust/return.rb +67 -0
  105. data/lib/active_merchant/billing/integrations/nochex.rb +87 -0
  106. data/lib/active_merchant/billing/integrations/nochex/helper.rb +68 -0
  107. data/lib/active_merchant/billing/integrations/nochex/notification.rb +94 -0
  108. data/lib/active_merchant/billing/integrations/nochex/return.rb +10 -0
  109. data/lib/active_merchant/billing/integrations/notification.rb +62 -0
  110. data/lib/active_merchant/billing/integrations/paypal.rb +40 -0
  111. data/lib/active_merchant/billing/integrations/paypal/helper.rb +119 -0
  112. data/lib/active_merchant/billing/integrations/paypal/notification.rb +154 -0
  113. data/lib/active_merchant/billing/integrations/paypal/return.rb +10 -0
  114. data/lib/active_merchant/billing/integrations/quickpay.rb +18 -0
  115. data/lib/active_merchant/billing/integrations/quickpay/helper.rb +72 -0
  116. data/lib/active_merchant/billing/integrations/quickpay/notification.rb +74 -0
  117. data/lib/active_merchant/billing/integrations/return.rb +35 -0
  118. data/lib/active_merchant/billing/integrations/two_checkout.rb +23 -0
  119. data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +59 -0
  120. data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +114 -0
  121. data/lib/active_merchant/billing/integrations/two_checkout/return.rb +17 -0
  122. data/lib/active_merchant/billing/response.rb +32 -0
  123. data/lib/active_merchant/lib/connection.rb +170 -0
  124. data/lib/active_merchant/lib/country.rb +319 -0
  125. data/lib/active_merchant/lib/error.rb +4 -0
  126. data/lib/active_merchant/lib/post_data.rb +22 -0
  127. data/lib/active_merchant/lib/posts_data.rb +47 -0
  128. data/lib/active_merchant/lib/requires_parameters.rb +16 -0
  129. data/lib/active_merchant/lib/utils.rb +18 -0
  130. data/lib/active_merchant/lib/validateable.rb +76 -0
  131. data/lib/certs/cacert.pem +7815 -0
  132. data/lib/support/gateway_support.rb +58 -0
  133. data/script/destroy +14 -0
  134. data/script/generate +14 -0
  135. data/test/fixtures.yml +355 -0
  136. data/test/remote/gateways/remote_authorize_net_cim_test.rb +460 -0
  137. data/test/remote/gateways/remote_authorize_net_test.rb +145 -0
  138. data/test/remote/gateways/remote_beanstream_interac_test.rb +53 -0
  139. data/test/remote/gateways/remote_beanstream_test.rb +150 -0
  140. data/test/remote/gateways/remote_braintree_test.rb +154 -0
  141. data/test/remote/gateways/remote_card_stream_test.rb +148 -0
  142. data/test/remote/gateways/remote_cyber_source_test.rb +144 -0
  143. data/test/remote/gateways/remote_data_cash_test.rb +357 -0
  144. data/test/remote/gateways/remote_efsnet_test.rb +81 -0
  145. data/test/remote/gateways/remote_elavon_test.rb +66 -0
  146. data/test/remote/gateways/remote_eway_test.rb +74 -0
  147. data/test/remote/gateways/remote_exact_test.rb +60 -0
  148. data/test/remote/gateways/remote_first_pay_test.rb +87 -0
  149. data/test/remote/gateways/remote_instapay_test.rb +61 -0
  150. data/test/remote/gateways/remote_jetpay_test.rb +103 -0
  151. data/test/remote/gateways/remote_linkpoint_test.rb +121 -0
  152. data/test/remote/gateways/remote_merchant_e_solutions_test.rb +173 -0
  153. data/test/remote/gateways/remote_merchant_ware_test.rb +113 -0
  154. data/test/remote/gateways/remote_modern_payments_cim_test.rb +58 -0
  155. data/test/remote/gateways/remote_modern_payments_test.rb +43 -0
  156. data/test/remote/gateways/remote_moneris_test.rb +82 -0
  157. data/test/remote/gateways/remote_net_registry_test.rb +85 -0
  158. data/test/remote/gateways/remote_netbilling_test.rb +70 -0
  159. data/test/remote/gateways/remote_ogone_test.rb +115 -0
  160. data/test/remote/gateways/remote_pay_junction_test.rb +143 -0
  161. data/test/remote/gateways/remote_pay_secure_test.rb +39 -0
  162. data/test/remote/gateways/remote_payflow_express_test.rb +50 -0
  163. data/test/remote/gateways/remote_payflow_test.rb +237 -0
  164. data/test/remote/gateways/remote_payflow_uk_test.rb +173 -0
  165. data/test/remote/gateways/remote_payment_express_test.rb +136 -0
  166. data/test/remote/gateways/remote_paypal_express_test.rb +49 -0
  167. data/test/remote/gateways/remote_paypal_test.rb +191 -0
  168. data/test/remote/gateways/remote_plugnpay_test.rb +72 -0
  169. data/test/remote/gateways/remote_psigate_test.rb +50 -0
  170. data/test/remote/gateways/remote_psl_card_test.rb +125 -0
  171. data/test/remote/gateways/remote_quickpay_test.rb +190 -0
  172. data/test/remote/gateways/remote_realex_test.rb +224 -0
  173. data/test/remote/gateways/remote_sage_bankcard_test.rb +109 -0
  174. data/test/remote/gateways/remote_sage_pay_test.rb +219 -0
  175. data/test/remote/gateways/remote_sage_test.rb +87 -0
  176. data/test/remote/gateways/remote_sage_virtual_check_test.rb +62 -0
  177. data/test/remote/gateways/remote_sallie_mae_test.rb +51 -0
  178. data/test/remote/gateways/remote_secure_pay_au_test.rb +40 -0
  179. data/test/remote/gateways/remote_secure_pay_tech_test.rb +37 -0
  180. data/test/remote/gateways/remote_secure_pay_test.rb +28 -0
  181. data/test/remote/gateways/remote_skipjack_test.rb +105 -0
  182. data/test/remote/gateways/remote_trans_first_test.rb +34 -0
  183. data/test/remote/gateways/remote_transax_test.rb +112 -0
  184. data/test/remote/gateways/remote_trust_commerce_test.rb +152 -0
  185. data/test/remote/gateways/remote_usa_epay_test.rb +46 -0
  186. data/test/remote/gateways/remote_verifi_test.rb +107 -0
  187. data/test/remote/gateways/remote_viaklix_test.rb +43 -0
  188. data/test/remote/gateways/remote_wirecard_test.rb +111 -0
  189. data/test/remote/integrations/remote_gestpay_integration_test.rb +37 -0
  190. data/test/remote/integrations/remote_paypal_integration_test.rb +26 -0
  191. data/test/test_helper.rb +182 -0
  192. data/test/unit/avs_result_test.rb +59 -0
  193. data/test/unit/base_test.rb +55 -0
  194. data/test/unit/check_test.rb +88 -0
  195. data/test/unit/connection_test.rb +129 -0
  196. data/test/unit/country_code_test.rb +33 -0
  197. data/test/unit/country_test.rb +64 -0
  198. data/test/unit/credit_card_formatting_test.rb +19 -0
  199. data/test/unit/credit_card_methods_test.rb +179 -0
  200. data/test/unit/credit_card_test.rb +318 -0
  201. data/test/unit/cvv_result_test.rb +33 -0
  202. data/test/unit/expiry_date_test.rb +32 -0
  203. data/test/unit/gateways/authorize_net_cim_test.rb +676 -0
  204. data/test/unit/gateways/authorize_net_test.rb +290 -0
  205. data/test/unit/gateways/beanstream_interac_test.rb +51 -0
  206. data/test/unit/gateways/beanstream_test.rb +108 -0
  207. data/test/unit/gateways/bogus_test.rb +46 -0
  208. data/test/unit/gateways/braintree_test.rb +126 -0
  209. data/test/unit/gateways/card_stream_test.rb +90 -0
  210. data/test/unit/gateways/cyber_source_test.rb +188 -0
  211. data/test/unit/gateways/data_cash_test.rb +133 -0
  212. data/test/unit/gateways/efsnet_test.rb +123 -0
  213. data/test/unit/gateways/elavon_test.rb +139 -0
  214. data/test/unit/gateways/eway_test.rb +118 -0
  215. data/test/unit/gateways/exact_test.rb +156 -0
  216. data/test/unit/gateways/first_pay_test.rb +125 -0
  217. data/test/unit/gateways/gateway_test.rb +48 -0
  218. data/test/unit/gateways/instapay_test.rb +102 -0
  219. data/test/unit/gateways/jetpay_test.rb +185 -0
  220. data/test/unit/gateways/linkpoint_test.rb +184 -0
  221. data/test/unit/gateways/merchant_e_solutions_test.rb +169 -0
  222. data/test/unit/gateways/merchant_ware_test.rb +188 -0
  223. data/test/unit/gateways/modern_payments_cim_test.rb +171 -0
  224. data/test/unit/gateways/moneris_test.rb +158 -0
  225. data/test/unit/gateways/net_registry_test.rb +416 -0
  226. data/test/unit/gateways/netbilling_test.rb +54 -0
  227. data/test/unit/gateways/ogone_test.rb +319 -0
  228. data/test/unit/gateways/pay_junction_test.rb +123 -0
  229. data/test/unit/gateways/pay_secure_test.rb +71 -0
  230. data/test/unit/gateways/payflow_express_test.rb +173 -0
  231. data/test/unit/gateways/payflow_express_uk_test.rb +86 -0
  232. data/test/unit/gateways/payflow_test.rb +305 -0
  233. data/test/unit/gateways/payflow_uk_test.rb +30 -0
  234. data/test/unit/gateways/payment_express_test.rb +195 -0
  235. data/test/unit/gateways/paypal_express_test.rb +382 -0
  236. data/test/unit/gateways/paypal_test.rb +569 -0
  237. data/test/unit/gateways/plugnpay_test.rb +86 -0
  238. data/test/unit/gateways/psigate_test.rb +169 -0
  239. data/test/unit/gateways/psl_card_test.rb +64 -0
  240. data/test/unit/gateways/quickpay_test.rb +112 -0
  241. data/test/unit/gateways/realex_test.rb +151 -0
  242. data/test/unit/gateways/sage_bankcard_test.rb +196 -0
  243. data/test/unit/gateways/sage_pay_test.rb +139 -0
  244. data/test/unit/gateways/sage_virtual_check_test.rb +71 -0
  245. data/test/unit/gateways/sallie_mae_test.rb +53 -0
  246. data/test/unit/gateways/secure_pay_au_test.rb +207 -0
  247. data/test/unit/gateways/secure_pay_tech_test.rb +44 -0
  248. data/test/unit/gateways/secure_pay_test.rb +87 -0
  249. data/test/unit/gateways/skip_jack_test.rb +213 -0
  250. data/test/unit/gateways/trans_first_test.rb +112 -0
  251. data/test/unit/gateways/trust_commerce_test.rb +90 -0
  252. data/test/unit/gateways/usa_epay_test.rb +128 -0
  253. data/test/unit/gateways/verifi_test.rb +96 -0
  254. data/test/unit/gateways/viaklix_test.rb +78 -0
  255. data/test/unit/gateways/wirecard_test.rb +250 -0
  256. data/test/unit/generators/test_gateway_generator.rb +46 -0
  257. data/test/unit/generators/test_generator_helper.rb +20 -0
  258. data/test/unit/generators/test_integration_generator.rb +53 -0
  259. data/test/unit/integrations/action_view_helper_test.rb +50 -0
  260. data/test/unit/integrations/bogus_module_test.rb +20 -0
  261. data/test/unit/integrations/chronopay_module_test.rb +13 -0
  262. data/test/unit/integrations/gestpay_module_test.rb +14 -0
  263. data/test/unit/integrations/helpers/bogus_helper_test.rb +28 -0
  264. data/test/unit/integrations/helpers/chronopay_helper_test.rb +67 -0
  265. data/test/unit/integrations/helpers/gestpay_helper_test.rb +100 -0
  266. data/test/unit/integrations/helpers/hi_trust_helper_test.rb +16 -0
  267. data/test/unit/integrations/helpers/nochex_helper_test.rb +53 -0
  268. data/test/unit/integrations/helpers/paypal_helper_test.rb +171 -0
  269. data/test/unit/integrations/helpers/quickpay_helper_test.rb +40 -0
  270. data/test/unit/integrations/helpers/two_checkout_helper_test.rb +92 -0
  271. data/test/unit/integrations/hi_trust_module_test.rb +13 -0
  272. data/test/unit/integrations/nochex_module_test.rb +13 -0
  273. data/test/unit/integrations/notifications/chronopay_notification_test.rb +66 -0
  274. data/test/unit/integrations/notifications/gestpay_notification_test.rb +60 -0
  275. data/test/unit/integrations/notifications/hi_trust_notification_test.rb +59 -0
  276. data/test/unit/integrations/notifications/nochex_notification_test.rb +51 -0
  277. data/test/unit/integrations/notifications/notification_test.rb +54 -0
  278. data/test/unit/integrations/notifications/paypal_notification_test.rb +85 -0
  279. data/test/unit/integrations/notifications/quickpay_notification_test.rb +69 -0
  280. data/test/unit/integrations/notifications/two_checkout_notification_test.rb +55 -0
  281. data/test/unit/integrations/paypal_module_test.rb +28 -0
  282. data/test/unit/integrations/quickpay_module_test.rb +9 -0
  283. data/test/unit/integrations/returns/chronopay_return_test.rb +11 -0
  284. data/test/unit/integrations/returns/gestpay_return_test.rb +10 -0
  285. data/test/unit/integrations/returns/hi_trust_return_test.rb +24 -0
  286. data/test/unit/integrations/returns/nochex_return_test.rb +10 -0
  287. data/test/unit/integrations/returns/paypal_return_test.rb +10 -0
  288. data/test/unit/integrations/returns/return_test.rb +11 -0
  289. data/test/unit/integrations/returns/two_checkout_return_test.rb +24 -0
  290. data/test/unit/integrations/two_checkout_module_test.rb +13 -0
  291. data/test/unit/post_data_test.rb +55 -0
  292. data/test/unit/posts_data_test.rb +48 -0
  293. data/test/unit/response_test.rb +28 -0
  294. data/test/unit/utils_test.rb +7 -0
  295. data/test/unit/validateable_test.rb +60 -0
  296. metadata +368 -0
@@ -0,0 +1,58 @@
1
+ require 'rubygems'
2
+ require 'active_support'
3
+ require 'lib/active_merchant'
4
+
5
+
6
+ class GatewaySupport #:nodoc:
7
+ ACTIONS = [:purchase, :authorize, :capture, :void, :credit, :recurring]
8
+
9
+ include ActiveMerchant::Billing
10
+
11
+ attr_reader :gateways
12
+
13
+ def initialize
14
+ @gateways = Gateway.implementations.sort_by(&:name)
15
+ @gateways.delete(ActiveMerchant::Billing::BogusGateway)
16
+ end
17
+
18
+ def each_gateway
19
+ @gateways.each{|g| yield g }
20
+ end
21
+
22
+ def features
23
+ width = 15
24
+
25
+ print "Name".center(width + 20)
26
+ ACTIONS.each{|f| print "#{f.to_s.capitalize.center(width)}" }
27
+ puts
28
+
29
+ each_gateway do |g|
30
+ print "#{g.display_name.ljust(width + 20)}"
31
+ ACTIONS.each do |f|
32
+ print "#{(g.instance_methods.include?(f.to_s) ? "Y" : "N").center(width)}"
33
+ end
34
+ puts
35
+ end
36
+ end
37
+
38
+ def to_rdoc
39
+ each_gateway do |g|
40
+ puts "* {#{g.display_name}}[#{g.homepage_url}] - #{g.supported_countries.join(', ')}"
41
+ end
42
+ end
43
+
44
+ def to_textile
45
+ each_gateway do |g|
46
+ puts %/ * "#{g.display_name}":#{g.homepage_url} [#{g.supported_countries.join(', ')}]/
47
+ end
48
+ end
49
+
50
+ def to_s
51
+ each_gateway do |g|
52
+ puts "#{g.display_name} - #{g.homepage_url} [#{g.supported_countries.join(', ')}]"
53
+ end
54
+ end
55
+ end
56
+
57
+
58
+
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.join(File.dirname(__FILE__), '..')
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:activemerchant, :rubygems, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.join(File.dirname(__FILE__), '..')
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:activemerchant, :rubygems, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,355 @@
1
+ # This file has all of the ActiveMerchant test account credentials.
2
+ # Many gateways do not offer publicly available test accounts. In
3
+ # order to make testing the gateways easy you can copy this file to
4
+ # your home directory as the file ~/.active_merchant/fixtures.yml
5
+ # You can then place your own test account credentials in your local
6
+ # copy of the file.
7
+ #
8
+ # If the login is numeric, ensure that you place quotes around it.
9
+ # Leading zeros will be lost when YAML parses the file if you don't.
10
+ #
11
+ # Paste any required PEM certificates after the pem key.
12
+ #
13
+ authorize_net:
14
+ login: X
15
+ password: Y
16
+
17
+ beanstream:
18
+ login: merchant id
19
+ user: username
20
+ password: password
21
+
22
+ beanstream_interac:
23
+ login: merchant id
24
+ user: username
25
+ password: password
26
+
27
+ braintree:
28
+ login: demo
29
+ password: password
30
+
31
+ card_stream:
32
+ login: X
33
+ password: Y
34
+
35
+ cyber_source:
36
+ login: X
37
+ password: Y
38
+
39
+ data_cash:
40
+ login: X
41
+ password: Y
42
+
43
+ efsnet:
44
+ login: X
45
+ password: Y
46
+
47
+ elavon:
48
+ login: LOGIN
49
+ password: PASSWORD
50
+
51
+ # Working credentials, no need to replace
52
+ eway:
53
+ login: '87654321'
54
+
55
+ # Working credentials, no need to replace
56
+ exact:
57
+ login: "A00427-01"
58
+ password: testus
59
+
60
+ first_pay:
61
+ login:
62
+ password:
63
+
64
+ ideal_ing_postbank:
65
+ login: LOGIN
66
+ password: PASSWORD
67
+ pem: |--
68
+ PASTE YOUR PEM FILE HERE
69
+
70
+ instapay:
71
+ login: TEST0
72
+ password:
73
+
74
+ jetpay:
75
+ login: TESTTERMINAL
76
+
77
+ linkpoint:
78
+ login: STOREID
79
+ pem: |--
80
+ PASTE YOUR PEM FILE HERE
81
+
82
+ merchant_ware:
83
+ login:
84
+ password:
85
+ name:
86
+
87
+ modern_payments:
88
+ login: login
89
+ password: password
90
+
91
+ # Working credentials, no need to replace
92
+ moneris:
93
+ login: store1
94
+ password: yesguy
95
+
96
+ # Working credentials, no need to replace
97
+ # Contact Netbilling for login info to the admin area
98
+ netbilling:
99
+ login: '104901072025'
100
+
101
+ net_registry:
102
+ login: X
103
+ password: Y
104
+
105
+ ogone:
106
+ login: LOGIN
107
+ user: USER
108
+ password: PASSWORD
109
+ signature: SIGNATURE
110
+
111
+ payflow:
112
+ login: LOGIN
113
+ password: PASSWORD
114
+ partner: PayPal
115
+
116
+ payflow_uk:
117
+ login: LOGIN
118
+ password: PASSWORD
119
+ partner: PayPalUk
120
+
121
+ # Working credentials, no need to replace
122
+ pay_junction:
123
+ login: 'pj-ql-01'
124
+ password: 'pj-ql-01p'
125
+
126
+ payment_express:
127
+ login: LOGIN
128
+ password: PASSWORD
129
+
130
+ # You can use either your API PEM file or API signature with PayPal.
131
+ paypal_certificate:
132
+ login: LOGIN
133
+ password: PASSWORD
134
+ subject:
135
+ pem: |--
136
+ PASTE YOUR PEM FILE HERE
137
+
138
+ paypal_signature:
139
+ login: LOGIN
140
+ password: PASSWORD
141
+ signature: SIGNATURE
142
+
143
+ pay_secure:
144
+ login: LOGIN
145
+ password: PASSWORD
146
+
147
+ plugnpay:
148
+ login: LOGIN
149
+ password: PASSWORD
150
+
151
+ sage_pay:
152
+ login: LOGIN
153
+
154
+ # Working credentials, no need to replace
155
+ psigate:
156
+ login: teststore
157
+ password: psigate1234
158
+
159
+ psl_card:
160
+ login: LOGIN
161
+
162
+ # PSL doesn't want the test data made public
163
+ psl_maestro:
164
+ number:
165
+ month:
166
+ year:
167
+ verification_value:
168
+ issue_number:
169
+
170
+ psl_maestro_address:
171
+ address1:
172
+ address2:
173
+ city:
174
+ state:
175
+ zip:
176
+
177
+ psl_solo:
178
+ number:
179
+ month:
180
+ year:
181
+ verification_value:
182
+ issue_number:
183
+
184
+ psl_solo_address:
185
+ address1:
186
+ city:
187
+ state:
188
+ zip:
189
+
190
+ psl_visa:
191
+ number:
192
+ month:
193
+ year:
194
+ verification_value:
195
+
196
+ psl_visa_address:
197
+ address1:
198
+ address2:
199
+ address3:
200
+ city:
201
+ zip:
202
+
203
+ psl_visa_debit:
204
+ first_name:
205
+ last_name:
206
+ number:
207
+ month:
208
+ year:
209
+ verification_value:
210
+
211
+ psl_visa_debit_address:
212
+ address1:
213
+ address2:
214
+ address3:
215
+ city:
216
+ state:
217
+ zip:
218
+
219
+ quickpay:
220
+ login: 89898989
221
+ password: "n5KrR5e2538awi9hUk6728LHTQ6E4uG1z4IFSb2pPN9j76DqJ2vA4698X315M1cd"
222
+
223
+ realex:
224
+ login: X
225
+ password: Y
226
+
227
+ realex_with_account:
228
+ login: X
229
+ password: Y
230
+ account: testaccount
231
+
232
+ # Realex doesn't provide public testing data
233
+ # Fill in the card numbers with the Realex test
234
+ # data.
235
+ realex_visa:
236
+ number:
237
+ month: '6'
238
+ year: '2020'
239
+ verification_value: '123'
240
+
241
+ realex_visa_declined:
242
+ number:
243
+ month: '6'
244
+ year: '2020'
245
+ verification_value: '123'
246
+
247
+ realex_visa_referral_a:
248
+ number:
249
+ month: '6'
250
+ year: '2020'
251
+ verification_value: '123'
252
+
253
+ realex_visa_referral_b:
254
+ number:
255
+ month: '6'
256
+ year: '2020'
257
+ verification_value: '123'
258
+
259
+ realex_visa_coms_error:
260
+ number:
261
+ month: '6'
262
+ year: '2020'
263
+ verification_value: '123'
264
+
265
+ realex_mastercard:
266
+ number:
267
+ month: '6'
268
+ year: '2020'
269
+ verification_value: '123'
270
+
271
+ realex_mastercard_declined:
272
+ number:
273
+ month: '6'
274
+ year: '2020'
275
+ verification_value: '123'
276
+
277
+ realex_mastercard_referral_a:
278
+ number:
279
+ month: '6'
280
+ year: '2020'
281
+ verification_value: '123'
282
+
283
+ realex_mastercard_referral_b:
284
+ number:
285
+ month: '6'
286
+ year: '2020'
287
+ verification_value: '123'
288
+
289
+ realex_mastercard_coms_error:
290
+ number:
291
+ month: '6'
292
+ year: '2020'
293
+ verification_value: '123'
294
+
295
+ sage:
296
+ login: login
297
+ password: password
298
+
299
+ sallie_mae:
300
+ login: TEST0
301
+
302
+ secure_pay:
303
+ login: LOGIN
304
+ password: PASSWORD
305
+
306
+ secure_pay_tech:
307
+ login: TESTDIGISPL1
308
+ password: d557591484cb2cd12bba445aba420d2c69cd6a88
309
+
310
+ secure_pay_au:
311
+ login:
312
+ password:
313
+
314
+ # Replace with your serial numbers for the skipjack test environment
315
+ skipjack:
316
+ login: X
317
+ password: Y
318
+
319
+ trans_first:
320
+ login: LOGIN
321
+ password: PASSWORD
322
+
323
+ transax:
324
+ login: demo
325
+ password: password
326
+
327
+ # Working credentials, no need to replace
328
+ trust_commerce:
329
+ login: 'TestMerchant'
330
+ password: 'password'
331
+
332
+ # Working credentials, no need to replace
333
+ usa_epay:
334
+ login: 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu'
335
+
336
+ # Working credentials, no need to replace
337
+ verify:
338
+ login: 'demo'
339
+ password: 'password'
340
+
341
+ viaklix:
342
+ login: LOGIN
343
+ password: PASSWORD
344
+ user: USER
345
+
346
+ # Working test credentials, no need to replace
347
+ wirecard:
348
+ login: 56500
349
+ password: TestXAPTER
350
+
351
+ # replace with your Merchant eSolutions developer profile credentials
352
+ merchant_esolutions:
353
+ login: "profile_id"
354
+ password: "profile_key"
355
+
@@ -0,0 +1,460 @@
1
+ require 'test_helper'
2
+ require 'pp'
3
+
4
+ class AuthorizeNetCimTest < Test::Unit::TestCase
5
+ def setup
6
+ Base.mode = :test
7
+
8
+ @gateway = AuthorizeNetCimGateway.new(fixtures(:authorize_net))
9
+ @amount = 100
10
+ @credit_card = credit_card('4242424242424242')
11
+ @payment = {
12
+ :credit_card => @credit_card
13
+ }
14
+ @profile = {
15
+ :merchant_customer_id => 'Up to 20 chars', # Optional
16
+ :description => 'Up to 255 Characters', # Optional
17
+ :email => 'Up to 255 Characters', # Optional
18
+ :payment_profiles => { # Optional
19
+ :customer_type => 'individual', # Optional
20
+ :bill_to => @address,
21
+ :payment => @payment
22
+ },
23
+ :ship_to_list => {
24
+ :first_name => 'John',
25
+ :last_name => 'Doe',
26
+ :company => 'Widgets, Inc',
27
+ :address1 => '1234 Fake Street',
28
+ :city => 'Anytown',
29
+ :state => 'MD',
30
+ :zip => '12345',
31
+ :country => 'USA',
32
+ :phone_number => '(123)123-1234', # Optional - Up to 25 digits (no letters)
33
+ :fax_number => '(123)123-1234' # Optional - Up to 25 digits (no letters)
34
+ }
35
+ }
36
+ @options = {
37
+ :ref_id => '1234', # Optional
38
+ :profile => @profile
39
+ }
40
+ end
41
+
42
+ def teardown
43
+ if @customer_profile_id
44
+ assert response = @gateway.delete_customer_profile(:customer_profile_id => @customer_profile_id)
45
+ assert_success response
46
+ @customer_profile_id = nil
47
+ end
48
+ end
49
+
50
+ def test_successful_profile_create_get_update_and_delete
51
+ assert response = @gateway.create_customer_profile(@options)
52
+ @customer_profile_id = response.authorization
53
+
54
+ assert_success response
55
+ assert response.test?
56
+
57
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
58
+ assert response.test?
59
+ assert_success response
60
+ assert_equal @customer_profile_id, response.authorization
61
+ assert_equal 'Successful.', response.message
62
+ assert response.params['profile']['payment_profiles']['customer_payment_profile_id'] =~ /\d+/, 'The customer_payment_profile_id should be a number'
63
+ assert_equal "XXXX#{@credit_card.last_digits}", response.params['profile']['payment_profiles']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in #{@credit_card.last_digits}"
64
+ assert_equal @profile[:merchant_customer_id], response.params['profile']['merchant_customer_id']
65
+ assert_equal @profile[:description], response.params['profile']['description']
66
+ assert_equal @profile[:email], response.params['profile']['email']
67
+ assert_equal @profile[:payment_profiles][:customer_type], response.params['profile']['payment_profiles']['customer_type']
68
+ assert_equal @profile[:ship_to_list][:phone_number], response.params['profile']['ship_to_list']['phone_number']
69
+ assert_equal @profile[:ship_to_list][:company], response.params['profile']['ship_to_list']['company']
70
+
71
+ assert response = @gateway.update_customer_profile(:profile => {:customer_profile_id => @customer_profile_id, :email => 'new email address'})
72
+ assert response.test?
73
+ assert_success response
74
+ assert_nil response.authorization
75
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
76
+ assert_nil response.params['profile']['merchant_customer_id']
77
+ assert_nil response.params['profile']['description']
78
+ assert_equal 'new email address', response.params['profile']['email']
79
+ end
80
+
81
+ def test_successful_create_customer_profile_transaction_auth_only_and_then_capture_only_requests
82
+ assert response = @gateway.create_customer_profile(@options)
83
+ @customer_profile_id = response.authorization
84
+
85
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
86
+ @customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
87
+
88
+ assert response = @gateway.create_customer_profile_transaction(
89
+ :transaction => {
90
+ :customer_profile_id => @customer_profile_id,
91
+ :customer_payment_profile_id => @customer_payment_profile_id,
92
+ :type => :auth_only,
93
+ :amount => @amount
94
+ }
95
+ )
96
+
97
+ assert response.test?
98
+ assert_success response
99
+ assert_nil response.authorization
100
+ assert_equal "This transaction has been approved.", response.params['direct_response']['message']
101
+ assert response.params['direct_response']['approval_code'] =~ /\w{6}/
102
+ assert_equal "auth_only", response.params['direct_response']['transaction_type']
103
+ assert_equal "100.00", response.params['direct_response']['amount']
104
+ assert_match /\d+/, response.params['direct_response']['transaction_id']
105
+
106
+ approval_code = response.params['direct_response']['approval_code']
107
+
108
+ # Capture the previously authorized funds
109
+
110
+ assert response = @gateway.create_customer_profile_transaction(
111
+ :transaction => {
112
+ :customer_profile_id => @customer_profile_id,
113
+ :customer_payment_profile_id => @customer_payment_profile_id,
114
+ :type => :capture_only,
115
+ :amount => @amount,
116
+ :approval_code => approval_code
117
+ }
118
+ )
119
+
120
+ assert response.test?
121
+ assert_success response
122
+ assert_nil response.authorization
123
+ assert_equal "This transaction has been approved.", response.params['direct_response']['message']
124
+ assert_equal approval_code, response.params['direct_response']['approval_code']
125
+ assert_equal "capture_only", response.params['direct_response']['transaction_type']
126
+ assert_equal "100.00", response.params['direct_response']['amount']
127
+ end
128
+
129
+ def test_successful_create_customer_profile_transaction_auth_capture_request
130
+ assert response = @gateway.create_customer_profile(@options)
131
+ @customer_profile_id = response.authorization
132
+
133
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
134
+ @customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
135
+
136
+ assert response = @gateway.create_customer_profile_transaction(
137
+ :transaction => {
138
+ :customer_profile_id => @customer_profile_id,
139
+ :customer_payment_profile_id => @customer_payment_profile_id,
140
+ :type => :auth_capture,
141
+ :order => {
142
+ :invoice_number => '1234',
143
+ :description => 'Test Order Description',
144
+ :purchase_order_number => '4321'
145
+ },
146
+ :amount => @amount
147
+ }
148
+ )
149
+
150
+ assert response.test?
151
+ assert_success response
152
+ assert_nil response.authorization
153
+ assert_equal "This transaction has been approved.", response.params['direct_response']['message']
154
+ assert response.params['direct_response']['approval_code'] =~ /\w{6}/
155
+ assert_equal "auth_capture", response.params['direct_response']['transaction_type']
156
+ assert_equal "100.00", response.params['direct_response']['amount']
157
+ assert_equal response.params['direct_response']['invoice_number'], '1234'
158
+ assert_equal response.params['direct_response']['order_description'], 'Test Order Description'
159
+ assert_equal response.params['direct_response']['purchase_order_number'], '4321'
160
+ end
161
+
162
+ def test_successful_create_customer_payment_profile_request
163
+ payment_profile = @options[:profile].delete(:payment_profiles)
164
+ assert response = @gateway.create_customer_profile(@options)
165
+ @customer_profile_id = response.authorization
166
+
167
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
168
+ assert_nil response.params['profile']['payment_profiles']
169
+
170
+ assert response = @gateway.create_customer_payment_profile(
171
+ :customer_profile_id => @customer_profile_id,
172
+ :payment_profile => payment_profile
173
+ )
174
+
175
+ assert response.test?
176
+ assert_success response
177
+ assert_nil response.authorization
178
+ assert customer_payment_profile_id = response.params['customer_payment_profile_id']
179
+ assert customer_payment_profile_id =~ /\d+/, "The customerPaymentProfileId should be numeric. It was #{customer_payment_profile_id}"
180
+ end
181
+
182
+ def test_successful_create_customer_payment_profile_request_with_bank_account
183
+ payment_profile = @options[:profile].delete(:payment_profiles)
184
+ assert response = @gateway.create_customer_profile(@options)
185
+ @customer_profile_id = response.authorization
186
+
187
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
188
+ assert_nil response.params['profile']['payment_profiles']
189
+
190
+ assert response = @gateway.create_customer_payment_profile(
191
+ :customer_profile_id => @customer_profile_id,
192
+ :payment_profile => {
193
+ :customer_type => 'individual', # Optional
194
+ :bill_to => @address,
195
+ :payment => {
196
+ :bank_account => {
197
+ :account_type => :checking,
198
+ :name_on_account => 'John Doe',
199
+ :echeck_type => :ccd,
200
+ :bank_name => 'Bank of America',
201
+ :routing_number => '123456789',
202
+ :account_number => '12345'
203
+ }
204
+ },
205
+ :drivers_license => {
206
+ :state => 'MD',
207
+ :number => '12345',
208
+ :date_of_birth => '1981-3-31'
209
+ },
210
+ :tax_id => '123456789'
211
+ }
212
+ )
213
+
214
+ assert response.test?
215
+ assert_success response
216
+ assert_nil response.authorization
217
+ assert customer_payment_profile_id = response.params['customer_payment_profile_id']
218
+ assert customer_payment_profile_id =~ /\d+/, "The customerPaymentProfileId should be numeric. It was #{customer_payment_profile_id}"
219
+ end
220
+
221
+ def test_successful_create_customer_shipping_address_request
222
+ shipping_address = @options[:profile].delete(:ship_to_list)
223
+ assert response = @gateway.create_customer_profile(@options)
224
+ @customer_profile_id = response.authorization
225
+
226
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
227
+ assert_nil response.params['profile']['ship_to_list']
228
+
229
+ assert response = @gateway.create_customer_shipping_address(
230
+ :customer_profile_id => @customer_profile_id,
231
+ :address => shipping_address
232
+ )
233
+
234
+ assert response.test?
235
+ assert_success response
236
+ assert_nil response.authorization
237
+ assert customer_address_id = response.params['customer_address_id']
238
+ assert customer_address_id =~ /\d+/, "The customerAddressId should be numeric. It was #{customer_address_id}"
239
+ end
240
+
241
+ def test_successful_get_customer_profile_with_multiple_payment_profiles
242
+ second_payment_profile = {
243
+ :customer_type => 'individual',
244
+ :bill_to => @address,
245
+ :payment => {
246
+ :credit_card => credit_card('1234123412341234')
247
+ }
248
+ }
249
+ assert response = @gateway.create_customer_profile(@options)
250
+ @customer_profile_id = response.authorization
251
+
252
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
253
+
254
+ assert response = @gateway.create_customer_payment_profile(
255
+ :customer_profile_id => @customer_profile_id,
256
+ :payment_profile => second_payment_profile
257
+ )
258
+
259
+ assert response.test?
260
+ assert_success response
261
+ assert_nil response.authorization
262
+ assert customer_payment_profile_id = response.params['customer_payment_profile_id']
263
+ assert customer_payment_profile_id =~ /\d+/, "The customerPaymentProfileId should be numeric. It was #{customer_payment_profile_id}"
264
+
265
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
266
+ assert_equal 2, response.params['profile']['payment_profiles'].size
267
+ assert_equal 'XXXX4242', response.params['profile']['payment_profiles'][0]['payment']['credit_card']['card_number']
268
+ assert_equal 'XXXX1234', response.params['profile']['payment_profiles'][1]['payment']['credit_card']['card_number']
269
+ end
270
+
271
+ def test_successful_delete_customer_payment_profile_request
272
+ assert response = @gateway.create_customer_profile(@options)
273
+ @customer_profile_id = response.authorization
274
+
275
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
276
+ assert customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
277
+
278
+ assert response = @gateway.delete_customer_payment_profile(
279
+ :customer_profile_id => @customer_profile_id,
280
+ :customer_payment_profile_id => customer_payment_profile_id
281
+ )
282
+
283
+ assert response.test?
284
+ assert_success response
285
+ assert_nil response.authorization
286
+
287
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
288
+ assert_nil response.params['profile']['payment_profiles']
289
+ end
290
+
291
+ def test_successful_delete_customer_shipping_address_request
292
+ assert response = @gateway.create_customer_profile(@options)
293
+ @customer_profile_id = response.authorization
294
+
295
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
296
+ assert customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
297
+
298
+ assert response = @gateway.delete_customer_shipping_address(
299
+ :customer_profile_id => @customer_profile_id,
300
+ :customer_address_id => customer_address_id
301
+ )
302
+
303
+ assert response.test?
304
+ assert_success response
305
+ assert_nil response.authorization
306
+
307
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
308
+ assert_nil response.params['profile']['ship_to_list']
309
+ end
310
+
311
+ def test_successful_get_customer_payment_profile_request
312
+ assert response = @gateway.create_customer_profile(@options)
313
+ @customer_profile_id = response.authorization
314
+
315
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
316
+ assert customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
317
+
318
+ assert response = @gateway.get_customer_payment_profile(
319
+ :customer_profile_id => @customer_profile_id,
320
+ :customer_payment_profile_id => customer_payment_profile_id
321
+ )
322
+
323
+ assert response.test?
324
+ assert_success response
325
+ assert_nil response.authorization
326
+ assert response.params['payment_profile']['customer_payment_profile_id'] =~ /\d+/, 'The customer_payment_profile_id should be a number'
327
+ assert_equal "XXXX#{@credit_card.last_digits}", response.params['payment_profile']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in #{@credit_card.last_digits}"
328
+ assert_equal @profile[:payment_profiles][:customer_type], response.params['payment_profile']['customer_type']
329
+ end
330
+
331
+ def test_successful_get_customer_shipping_address_request
332
+ assert response = @gateway.create_customer_profile(@options)
333
+ @customer_profile_id = response.authorization
334
+
335
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
336
+ assert customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
337
+
338
+ assert response = @gateway.get_customer_shipping_address(
339
+ :customer_profile_id => @customer_profile_id,
340
+ :customer_address_id => customer_address_id
341
+ )
342
+
343
+ assert response.test?
344
+ assert_success response
345
+ assert_nil response.authorization
346
+ assert response.params['address']['customer_address_id'] =~ /\d+/, 'The customer_address_id should be a number'
347
+ assert_equal @profile[:ship_to_list][:city], response.params['address']['city']
348
+ end
349
+
350
+ def test_successful_update_customer_payment_profile_request
351
+ # Create a new Customer Profile with Payment Profile
352
+ assert response = @gateway.create_customer_profile(@options)
353
+ @customer_profile_id = response.authorization
354
+
355
+ # Get the customerPaymentProfileId
356
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
357
+ assert customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
358
+
359
+ # Get the customerPaymentProfile
360
+ assert response = @gateway.get_customer_payment_profile(
361
+ :customer_profile_id => @customer_profile_id,
362
+ :customer_payment_profile_id => customer_payment_profile_id
363
+ )
364
+
365
+ # The value before updating
366
+ assert_equal "XXXX4242", response.params['payment_profile']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in 4242"
367
+
368
+ #Update the payment profile
369
+ assert response = @gateway.update_customer_payment_profile(
370
+ :customer_profile_id => @customer_profile_id,
371
+ :payment_profile => {
372
+ :customer_payment_profile_id => customer_payment_profile_id,
373
+ :payment => {
374
+ :credit_card => credit_card('1234123412341234')
375
+ }
376
+ }
377
+ )
378
+ assert response.test?
379
+ assert_success response
380
+ assert_nil response.authorization
381
+
382
+ # Get the updated payment profile
383
+ assert response = @gateway.get_customer_payment_profile(
384
+ :customer_profile_id => @customer_profile_id,
385
+ :customer_payment_profile_id => customer_payment_profile_id
386
+ )
387
+
388
+ # Show that the payment profile was updated
389
+ assert_equal "XXXX1234", response.params['payment_profile']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in: 1234"
390
+ # Show that fields that were left out of the update were cleared
391
+ assert_nil response.params['payment_profile']['customer_type']
392
+ end
393
+
394
+ def test_successful_update_customer_shipping_address_request
395
+ # Create a new Customer Profile with Shipping Address
396
+ assert response = @gateway.create_customer_profile(@options)
397
+ @customer_profile_id = response.authorization
398
+
399
+ # Get the customerAddressId
400
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
401
+ assert customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
402
+
403
+ # Get the customerShippingAddress
404
+ assert response = @gateway.get_customer_shipping_address(
405
+ :customer_profile_id => @customer_profile_id,
406
+ :customer_address_id => customer_address_id
407
+ )
408
+
409
+ assert address = response.params['address']
410
+ # The value before updating
411
+ assert_equal "1234 Fake Street", address['address']
412
+
413
+ # Update the address and remove the phone_number
414
+ new_address = address.symbolize_keys.merge!(
415
+ :address => '5678 Fake Street'
416
+ )
417
+ new_address.delete(:phone_number)
418
+
419
+ #Update the shipping address
420
+ assert response = @gateway.update_customer_shipping_address(
421
+ :customer_profile_id => @customer_profile_id,
422
+ :address => new_address
423
+ )
424
+ assert response.test?
425
+ assert_success response
426
+ assert_nil response.authorization
427
+
428
+ # Get the updated shipping address
429
+ assert response = @gateway.get_customer_shipping_address(
430
+ :customer_profile_id => @customer_profile_id,
431
+ :customer_address_id => customer_address_id
432
+ )
433
+
434
+ # Show that the shipping address was updated
435
+ assert_equal "5678 Fake Street", response.params['address']['address']
436
+ # Show that fields that were left out of the update were cleared
437
+ assert_nil response.params['address']['phone_number']
438
+ end
439
+
440
+ def test_successful_validate_customer_payment_profile_request
441
+ assert response = @gateway.create_customer_profile(@options)
442
+ @customer_profile_id = response.authorization
443
+
444
+ assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
445
+ assert @customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
446
+ assert @customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
447
+
448
+ assert response = @gateway.validate_customer_payment_profile(
449
+ :customer_profile_id => @customer_profile_id,
450
+ :customer_payment_profile_id => @customer_payment_profile_id,
451
+ :customer_address_id => @customer_address_id,
452
+ :validation_mode => :live
453
+ )
454
+
455
+ assert response.test?
456
+ assert_success response
457
+ assert_nil response.authorization
458
+ assert_equal "This transaction has been approved.", response.params['direct_response']['message']
459
+ end
460
+ end