activemerchant 1.42.6 → 1.90.0

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 (450) hide show
  1. checksums.yaml +5 -13
  2. data/CHANGELOG +1420 -2
  3. data/CONTRIBUTORS +106 -0
  4. data/README.md +107 -103
  5. data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
  6. data/lib/active_merchant/billing/avs_result.rb +12 -13
  7. data/lib/active_merchant/billing/base.rb +13 -16
  8. data/lib/active_merchant/billing/check.rb +35 -24
  9. data/lib/active_merchant/billing/compatibility.rb +117 -0
  10. data/lib/active_merchant/billing/credit_card.rb +196 -81
  11. data/lib/active_merchant/billing/credit_card_formatting.rb +6 -4
  12. data/lib/active_merchant/billing/credit_card_methods.rb +199 -75
  13. data/lib/active_merchant/billing/cvv_result.rb +15 -15
  14. data/lib/active_merchant/billing/gateway.rb +171 -39
  15. data/lib/active_merchant/billing/gateways/adyen.rb +380 -0
  16. data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
  17. data/lib/active_merchant/billing/gateways/authorize_net.rb +933 -604
  18. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
  19. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +74 -54
  20. data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
  21. data/lib/active_merchant/billing/gateways/balanced.rb +130 -370
  22. data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
  23. data/lib/active_merchant/billing/gateways/banwire.rb +23 -12
  24. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +351 -0
  25. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +6 -6
  26. data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
  27. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +109 -32
  28. data/lib/active_merchant/billing/gateways/beanstream.rb +59 -13
  29. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +12 -9
  30. data/lib/active_merchant/billing/gateways/blue_pay.rb +520 -498
  31. data/lib/active_merchant/billing/gateways/blue_snap.rb +347 -0
  32. data/lib/active_merchant/billing/gateways/bogus.rb +80 -46
  33. data/lib/active_merchant/billing/gateways/borgun.rb +220 -0
  34. data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
  35. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +15 -2
  36. data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
  37. data/lib/active_merchant/billing/gateways/braintree_blue.rb +311 -121
  38. data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -4
  39. data/lib/active_merchant/billing/gateways/bridge_pay.rb +244 -0
  40. data/lib/active_merchant/billing/gateways/cams.rb +230 -0
  41. data/lib/active_merchant/billing/gateways/card_connect.rb +311 -0
  42. data/lib/active_merchant/billing/gateways/card_save.rb +6 -7
  43. data/lib/active_merchant/billing/gateways/card_stream.rb +235 -89
  44. data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
  45. data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
  46. data/lib/active_merchant/billing/gateways/cashnet.rb +219 -0
  47. data/lib/active_merchant/billing/gateways/cc5.rb +50 -8
  48. data/lib/active_merchant/billing/gateways/cecabank.rb +27 -14
  49. data/lib/active_merchant/billing/gateways/cenpos.rb +327 -0
  50. data/lib/active_merchant/billing/gateways/checkout.rb +214 -0
  51. data/lib/active_merchant/billing/gateways/checkout_v2.rb +233 -0
  52. data/lib/active_merchant/billing/gateways/citrus_pay.rb +22 -0
  53. data/lib/active_merchant/billing/gateways/clearhaus.rb +220 -0
  54. data/lib/active_merchant/billing/gateways/commercegate.rb +142 -0
  55. data/lib/active_merchant/billing/gateways/conekta.rb +91 -97
  56. data/lib/active_merchant/billing/gateways/creditcall.rb +271 -0
  57. data/lib/active_merchant/billing/gateways/credorax.rb +356 -0
  58. data/lib/active_merchant/billing/gateways/ct_payment.rb +268 -0
  59. data/lib/active_merchant/billing/gateways/culqi.rb +277 -0
  60. data/lib/active_merchant/billing/gateways/cyber_source.rb +294 -158
  61. data/lib/active_merchant/billing/gateways/d_local.rb +226 -0
  62. data/lib/active_merchant/billing/gateways/data_cash.rb +59 -347
  63. data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
  64. data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
  65. data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
  66. data/lib/active_merchant/billing/gateways/efsnet.rb +24 -39
  67. data/lib/active_merchant/billing/gateways/elavon.rb +146 -147
  68. data/lib/active_merchant/billing/gateways/element.rb +356 -0
  69. data/lib/active_merchant/billing/gateways/epay.rb +41 -31
  70. data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
  71. data/lib/active_merchant/billing/gateways/eway.rb +79 -78
  72. data/lib/active_merchant/billing/gateways/eway_managed.rb +35 -36
  73. data/lib/active_merchant/billing/gateways/eway_rapid.rb +369 -228
  74. data/lib/active_merchant/billing/gateways/exact.rb +32 -26
  75. data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
  76. data/lib/active_merchant/billing/gateways/fat_zebra.rb +90 -64
  77. data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -14
  78. data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
  79. data/lib/active_merchant/billing/gateways/first_giving.rb +142 -0
  80. data/lib/active_merchant/billing/gateways/first_pay.rb +128 -122
  81. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +190 -64
  82. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +446 -0
  83. data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
  84. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
  85. data/lib/active_merchant/billing/gateways/forte.rb +270 -0
  86. data/lib/active_merchant/billing/gateways/garanti.rb +29 -27
  87. data/lib/active_merchant/billing/gateways/global_collect.rb +340 -0
  88. data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
  89. data/lib/active_merchant/billing/gateways/hdfc.rb +35 -36
  90. data/lib/active_merchant/billing/gateways/hps.rb +305 -0
  91. data/lib/active_merchant/billing/gateways/iats_payments.rb +271 -16
  92. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
  93. data/lib/active_merchant/billing/gateways/inspire.rb +29 -32
  94. data/lib/active_merchant/billing/gateways/instapay.rb +5 -6
  95. data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
  96. data/lib/active_merchant/billing/gateways/iridium.rb +247 -41
  97. data/lib/active_merchant/billing/gateways/itransact.rb +4 -5
  98. data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
  99. data/lib/active_merchant/billing/gateways/jetpay.rb +198 -71
  100. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
  101. data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
  102. data/lib/active_merchant/billing/gateways/kushki.rb +219 -0
  103. data/lib/active_merchant/billing/gateways/latitude19.rb +411 -0
  104. data/lib/active_merchant/billing/gateways/linkpoint.rb +45 -43
  105. data/lib/active_merchant/billing/gateways/litle.rb +328 -444
  106. data/lib/active_merchant/billing/gateways/mastercard.rb +267 -0
  107. data/lib/active_merchant/billing/gateways/maxipago.rb +145 -115
  108. data/lib/active_merchant/billing/gateways/mercado_pago.rb +277 -0
  109. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +37 -19
  110. data/lib/active_merchant/billing/gateways/merchant_one.rb +13 -15
  111. data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
  112. data/lib/active_merchant/billing/gateways/merchant_ware.rb +57 -60
  113. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +59 -48
  114. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +38 -19
  115. data/lib/active_merchant/billing/gateways/mercury.rb +77 -54
  116. data/lib/active_merchant/billing/gateways/metrics_global.rb +11 -30
  117. data/lib/active_merchant/billing/gateways/micropayment.rb +183 -0
  118. data/lib/active_merchant/billing/gateways/migs.rb +81 -22
  119. data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
  120. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +23 -25
  121. data/lib/active_merchant/billing/gateways/monei.rb +307 -0
  122. data/lib/active_merchant/billing/gateways/moneris.rb +146 -64
  123. data/lib/active_merchant/billing/gateways/moneris_us.rb +197 -53
  124. data/lib/active_merchant/billing/gateways/money_movers.rb +6 -15
  125. data/lib/active_merchant/billing/gateways/mundipagg.rb +292 -0
  126. data/lib/active_merchant/billing/gateways/nab_transact.rb +86 -64
  127. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
  128. data/lib/active_merchant/billing/gateways/net_registry.rb +11 -5
  129. data/lib/active_merchant/billing/gateways/netaxept.rb +21 -22
  130. data/lib/active_merchant/billing/gateways/netbanx.rb +290 -0
  131. data/lib/active_merchant/billing/gateways/netbilling.rb +70 -35
  132. data/lib/active_merchant/billing/gateways/netpay.rb +5 -6
  133. data/lib/active_merchant/billing/gateways/network_merchants.rb +241 -0
  134. data/lib/active_merchant/billing/gateways/nmi.rb +274 -10
  135. data/lib/active_merchant/billing/gateways/ogone.rb +90 -47
  136. data/lib/active_merchant/billing/gateways/omise.rb +324 -0
  137. data/lib/active_merchant/billing/gateways/openpay.rb +48 -20
  138. data/lib/active_merchant/billing/gateways/opp.rb +369 -0
  139. data/lib/active_merchant/billing/gateways/optimal_payment.rb +79 -44
  140. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
  141. data/lib/active_merchant/billing/gateways/orbital.rb +346 -102
  142. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +48 -29
  143. data/lib/active_merchant/billing/gateways/pagarme.rb +246 -0
  144. data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
  145. data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
  146. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +67 -48
  147. data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
  148. data/lib/active_merchant/billing/gateways/pay_junction.rb +20 -26
  149. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +188 -0
  150. data/lib/active_merchant/billing/gateways/pay_secure.rb +7 -15
  151. data/lib/active_merchant/billing/gateways/paybox_direct.rb +40 -36
  152. data/lib/active_merchant/billing/gateways/payeezy.rb +410 -0
  153. data/lib/active_merchant/billing/gateways/payex.rb +38 -30
  154. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +62 -36
  155. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -7
  156. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
  157. data/lib/active_merchant/billing/gateways/payflow.rb +74 -27
  158. data/lib/active_merchant/billing/gateways/payflow_express.rb +77 -81
  159. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
  160. data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
  161. data/lib/active_merchant/billing/gateways/payment_express.rb +54 -45
  162. data/lib/active_merchant/billing/gateways/paymentez.rb +304 -0
  163. data/lib/active_merchant/billing/gateways/paymill.rb +160 -66
  164. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +54 -7
  165. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
  166. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +17 -3
  167. data/lib/active_merchant/billing/gateways/paypal.rb +36 -27
  168. data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
  169. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +7 -6
  170. data/lib/active_merchant/billing/gateways/paypal_express.rb +32 -4
  171. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
  172. data/lib/active_merchant/billing/gateways/payscout.rb +2 -13
  173. data/lib/active_merchant/billing/gateways/paystation.rb +96 -88
  174. data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
  175. data/lib/active_merchant/billing/gateways/payu_latam.rb +445 -0
  176. data/lib/active_merchant/billing/gateways/payway.rb +8 -8
  177. data/lib/active_merchant/billing/gateways/pin.rb +74 -18
  178. data/lib/active_merchant/billing/gateways/plugnpay.rb +66 -76
  179. data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
  180. data/lib/active_merchant/billing/gateways/psigate.rb +30 -30
  181. data/lib/active_merchant/billing/gateways/psl_card.rb +27 -34
  182. data/lib/active_merchant/billing/gateways/qbms.rb +65 -54
  183. data/lib/active_merchant/billing/gateways/quantum.rb +18 -18
  184. data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
  185. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
  186. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +295 -0
  187. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
  188. data/lib/active_merchant/billing/gateways/quickpay.rb +10 -350
  189. data/lib/active_merchant/billing/gateways/qvalent.rb +236 -0
  190. data/lib/active_merchant/billing/gateways/realex.rb +78 -48
  191. data/lib/active_merchant/billing/gateways/redsys.rb +310 -170
  192. data/lib/active_merchant/billing/gateways/s5.rb +246 -0
  193. data/lib/active_merchant/billing/gateways/safe_charge.rb +262 -0
  194. data/lib/active_merchant/billing/gateways/sage.rb +415 -119
  195. data/lib/active_merchant/billing/gateways/sage_pay.rb +195 -90
  196. data/lib/active_merchant/billing/gateways/sallie_mae.rb +11 -12
  197. data/lib/active_merchant/billing/gateways/secure_net.rb +51 -43
  198. data/lib/active_merchant/billing/gateways/secure_pay.rb +182 -10
  199. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +25 -14
  200. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +10 -18
  201. data/lib/active_merchant/billing/gateways/securion_pay.rb +264 -0
  202. data/lib/active_merchant/billing/gateways/skip_jack.rb +35 -38
  203. data/lib/active_merchant/billing/gateways/smart_ps.rb +50 -42
  204. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +9 -9
  205. data/lib/active_merchant/billing/gateways/spreedly_core.rb +62 -12
  206. data/lib/active_merchant/billing/gateways/stripe.rb +536 -103
  207. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +12 -18
  208. data/lib/active_merchant/billing/gateways/telr.rb +274 -0
  209. data/lib/active_merchant/billing/gateways/tns.rb +22 -0
  210. data/lib/active_merchant/billing/gateways/trans_first.rb +143 -30
  211. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +608 -0
  212. data/lib/active_merchant/billing/gateways/transact_pro.rb +224 -0
  213. data/lib/active_merchant/billing/gateways/transax.rb +5 -6
  214. data/lib/active_merchant/billing/gateways/transnational.rb +2 -232
  215. data/lib/active_merchant/billing/gateways/trexle.rb +218 -0
  216. data/lib/active_merchant/billing/gateways/trust_commerce.rb +86 -57
  217. data/lib/active_merchant/billing/gateways/usa_epay.rb +4 -4
  218. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +196 -89
  219. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +157 -32
  220. data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
  221. data/lib/active_merchant/billing/gateways/verifi.rb +42 -49
  222. data/lib/active_merchant/billing/gateways/viaklix.rb +11 -24
  223. data/lib/active_merchant/billing/gateways/visanet_peru.rb +233 -0
  224. data/lib/active_merchant/billing/gateways/webpay.rb +26 -28
  225. data/lib/active_merchant/billing/gateways/wepay.rb +237 -0
  226. data/lib/active_merchant/billing/gateways/wirecard.rb +153 -31
  227. data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
  228. data/lib/active_merchant/billing/gateways/worldpay.rb +207 -63
  229. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +215 -0
  230. data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
  231. data/lib/active_merchant/billing/gateways.rb +8 -11
  232. data/lib/active_merchant/billing/model.rb +30 -0
  233. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
  234. data/lib/active_merchant/billing/payment_token.rb +21 -0
  235. data/lib/active_merchant/billing/rails.rb +3 -0
  236. data/lib/active_merchant/billing/response.rb +31 -24
  237. data/lib/active_merchant/billing.rb +7 -1
  238. data/lib/active_merchant/connection.rb +195 -0
  239. data/lib/active_merchant/country.rb +335 -0
  240. data/lib/active_merchant/empty.rb +20 -0
  241. data/lib/active_merchant/errors.rb +35 -0
  242. data/lib/active_merchant/net_http_ssl_connection.rb +10 -0
  243. data/lib/active_merchant/network_connection_retries.rb +80 -0
  244. data/lib/active_merchant/post_data.rb +25 -0
  245. data/lib/active_merchant/posts_data.rb +92 -0
  246. data/lib/active_merchant/version.rb +1 -1
  247. data/lib/active_merchant.rb +23 -27
  248. data/lib/activemerchant.rb +1 -1
  249. data/lib/certs/cacert.pem +3988 -0
  250. data/lib/support/gateway_support.rb +7 -9
  251. data/lib/support/outbound_hosts.rb +13 -10
  252. data/lib/support/ssl_verify.rb +6 -7
  253. data/lib/support/ssl_version.rb +87 -0
  254. metadata +148 -323
  255. checksums.yaml.gz.sig +0 -0
  256. data/gem-public_cert.pem +0 -21
  257. data/lib/active_merchant/billing/expiry_date.rb +0 -34
  258. data/lib/active_merchant/billing/gateways/app55.rb +0 -185
  259. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
  260. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -277
  261. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -249
  262. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
  263. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
  264. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
  265. data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +0 -93
  266. data/lib/active_merchant/billing/gateways/orbital/cvv_result.rb +0 -34
  267. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -93
  268. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
  269. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
  270. data/lib/active_merchant/billing/gateways/samurai.rb +0 -118
  271. data/lib/active_merchant/billing/gateways/vindicia.rb +0 -361
  272. data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +0 -31
  273. data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +0 -186
  274. data/lib/active_merchant/billing/integrations/a1agregator/status.rb +0 -38
  275. data/lib/active_merchant/billing/integrations/a1agregator.rb +0 -26
  276. data/lib/active_merchant/billing/integrations/action_view_helper.rb +0 -74
  277. data/lib/active_merchant/billing/integrations/alipay/helper.rb +0 -34
  278. data/lib/active_merchant/billing/integrations/alipay/notification.rb +0 -101
  279. data/lib/active_merchant/billing/integrations/alipay.rb +0 -18
  280. data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +0 -229
  281. data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +0 -340
  282. data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +0 -38
  283. data/lib/active_merchant/billing/integrations/bit_pay/helper.rb +0 -64
  284. data/lib/active_merchant/billing/integrations/bit_pay/notification.rb +0 -74
  285. data/lib/active_merchant/billing/integrations/bit_pay/return.rb +0 -10
  286. data/lib/active_merchant/billing/integrations/bit_pay.rb +0 -30
  287. data/lib/active_merchant/billing/integrations/bogus/helper.rb +0 -17
  288. data/lib/active_merchant/billing/integrations/bogus/notification.rb +0 -11
  289. data/lib/active_merchant/billing/integrations/bogus/return.rb +0 -10
  290. data/lib/active_merchant/billing/integrations/bogus.rb +0 -23
  291. data/lib/active_merchant/billing/integrations/chronopay/helper.rb +0 -120
  292. data/lib/active_merchant/billing/integrations/chronopay/notification.rb +0 -158
  293. data/lib/active_merchant/billing/integrations/chronopay/return.rb +0 -10
  294. data/lib/active_merchant/billing/integrations/chronopay.rb +0 -23
  295. data/lib/active_merchant/billing/integrations/citrus/helper.rb +0 -40
  296. data/lib/active_merchant/billing/integrations/citrus/notification.rb +0 -133
  297. data/lib/active_merchant/billing/integrations/citrus/return.rb +0 -40
  298. data/lib/active_merchant/billing/integrations/citrus.rb +0 -51
  299. data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +0 -200
  300. data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +0 -76
  301. data/lib/active_merchant/billing/integrations/direc_pay/return.rb +0 -32
  302. data/lib/active_merchant/billing/integrations/direc_pay/status.rb +0 -37
  303. data/lib/active_merchant/billing/integrations/direc_pay.rb +0 -41
  304. data/lib/active_merchant/billing/integrations/directebanking/helper.rb +0 -90
  305. data/lib/active_merchant/billing/integrations/directebanking/notification.rb +0 -120
  306. data/lib/active_merchant/billing/integrations/directebanking/return.rb +0 -11
  307. data/lib/active_merchant/billing/integrations/directebanking.rb +0 -47
  308. data/lib/active_merchant/billing/integrations/doku/helper.rb +0 -102
  309. data/lib/active_merchant/billing/integrations/doku/notification.rb +0 -69
  310. data/lib/active_merchant/billing/integrations/doku/return.rb +0 -10
  311. data/lib/active_merchant/billing/integrations/doku.rb +0 -24
  312. data/lib/active_merchant/billing/integrations/dotpay/helper.rb +0 -77
  313. data/lib/active_merchant/billing/integrations/dotpay/notification.rb +0 -86
  314. data/lib/active_merchant/billing/integrations/dotpay/return.rb +0 -11
  315. data/lib/active_merchant/billing/integrations/dotpay.rb +0 -22
  316. data/lib/active_merchant/billing/integrations/dwolla/common.rb +0 -23
  317. data/lib/active_merchant/billing/integrations/dwolla/helper.rb +0 -43
  318. data/lib/active_merchant/billing/integrations/dwolla/notification.rb +0 -64
  319. data/lib/active_merchant/billing/integrations/dwolla/return.rb +0 -49
  320. data/lib/active_merchant/billing/integrations/dwolla.rb +0 -23
  321. data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +0 -34
  322. data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +0 -84
  323. data/lib/active_merchant/billing/integrations/e_payment_plans.rb +0 -48
  324. data/lib/active_merchant/billing/integrations/easy_pay/common.rb +0 -40
  325. data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +0 -36
  326. data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +0 -59
  327. data/lib/active_merchant/billing/integrations/easy_pay.rb +0 -30
  328. data/lib/active_merchant/billing/integrations/epay/helper.rb +0 -55
  329. data/lib/active_merchant/billing/integrations/epay/notification.rb +0 -110
  330. data/lib/active_merchant/billing/integrations/epay.rb +0 -21
  331. data/lib/active_merchant/billing/integrations/first_data/helper.rb +0 -61
  332. data/lib/active_merchant/billing/integrations/first_data/notification.rb +0 -56
  333. data/lib/active_merchant/billing/integrations/first_data.rb +0 -38
  334. data/lib/active_merchant/billing/integrations/gestpay/common.rb +0 -42
  335. data/lib/active_merchant/billing/integrations/gestpay/helper.rb +0 -70
  336. data/lib/active_merchant/billing/integrations/gestpay/notification.rb +0 -85
  337. data/lib/active_merchant/billing/integrations/gestpay/return.rb +0 -10
  338. data/lib/active_merchant/billing/integrations/gestpay.rb +0 -25
  339. data/lib/active_merchant/billing/integrations/helper.rb +0 -117
  340. data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +0 -58
  341. data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +0 -59
  342. data/lib/active_merchant/billing/integrations/hi_trust/return.rb +0 -68
  343. data/lib/active_merchant/billing/integrations/hi_trust.rb +0 -27
  344. data/lib/active_merchant/billing/integrations/ipay88/helper.rb +0 -118
  345. data/lib/active_merchant/billing/integrations/ipay88/notification.rb +0 -103
  346. data/lib/active_merchant/billing/integrations/ipay88/return.rb +0 -29
  347. data/lib/active_merchant/billing/integrations/ipay88.rb +0 -23
  348. data/lib/active_merchant/billing/integrations/liqpay/helper.rb +0 -43
  349. data/lib/active_merchant/billing/integrations/liqpay/notification.rb +0 -89
  350. data/lib/active_merchant/billing/integrations/liqpay/return.rb +0 -83
  351. data/lib/active_merchant/billing/integrations/liqpay.rb +0 -30
  352. data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +0 -119
  353. data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +0 -48
  354. data/lib/active_merchant/billing/integrations/maksuturva.rb +0 -86
  355. data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +0 -75
  356. data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +0 -123
  357. data/lib/active_merchant/billing/integrations/moneybookers.rb +0 -26
  358. data/lib/active_merchant/billing/integrations/nochex/helper.rb +0 -68
  359. data/lib/active_merchant/billing/integrations/nochex/notification.rb +0 -94
  360. data/lib/active_merchant/billing/integrations/nochex/return.rb +0 -10
  361. data/lib/active_merchant/billing/integrations/nochex.rb +0 -88
  362. data/lib/active_merchant/billing/integrations/notification.rb +0 -71
  363. data/lib/active_merchant/billing/integrations/paxum/common.rb +0 -24
  364. data/lib/active_merchant/billing/integrations/paxum/helper.rb +0 -42
  365. data/lib/active_merchant/billing/integrations/paxum/notification.rb +0 -33
  366. data/lib/active_merchant/billing/integrations/paxum.rb +0 -44
  367. data/lib/active_merchant/billing/integrations/pay_fast/common.rb +0 -42
  368. data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +0 -50
  369. data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +0 -134
  370. data/lib/active_merchant/billing/integrations/pay_fast/return.rb +0 -10
  371. data/lib/active_merchant/billing/integrations/pay_fast.rb +0 -70
  372. data/lib/active_merchant/billing/integrations/paydollar/helper.rb +0 -41
  373. data/lib/active_merchant/billing/integrations/paydollar/notification.rb +0 -60
  374. data/lib/active_merchant/billing/integrations/paydollar/return.rb +0 -15
  375. data/lib/active_merchant/billing/integrations/paydollar.rb +0 -59
  376. data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +0 -116
  377. data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +0 -78
  378. data/lib/active_merchant/billing/integrations/payflow_link.rb +0 -21
  379. data/lib/active_merchant/billing/integrations/paypal/helper.rb +0 -119
  380. data/lib/active_merchant/billing/integrations/paypal/notification.rb +0 -227
  381. data/lib/active_merchant/billing/integrations/paypal/return.rb +0 -10
  382. data/lib/active_merchant/billing/integrations/paypal.rb +0 -39
  383. data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +0 -15
  384. data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +0 -20
  385. data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +0 -15
  386. data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +0 -39
  387. data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
  388. data/lib/active_merchant/billing/integrations/payu_in/helper.rb +0 -76
  389. data/lib/active_merchant/billing/integrations/payu_in/notification.rb +0 -154
  390. data/lib/active_merchant/billing/integrations/payu_in/return.rb +0 -36
  391. data/lib/active_merchant/billing/integrations/payu_in.rb +0 -36
  392. data/lib/active_merchant/billing/integrations/payu_in_paisa/helper.rb +0 -19
  393. data/lib/active_merchant/billing/integrations/payu_in_paisa/notification.rb +0 -13
  394. data/lib/active_merchant/billing/integrations/payu_in_paisa/return.rb +0 -16
  395. data/lib/active_merchant/billing/integrations/payu_in_paisa.rb +0 -30
  396. data/lib/active_merchant/billing/integrations/platron/helper.rb +0 -32
  397. data/lib/active_merchant/billing/integrations/platron/notification.rb +0 -113
  398. data/lib/active_merchant/billing/integrations/platron.rb +0 -28
  399. data/lib/active_merchant/billing/integrations/pxpay/helper.rb +0 -112
  400. data/lib/active_merchant/billing/integrations/pxpay/notification.rb +0 -157
  401. data/lib/active_merchant/billing/integrations/pxpay/return.rb +0 -25
  402. data/lib/active_merchant/billing/integrations/pxpay.rb +0 -31
  403. data/lib/active_merchant/billing/integrations/quickpay/helper.rb +0 -96
  404. data/lib/active_merchant/billing/integrations/quickpay/notification.rb +0 -137
  405. data/lib/active_merchant/billing/integrations/quickpay.rb +0 -21
  406. data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +0 -23
  407. data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +0 -91
  408. data/lib/active_merchant/billing/integrations/rbkmoney.rb +0 -17
  409. data/lib/active_merchant/billing/integrations/return.rb +0 -42
  410. data/lib/active_merchant/billing/integrations/robokassa/common.rb +0 -19
  411. data/lib/active_merchant/billing/integrations/robokassa/helper.rb +0 -50
  412. data/lib/active_merchant/billing/integrations/robokassa/notification.rb +0 -55
  413. data/lib/active_merchant/billing/integrations/robokassa/return.rb +0 -17
  414. data/lib/active_merchant/billing/integrations/robokassa.rb +0 -49
  415. data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +0 -33
  416. data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +0 -136
  417. data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +0 -210
  418. data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +0 -31
  419. data/lib/active_merchant/billing/integrations/sage_pay_form.rb +0 -37
  420. data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +0 -107
  421. data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +0 -171
  422. data/lib/active_merchant/billing/integrations/two_checkout/return.rb +0 -58
  423. data/lib/active_merchant/billing/integrations/two_checkout.rb +0 -44
  424. data/lib/active_merchant/billing/integrations/valitor/helper.rb +0 -86
  425. data/lib/active_merchant/billing/integrations/valitor/notification.rb +0 -13
  426. data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +0 -97
  427. data/lib/active_merchant/billing/integrations/valitor/return.rb +0 -13
  428. data/lib/active_merchant/billing/integrations/valitor.rb +0 -33
  429. data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +0 -88
  430. data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +0 -59
  431. data/lib/active_merchant/billing/integrations/verkkomaksut.rb +0 -20
  432. data/lib/active_merchant/billing/integrations/web_pay/common.rb +0 -50
  433. data/lib/active_merchant/billing/integrations/web_pay/helper.rb +0 -68
  434. data/lib/active_merchant/billing/integrations/web_pay/notification.rb +0 -51
  435. data/lib/active_merchant/billing/integrations/web_pay.rb +0 -45
  436. data/lib/active_merchant/billing/integrations/webmoney/common.rb +0 -17
  437. data/lib/active_merchant/billing/integrations/webmoney/helper.rb +0 -40
  438. data/lib/active_merchant/billing/integrations/webmoney/notification.rb +0 -47
  439. data/lib/active_merchant/billing/integrations/webmoney.rb +0 -43
  440. data/lib/active_merchant/billing/integrations/wirecard_checkout_page/common.rb +0 -104
  441. data/lib/active_merchant/billing/integrations/wirecard_checkout_page/helper.rb +0 -145
  442. data/lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb +0 -101
  443. data/lib/active_merchant/billing/integrations/wirecard_checkout_page/return.rb +0 -35
  444. data/lib/active_merchant/billing/integrations/wirecard_checkout_page.rb +0 -39
  445. data/lib/active_merchant/billing/integrations/world_pay/helper.rb +0 -101
  446. data/lib/active_merchant/billing/integrations/world_pay/notification.rb +0 -160
  447. data/lib/active_merchant/billing/integrations/world_pay.rb +0 -34
  448. data/lib/active_merchant/billing/integrations.rb +0 -17
  449. data.tar.gz.sig +0 -0
  450. metadata.gz.sig +0 -1
@@ -1,221 +1,275 @@
1
- require "nokogiri"
2
- require "cgi"
1
+ require 'json'
3
2
 
4
3
  module ActiveMerchant #:nodoc:
5
4
  module Billing #:nodoc:
6
5
  class EwayRapidGateway < Gateway
7
- self.test_url = "https://api.sandbox.ewaypayments.com/"
8
- self.live_url = "https://api.ewaypayments.com/"
6
+ self.test_url = 'https://api.sandbox.ewaypayments.com/'
7
+ self.live_url = 'https://api.ewaypayments.com/'
9
8
 
10
9
  self.money_format = :cents
11
- self.supported_countries = ["AU"]
12
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
13
- self.homepage_url = "http://www.eway.com.au/"
14
- self.display_name = "eWAY Rapid 3.0"
15
- self.default_currency = "AUD"
10
+ self.supported_countries = ['AU', 'NZ', 'GB', 'SG', 'MY', 'HK']
11
+ self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
12
+ self.homepage_url = 'http://www.eway.com.au/'
13
+ self.display_name = 'eWAY Rapid 3.1'
14
+ self.default_currency = 'AUD'
15
+
16
+ class_attribute :partner_id
16
17
 
17
18
  def initialize(options = {})
18
19
  requires!(options, :login, :password)
19
20
  super
20
21
  end
21
22
 
22
- # Public: Run a purchase transaction. Treats the Rapid 3.0 transparent
23
- # redirect as an API endpoint in order to conform to the standard
24
- # ActiveMerchant #purchase API.
23
+ # Public: Run a purchase transaction.
25
24
  #
26
- # amount - The monetary amount of the transaction in cents.
27
- # options - A standard ActiveMerchant options hash:
28
- # :order_id - A merchant-supplied identifier for the
29
- # transaction (optional).
30
- # :description - A merchant-supplied description of the
31
- # transaction (optional).
32
- # :currency - Three letter currency code for the
33
- # transaction (default: "AUD")
34
- # :billing_address - Standard ActiveMerchant address hash
35
- # (optional).
36
- # :shipping_address - Standard ActiveMerchant address hash
37
- # (optional).
38
- # :ip - The ip of the consumer initiating the
39
- # transaction (optional).
40
- # :application_id - A string identifying the application
41
- # submitting the transaction
42
- # (default: "https://github.com/Shopify/active_merchant")
25
+ # amount - The monetary amount of the transaction in cents.
26
+ # payment_method - The payment method or authorization token returned from store.
27
+ # options - A standard ActiveMerchant options hash:
28
+ # :transaction_type - One of: Purchase (default), MOTO
29
+ # or Recurring. For stored card payments (aka - TokenPayments),
30
+ # this must be either MOTO or Recurring.
31
+ # :invoice - The merchant’s invoice number for this
32
+ # transaction (optional).
33
+ # :order_id - A merchant-supplied identifier for the
34
+ # transaction (optional).
35
+ # :description - A merchant-supplied description of the
36
+ # transaction (optional).
37
+ # :currency - Three letter currency code for the
38
+ # transaction (default: "AUD")
39
+ # :billing_address - Standard ActiveMerchant address hash
40
+ # (optional).
41
+ # :shipping_address - Standard ActiveMerchant address hash
42
+ # (optional).
43
+ # :ip - The ip of the consumer initiating the
44
+ # transaction (optional).
45
+ # :application_id - A string identifying the application
46
+ # submitting the transaction
47
+ # (default: "https://github.com/activemerchant/active_merchant")
43
48
  #
44
- # Returns an ActiveMerchant::Billing::Response object
49
+ # Returns an ActiveMerchant::Billing::Response object where authorization is the Transaction ID on success
45
50
  def purchase(amount, payment_method, options={})
46
- MultiResponse.new.tap do |r|
47
- # Rather than follow the redirect, we detect the 302 and capture the
48
- # token out of the Location header in the run_purchase step. But we
49
- # still need a placeholder url to pass to eWay, and that is what
50
- # example.com is used for here.
51
- r.process{setup_purchase(amount, options.merge(:redirect_url => "http://example.com/"))}
52
- r.process{run_purchase(r.authorization, payment_method, r.params["formactionurl"])}
53
- r.process{status(r.authorization)}
54
- end
51
+ params = {}
52
+ add_metadata(params, options)
53
+ add_invoice(params, amount, options)
54
+ add_customer_data(params, options)
55
+ add_credit_card(params, payment_method, options)
56
+ params['Method'] = payment_method.respond_to?(:number) ? 'ProcessPayment' : 'TokenPayment'
57
+ commit(url_for('Transaction'), params)
55
58
  end
56
59
 
57
- # Public: Acquire the token necessary to run a transparent redirect.
58
- #
59
- # amount - The monetary amount of the transaction in cents.
60
- # options - A supplemented ActiveMerchant options hash:
61
- # :redirect_url - The url to return the customer to after
62
- # the transparent redirect is completed
63
- # (required).
64
- # :order_id - A merchant-supplied identifier for the
65
- # transaction (optional).
66
- # :description - A merchant-supplied description of the
67
- # transaction (optional).
68
- # :currency - Three letter currency code for the
69
- # transaction (default: "AUD")
70
- # :billing_address - Standard ActiveMerchant address hash
71
- # (optional).
72
- # :shipping_address - Standard ActiveMerchant address hash
73
- # (optional).
74
- # :ip - The ip of the consumer initiating the
75
- # transaction (optional).
76
- # :application_id - A string identifying the application
77
- # submitting the transaction
78
- # (default: "https://github.com/Shopify/active_merchant")
79
- #
80
- # Returns an EwayRapidResponse object, which conforms to the
81
- # ActiveMerchant::Billing::Response API, but also exposes #form_url.
82
- def setup_purchase(amount, options={})
83
- requires!(options, :redirect_url)
84
- request = build_xml_request("CreateAccessCodeRequest") do |doc|
85
- add_metadata(doc, options)
86
- add_invoice(doc, amount, options)
87
- add_customer_data(doc, options)
88
- end
60
+ def authorize(amount, payment_method, options={})
61
+ params = {}
62
+ add_metadata(params, options)
63
+ add_invoice(params, amount, options)
64
+ add_customer_data(params, options)
65
+ add_credit_card(params, payment_method, options)
66
+ params['Method'] = 'Authorise'
67
+ commit(url_for('Authorisation'), params)
68
+ end
69
+
70
+ def capture(amount, identification, options = {})
71
+ params = {}
72
+ add_metadata(params, options)
73
+ add_invoice(params, amount, options)
74
+ add_reference(params, identification)
75
+ commit(url_for('CapturePayment'), params)
76
+ end
89
77
 
90
- commit(url_for("CreateAccessCode"), request)
78
+ def void(identification, options = {})
79
+ params = {}
80
+ add_reference(params, identification)
81
+ commit(url_for('CancelAuthorisation'), params)
91
82
  end
92
83
 
93
- # Public: Retrieve the status of a transaction.
84
+ # Public: Refund a transaction.
94
85
  #
95
- # identification - The Eway Rapid 3.0 access code for the transaction
96
- # (returned as the response.authorization by
97
- # #setup_purchase).
86
+ # amount - The monetary amount of the transaction in cents
87
+ # identification - The transaction id which is returned in the
88
+ # authorization of the successful purchase transaction
89
+ # options - A standard ActiveMerchant options hash:
90
+ # :invoice - The merchant’s invoice number for this
91
+ # transaction (optional).
92
+ # :order_id - A merchant-supplied identifier for the
93
+ # transaction (optional).
94
+ # :description - A merchant-supplied description of the
95
+ # transaction (optional).
96
+ # :currency - Three letter currency code for the
97
+ # transaction (default: "AUD")
98
+ # :billing_address - Standard ActiveMerchant address hash
99
+ # (optional).
100
+ # :shipping_address - Standard ActiveMerchant address hash
101
+ # (optional).
102
+ # :ip - The ip of the consumer initiating the
103
+ # transaction (optional).
104
+ # :application_id - A string identifying the application
105
+ # submitting the transaction
106
+ # (default: "https://github.com/activemerchant/active_merchant")
98
107
  #
99
- # Returns an EwayRapidResponse object.
100
- def status(identification)
101
- request = build_xml_request("GetAccessCodeResultRequest") do |doc|
102
- doc.AccessCode identification
103
- end
104
- commit(url_for("GetAccessCodeResult"), request)
108
+ # Returns an ActiveMerchant::Billing::Response object
109
+ def refund(amount, identification, options = {})
110
+ params = {}
111
+ add_metadata(params, options)
112
+ add_invoice(params, amount, options, 'Refund')
113
+ add_reference(params['Refund'], identification)
114
+ add_customer_data(params, options)
115
+ commit(url_for("Transaction/#{identification}/Refund"), params)
105
116
  end
106
117
 
107
118
  # Public: Store card details and return a valid token
108
119
  #
109
- # options - A supplemented ActiveMerchant options hash:
110
- # :order_id - A merchant-supplied identifier for the
111
- # transaction (optional).
112
- # :billing_address - Standard ActiveMerchant address hash
113
- # (required).
114
- # :ip - The ip of the consumer initiating the
115
- # transaction (optional).
116
- # :application_id - A string identifying the application
117
- # submitting the transaction
118
- # (default: "https://github.com/Shopify/active_merchant")
120
+ # payment_method - The payment method or nil if :customer_token is provided
121
+ # options - A supplemented ActiveMerchant options hash:
122
+ # :order_id - A merchant-supplied identifier for the
123
+ # transaction (optional).
124
+ # :description - A merchant-supplied description of the
125
+ # transaction (optional).
126
+ # :billing_address - Standard ActiveMerchant address hash
127
+ # (required).
128
+ # :ip - The ip of the consumer initiating the
129
+ # transaction (optional).
130
+ # :application_id - A string identifying the application
131
+ # submitting the transaction
132
+ # (default: "https://github.com/activemerchant/active_merchant")
133
+ #
134
+ # Returns an ActiveMerchant::Billing::Response object where the authorization is the customer_token on success
119
135
  def store(payment_method, options = {})
120
136
  requires!(options, :billing_address)
121
- purchase(0, payment_method, options.merge(:request_method => "CreateTokenCustomer"))
137
+ params = {}
138
+ add_metadata(params, options)
139
+ add_invoice(params, 0, options)
140
+ add_customer_data(params, options)
141
+ add_credit_card(params, payment_method, options)
142
+ params['Method'] = 'CreateTokenCustomer'
143
+ commit(url_for('Transaction'), params)
122
144
  end
123
145
 
124
- private
125
-
126
- def run_purchase(identification, payment_method, endpoint)
127
- post = {
128
- "accesscode" => identification
129
- }
130
- add_credit_card(post, payment_method)
146
+ # Public: Update a customer's data
147
+ #
148
+ # customer_token - The customer token returned in the authorization of
149
+ # a successful store transaction.
150
+ # payment_method - The payment method or nil if :customer_token is provided
151
+ # options - A supplemented ActiveMerchant options hash:
152
+ # :order_id - A merchant-supplied identifier for the
153
+ # transaction (optional).
154
+ # :description - A merchant-supplied description of the
155
+ # transaction (optional).
156
+ # :billing_address - Standard ActiveMerchant address hash
157
+ # (optional).
158
+ # :ip - The ip of the consumer initiating the
159
+ # transaction (optional).
160
+ # :application_id - A string identifying the application
161
+ # submitting the transaction
162
+ # (default: "https://github.com/activemerchant/active_merchant")
163
+ #
164
+ # Returns an ActiveMerchant::Billing::Response object where the authorization is the customer_token on success
165
+ def update(customer_token, payment_method, options = {})
166
+ params = {}
167
+ add_metadata(params, options)
168
+ add_invoice(params, 0, options)
169
+ add_customer_data(params, options)
170
+ add_credit_card(params, payment_method, options)
171
+ add_customer_token(params, customer_token)
172
+ params['Method'] = 'UpdateTokenCustomer'
173
+ commit(url_for('Transaction'), params)
174
+ end
131
175
 
132
- commit_form(endpoint, build_form_request(post), :identification => identification)
176
+ def supports_scrubbing
177
+ true
133
178
  end
134
179
 
135
- def add_metadata(doc, options)
136
- doc.RedirectUrl(options[:redirect_url])
137
- doc.CustomerIP options[:ip] if options[:ip]
138
- doc.Method options[:request_method] || "ProcessPayment"
139
- doc.DeviceID(options[:application_id] || application_id)
180
+ def scrub(transcript)
181
+ transcript.
182
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
183
+ gsub(%r(("Number\\?":\\?")[^"]*)i, '\1[FILTERED]').
184
+ gsub(%r(("CVN\\?":\\?"?)[^",]*)i, '\1[FILTERED]')
140
185
  end
141
186
 
142
- def add_invoice(doc, money, options)
143
- doc.Payment do
144
- currency_code = options[:currency] || currency(money)
145
- doc.TotalAmount localized_amount(money, currency_code)
146
- doc.InvoiceReference options[:order_id]
147
- doc.InvoiceDescription options[:description]
148
- doc.CurrencyCode currency_code
187
+ private
188
+
189
+ def add_metadata(params, options)
190
+ params['RedirectUrl'] = options[:redirect_url] || 'http://example.com'
191
+ params['CustomerIP'] = options[:ip] if options[:ip]
192
+ params['TransactionType'] = options[:transaction_type] || 'Purchase'
193
+ params['DeviceID'] = options[:application_id] || application_id
194
+ if partner = options[:partner_id] || partner_id
195
+ params['PartnerID'] = truncate(partner, 50)
149
196
  end
197
+ params
150
198
  end
151
199
 
152
- def add_customer_data(doc, options)
153
- doc.Customer do
154
- add_address(doc, (options[:billing_address] || options[:address]), {:email => options[:email]})
155
- end
156
- doc.ShippingAddress do
157
- add_address(doc, options[:shipping_address], {:skip_company => true})
158
- end
200
+ def add_invoice(params, money, options, key = 'Payment')
201
+ currency_code = options[:currency] || currency(money)
202
+ params[key] = {
203
+ 'TotalAmount' => localized_amount(money, currency_code),
204
+ 'InvoiceReference' => truncate(options[:order_id], 50),
205
+ 'InvoiceNumber' => truncate(options[:invoice] || options[:order_id], 12),
206
+ 'InvoiceDescription' => truncate(options[:description], 64),
207
+ 'CurrencyCode' => currency_code,
208
+ }
159
209
  end
160
210
 
161
- def add_address(doc, address, options={})
162
- return unless address
163
- if name = address[:name]
164
- parts = name.split(/\s+/)
165
- doc.FirstName parts.shift if parts.size > 1
166
- doc.LastName parts.join(" ")
167
- end
168
- doc.Title address[:title]
169
- doc.CompanyName address[:company] unless options[:skip_company]
170
- doc.Street1 address[:address1]
171
- doc.Street2 address[:address2]
172
- doc.City address[:city]
173
- doc.State address[:state]
174
- doc.PostalCode address[:zip]
175
- doc.Country address[:country].to_s.downcase
176
- doc.Phone address[:phone]
177
- doc.Fax address[:fax]
178
- doc.Email options[:email]
211
+ def add_reference(params, reference)
212
+ params['TransactionID'] = reference
179
213
  end
180
214
 
181
- def add_credit_card(post, credit_card)
182
- post["cardname"] = credit_card.name
183
- post["cardnumber"] = credit_card.number
184
- post["cardexpirymonth"] = credit_card.month
185
- post["cardexpiryyear"] = credit_card.year
186
- post["cardcvn"] = credit_card.verification_value
215
+ def add_customer_data(params, options)
216
+ params['Customer'] ||= {}
217
+ add_address(params['Customer'], (options[:billing_address] || options[:address]), {:email => options[:email]})
218
+ params['ShippingAddress'] = {}
219
+ add_address(params['ShippingAddress'], options[:shipping_address], {:skip_company => true})
187
220
  end
188
221
 
189
- def build_xml_request(root)
190
- builder = Nokogiri::XML::Builder.new
191
- builder.__send__(root) do |doc|
192
- yield(doc)
193
- end
194
- builder.to_xml
222
+ def add_address(params, address, options={})
223
+ return unless address
224
+
225
+ params['FirstName'], params['LastName'] = split_names(address[:name])
226
+ params['Title'] = address[:title]
227
+ params['CompanyName'] = address[:company] unless options[:skip_company]
228
+ params['Street1'] = truncate(address[:address1], 50)
229
+ params['Street2'] = truncate(address[:address2], 50)
230
+ params['City'] = truncate(address[:city], 50)
231
+ params['State'] = address[:state]
232
+ params['PostalCode'] = address[:zip]
233
+ params['Country'] = address[:country].to_s.downcase
234
+ params['Phone'] = address[:phone]
235
+ params['Fax'] = address[:fax]
236
+ params['Email'] = options[:email]
195
237
  end
196
238
 
197
- def build_form_request(post)
198
- request = []
199
- post.each do |key, value|
200
- request << "EWAY_#{key.upcase}=#{CGI.escape(value.to_s)}"
239
+ def add_credit_card(params, credit_card, options)
240
+ return unless credit_card
241
+ params['Customer'] ||= {}
242
+ if credit_card.respond_to? :number
243
+ card_details = params['Customer']['CardDetails'] = {}
244
+ card_details['Name'] = truncate(credit_card.name, 50)
245
+ card_details['Number'] = credit_card.number
246
+ card_details['ExpiryMonth'] = '%02d' % (credit_card.month || 0)
247
+ card_details['ExpiryYear'] = '%02d' % (credit_card.year || 0)
248
+ card_details['CVN'] = credit_card.verification_value
249
+ else
250
+ add_customer_token(params, credit_card)
201
251
  end
202
- request.join("&")
252
+ end
253
+
254
+ def add_customer_token(params, token)
255
+ params['Customer'] ||= {}
256
+ params['Customer']['TokenCustomerID'] = token
203
257
  end
204
258
 
205
259
  def url_for(action)
206
- (test? ? test_url : live_url) + action + ".xml"
260
+ (test? ? test_url : live_url) + action
207
261
  end
208
262
 
209
- def commit(url, request, form_post=false)
263
+ def commit(url, params)
210
264
  headers = {
211
- "Authorization" => ("Basic " + Base64.strict_encode64(@options[:login].to_s + ":" + @options[:password].to_s).chomp),
212
- "Content-Type" => "text/xml"
265
+ 'Authorization' => ('Basic ' + Base64.strict_encode64(@options[:login].to_s + ':' + @options[:password].to_s).chomp),
266
+ 'Content-Type' => 'application/json'
213
267
  }
214
-
268
+ request = params.to_json
215
269
  raw = parse(ssl_post(url, request, headers))
216
270
 
217
271
  succeeded = success?(raw)
218
- EwayRapidResponse.new(
272
+ ActiveMerchant::Billing::Response.new(
219
273
  succeeded,
220
274
  message_from(succeeded, raw),
221
275
  raw,
@@ -225,100 +279,154 @@ module ActiveMerchant #:nodoc:
225
279
  :cvv_result => cvv_result_from(raw)
226
280
  )
227
281
  rescue ActiveMerchant::ResponseError => e
228
- return EwayRapidResponse.new(false, e.response.message, {:status_code => e.response.code}, :test => test?)
229
- end
230
-
231
- def commit_form(url, request, parameters)
232
- http_response = raw_ssl_request(:post, url, request)
233
-
234
- success = (http_response.code.to_s == "302")
235
- message = (success ? "Succeeded" : http_response.body)
236
- authorization = parameters[:identification] if success
237
-
238
- Response.new(success, message, {:location => http_response["Location"]}, :authorization => authorization, :test => test?)
282
+ return ActiveMerchant::Billing::Response.new(false, e.response.message, {:status_code => e.response.code}, :test => test?)
239
283
  end
240
284
 
241
- def parse(xml)
242
- response = {}
243
-
244
- doc = Nokogiri::XML(xml)
245
- doc.root.xpath("*").each do |node|
246
- if (node.elements.size == 0)
247
- response[node.name.downcase.to_sym] = node.text
248
- else
249
- node.elements.each do |childnode|
250
- name = "#{node.name.downcase}_#{childnode.name.downcase}"
251
- response[name.to_sym] = childnode.text
252
- end
253
- end
254
- end unless doc.root.nil?
255
-
256
- response
285
+ def parse(data)
286
+ JSON.parse(data)
257
287
  end
258
288
 
259
289
  def success?(response)
260
- if response[:errors]
261
- false
262
- elsif response[:responsecode] == "00"
290
+ if response['ResponseCode'] == '00'
263
291
  true
264
- elsif response[:transactionstatus]
265
- (response[:transactionstatus] == "true")
292
+ elsif response['TransactionStatus']
293
+ (response['TransactionStatus'] == true)
294
+ elsif response['Succeeded']
295
+ (response['Succeeded'] == true)
266
296
  else
267
- true
297
+ false
268
298
  end
269
299
  end
270
300
 
301
+ def parse_errors(message)
302
+ errors = message.split(',').collect { |code| MESSAGES[code.strip] }.flatten.join(',')
303
+ errors.presence || message
304
+ end
305
+
271
306
  def message_from(succeeded, response)
272
- if response[:errors]
273
- (MESSAGES[response[:errors]] || response[:errors])
274
- elsif response[:responsecode]
275
- ActiveMerchant::Billing::EwayGateway::MESSAGES[response[:responsecode]]
276
- elsif response[:responsemessage]
277
- (MESSAGES[response[:responsemessage]] || response[:responsemessage])
307
+ if response['Errors']
308
+ parse_errors(response['Errors'])
309
+ elsif response['ResponseMessage']
310
+ parse_errors(response['ResponseMessage'])
311
+ elsif response['ResponseCode']
312
+ ActiveMerchant::Billing::EwayGateway::MESSAGES[response['ResponseCode']]
278
313
  elsif succeeded
279
- "Succeeded"
314
+ 'Succeeded'
280
315
  else
281
- "Failed"
316
+ 'Failed'
282
317
  end
283
318
  end
284
319
 
285
320
  def authorization_from(response)
286
- response[:accesscode]
321
+ # Note: TransactionID is always null for store requests, but TokenCustomerID is also sent back for purchase from
322
+ # stored card transactions so we give precedence to TransactionID
323
+ response['TransactionID'] || response['Customer']['TokenCustomerID']
287
324
  end
288
325
 
289
326
  def avs_result_from(response)
290
- code = case response[:verification_address]
291
- when "Valid"
292
- "M"
293
- when "Invalid"
294
- "N"
327
+ verification = response['Verification'] || {}
328
+ code = case verification['Address']
329
+ when 'Valid'
330
+ 'M'
331
+ when 'Invalid'
332
+ 'N'
295
333
  else
296
- "I"
334
+ 'I'
297
335
  end
298
336
  {:code => code}
299
337
  end
300
338
 
301
339
  def cvv_result_from(response)
302
- case response[:verification_cvn]
303
- when "Valid"
304
- "M"
305
- when "Invalid"
306
- "N"
340
+ verification = response['Verification'] || {}
341
+ case verification['CVN']
342
+ when 'Valid'
343
+ 'M'
344
+ when 'Invalid'
345
+ 'N'
307
346
  else
308
- "P"
309
- end
310
- end
311
-
312
- class EwayRapidResponse < ActiveMerchant::Billing::Response
313
- def form_url
314
- params["formactionurl"]
347
+ 'P'
315
348
  end
316
349
  end
317
350
 
318
351
  MESSAGES = {
352
+ 'A2000' => 'Transaction Approved Successful',
353
+ 'A2008' => 'Honour With Identification Successful',
354
+ 'A2010' => 'Approved For Partial Amount Successful',
355
+ 'A2011' => 'Approved, VIP Successful',
356
+ 'A2016' => 'Approved, Update Track 3 Successful',
357
+ 'D4401' => 'Refer to Issuer Failed',
358
+ 'D4402' => 'Refer to Issuer, special Failed',
359
+ 'D4403' => 'No Merchant Failed',
360
+ 'D4404' => 'Pick Up Card Failed',
361
+ 'D4405' => 'Do Not Honour Failed',
362
+ 'D4406' => 'Error Failed',
363
+ 'D4407' => 'Pick Up Card, Special Failed',
364
+ 'D4409' => 'Request In Progress Failed',
365
+ 'D4412' => 'Invalid Transaction Failed',
366
+ 'D4413' => 'Invalid Amount Failed',
367
+ 'D4414' => 'Invalid Card Number Failed',
368
+ 'D4415' => 'No Issuer Failed',
369
+ 'D4419' => 'Re-enter Last Transaction Failed',
370
+ 'D4421' => 'No Action Taken Failed',
371
+ 'D4422' => 'Suspected Malfunction Failed',
372
+ 'D4423' => 'Unacceptable Transaction Fee Failed',
373
+ 'D4425' => 'Unable to Locate Record On File Failed',
374
+ 'D4430' => 'Format Error Failed ',
375
+ 'D4431' => 'Bank Not Supported By Switch Failed',
376
+ 'D4433' => 'Expired Card, Capture Failed ',
377
+ 'D4434' => 'Suspected Fraud, Retain Card Failed',
378
+ 'D4435' => 'Card Acceptor, Contact Acquirer, Retain Card Failed',
379
+ 'D4436' => 'Restricted Card, Retain Card Failed',
380
+ 'D4437' => 'Contact Acquirer Security Department, Retain Card Failed',
381
+ 'D4438' => 'PIN Tries Exceeded, Capture Failed',
382
+ 'D4439' => 'No Credit Account Failed',
383
+ 'D4440' => 'Function Not Supported Failed',
384
+ 'D4441' => 'Lost Card Failed',
385
+ 'D4442' => 'No Universal Account Failed',
386
+ 'D4443' => 'Stolen Card Failed',
387
+ 'D4444' => 'No Investment Account Failed',
388
+ 'D4451' => 'Insufficient Funds Failed',
389
+ 'D4452' => 'No Cheque Account Failed',
390
+ 'D4453' => 'No Savings Account Failed',
391
+ 'D4454' => 'Expired Card Failed',
392
+ 'D4455' => 'Incorrect PIN Failed',
393
+ 'D4456' => 'No Card Record Failed',
394
+ 'D4457' => 'Function Not Permitted to Cardholder Failed',
395
+ 'D4458' => 'Function Not Permitted to Terminal Failed',
396
+ 'D4459' => 'Suspected Fraud Failed',
397
+ 'D4460' => 'Acceptor Contact Acquirer Failed',
398
+ 'D4461' => 'Exceeds Withdrawal Limit Failed',
399
+ 'D4462' => 'Restricted Card Failed',
400
+ 'D4463' => 'Security Violation Failed',
401
+ 'D4464' => 'Original Amount Incorrect Failed',
402
+ 'D4466' => 'Acceptor Contact Acquirer, Security Failed',
403
+ 'D4467' => 'Capture Card Failed',
404
+ 'D4475' => 'PIN Tries Exceeded Failed',
405
+ 'D4482' => 'CVV Validation Error Failed',
406
+ 'D4490' => 'Cut off In Progress Failed',
407
+ 'D4491' => 'Card Issuer Unavailable Failed',
408
+ 'D4492' => 'Unable To Route Transaction Failed',
409
+ 'D4493' => 'Cannot Complete, Violation Of The Law Failed',
410
+ 'D4494' => 'Duplicate Transaction Failed',
411
+ 'D4496' => 'System Error Failed',
412
+ 'D4497' => 'MasterPass Error Failed',
413
+ 'D4498' => 'PayPal Create Transaction Error Failed',
414
+ 'D4499' => 'Invalid Transaction for Auth/Void Failed',
415
+ 'S5000' => 'System Error',
416
+ 'S5011' => 'PayPal Connection Error',
417
+ 'S5012' => 'PayPal Settings Error',
418
+ 'S5085' => 'Started 3dSecure',
419
+ 'S5086' => 'Routed 3dSecure',
420
+ 'S5087' => 'Completed 3dSecure',
421
+ 'S5088' => 'PayPal Transaction Created',
422
+ 'S5099' => 'Incomplete (Access Code in progress/incomplete)',
423
+ 'S5010' => 'Unknown error returned by gateway',
319
424
  'V6000' => 'Validation error',
320
425
  'V6001' => 'Invalid CustomerIP',
321
426
  'V6002' => 'Invalid DeviceID',
427
+ 'V6003' => 'Invalid Request PartnerID',
428
+ 'V6004' => 'Invalid Request Method',
429
+ 'V6010' => 'Invalid TransactionType, account not certified for eCome only MOTO or Recurring available',
322
430
  'V6011' => 'Invalid Payment TotalAmount',
323
431
  'V6012' => 'Invalid Payment InvoiceDescription',
324
432
  'V6013' => 'Invalid Payment InvoiceNumber',
@@ -338,13 +446,14 @@ module ActiveMerchant #:nodoc:
338
446
  'V6042' => 'Customer FirstName Required',
339
447
  'V6043' => 'Customer LastName Required',
340
448
  'V6044' => 'Customer CountryCode Required',
341
- 'V6045' => 'Customer Title Required',
449
+ 'V6045' => 'Customer Title Required ',
342
450
  'V6046' => 'TokenCustomerID Required',
343
451
  'V6047' => 'RedirectURL Required',
452
+ 'V6048' => 'Invalid Checkout URL',
344
453
  'V6051' => 'Invalid Customer FirstName',
345
454
  'V6052' => 'Invalid Customer LastName',
346
455
  'V6053' => 'Invalid Customer CountryCode',
347
- 'V6058' => 'Invalid Customer Title',
456
+ 'V6058' => 'Invalid Customer Title ',
348
457
  'V6059' => 'Invalid RedirectURL',
349
458
  'V6060' => 'Invalid TokenCustomerID',
350
459
  'V6061' => 'Invalid Customer Reference',
@@ -355,7 +464,7 @@ module ActiveMerchant #:nodoc:
355
464
  'V6066' => 'Invalid Customer City',
356
465
  'V6067' => 'Invalid Customer State',
357
466
  'V6068' => 'Invalid Customer PostalCode',
358
- 'V6069' => 'Invalid Customer Email',
467
+ 'V6069' => 'Invalid Customer Email ',
359
468
  'V6070' => 'Invalid Customer Phone',
360
469
  'V6071' => 'Invalid Customer Mobile',
361
470
  'V6072' => 'Invalid Customer Comments',
@@ -372,20 +481,52 @@ module ActiveMerchant #:nodoc:
372
481
  'V6083' => 'Invalid ShippingAddress Phone',
373
482
  'V6084' => 'Invalid ShippingAddress Country',
374
483
  'V6085' => 'Invalid ShippingAddress ShippingMethod',
375
- 'V6086' => 'Invalid ShippingAddress Fax ',
484
+ 'V6086' => 'Invalid ShippingAddress Fax',
376
485
  'V6091' => 'Unknown Customer CountryCode',
377
486
  'V6092' => 'Unknown ShippingAddress CountryCode',
378
487
  'V6100' => 'Invalid EWAY_CARDNAME',
379
488
  'V6101' => 'Invalid EWAY_CARDEXPIRYMONTH',
380
- 'V6102' => 'Invalid EWAY_CARDEXPIRYYEAR',
489
+ 'V6102' => 'Invalid EWAY_CARDEXPIRYYEAR ',
381
490
  'V6103' => 'Invalid EWAY_CARDSTARTMONTH',
382
491
  'V6104' => 'Invalid EWAY_CARDSTARTYEAR',
383
- 'V6105' => 'Invalid EWAY_CARDISSUENUMBER',
492
+ 'V6105' => 'Invalid EWAY_CARDISSUENUMBER ',
384
493
  'V6106' => 'Invalid EWAY_CARDCVN',
385
494
  'V6107' => 'Invalid EWAY_ACCESSCODE',
386
495
  'V6108' => 'Invalid CustomerHostAddress',
387
496
  'V6109' => 'Invalid UserAgent',
388
- 'V6110' => 'Invalid EWAY_CARDNUMBER'
497
+ 'V6110' => 'Invalid EWAY_CARDNUMBER',
498
+ 'V6111' => 'Unauthorised API Access, Account Not PCI Certified',
499
+ 'V6112' => 'Redundant card details other than expiry year and month',
500
+ 'V6113' => 'Invalid transaction for refund',
501
+ 'V6114' => 'Gateway validation error',
502
+ 'V6115' => 'Invalid DirectRefundRequest, Transaction ID',
503
+ 'V6116' => 'Invalid card data on original TransactionID',
504
+ 'V6117' => 'Invalid CreateAccessCodeSharedRequest, FooterText',
505
+ 'V6118' => 'Invalid CreateAccessCodeSharedRequest, HeaderText',
506
+ 'V6119' => 'Invalid CreateAccessCodeSharedRequest, Language',
507
+ 'V6120' => 'Invalid CreateAccessCodeSharedRequest, LogoUrl ',
508
+ 'V6121' => 'Invalid TransactionSearch, Filter Match Type',
509
+ 'V6122' => 'Invalid TransactionSearch, Non numeric Transaction ID',
510
+ 'V6123' => 'Invalid TransactionSearch,no TransactionID or AccessCode specified',
511
+ 'V6124' => 'Invalid Line Items. The line items have been provided however the totals do not match the TotalAmount field',
512
+ 'V6125' => 'Selected Payment Type not enabled',
513
+ 'V6126' => 'Invalid encrypted card number, decryption failed',
514
+ 'V6127' => 'Invalid encrypted cvn, decryption failed',
515
+ 'V6128' => 'Invalid Method for Payment Type',
516
+ 'V6129' => 'Transaction has not been authorised for Capture/Cancellation',
517
+ 'V6130' => 'Generic customer information error ',
518
+ 'V6131' => 'Generic shipping information error',
519
+ 'V6132' => 'Transaction has already been completed or voided, operation not permitted',
520
+ 'V6133' => 'Checkout not available for Payment Type',
521
+ 'V6134' => 'Invalid Auth Transaction ID for Capture/Void',
522
+ 'V6135' => 'PayPal Error Processing Refund',
523
+ 'V6140' => 'Merchant account is suspended',
524
+ 'V6141' => 'Invalid PayPal account details or API signature',
525
+ 'V6142' => 'Authorise not available for Bank/Branch',
526
+ 'V6150' => 'Invalid Refund Amount',
527
+ 'V6151' => 'Refund amount greater than original transaction',
528
+ 'V6152' => 'Original transaction already refunded for total amount',
529
+ 'V6153' => 'Card type not support by merchant',
389
530
  }
390
531
  end
391
532
  end