activemerchant 1.45.0 → 1.126.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (288) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG +2167 -2
  3. data/CONTRIBUTORS +57 -0
  4. data/README.md +62 -41
  5. data/lib/active_merchant/billing/avs_result.rb +25 -28
  6. data/lib/active_merchant/billing/base.rb +11 -35
  7. data/lib/active_merchant/billing/check.rb +28 -24
  8. data/lib/active_merchant/billing/compatibility.rb +10 -12
  9. data/lib/active_merchant/billing/credit_card.rb +141 -69
  10. data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
  11. data/lib/active_merchant/billing/credit_card_methods.rb +348 -52
  12. data/lib/active_merchant/billing/cvv_result.rb +0 -1
  13. data/lib/active_merchant/billing/gateway.rb +125 -61
  14. data/lib/active_merchant/billing/gateways/adyen.rb +633 -127
  15. data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
  16. data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
  17. data/lib/active_merchant/billing/gateways/authorize_net.rb +883 -195
  18. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
  19. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -103
  20. data/lib/active_merchant/billing/gateways/axcessms.rb +179 -0
  21. data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
  22. data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
  23. data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
  24. data/lib/active_merchant/billing/gateways/banwire.rb +24 -13
  25. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
  26. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
  27. data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
  28. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +143 -62
  29. data/lib/active_merchant/billing/gateways/beanstream.rb +45 -13
  30. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +13 -10
  31. data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -506
  32. data/lib/active_merchant/billing/gateways/blue_snap.rb +623 -0
  33. data/lib/active_merchant/billing/gateways/bogus.rb +82 -36
  34. data/lib/active_merchant/billing/gateways/borgun.rb +61 -40
  35. data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
  36. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +21 -2
  37. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
  38. data/lib/active_merchant/billing/gateways/braintree.rb +3 -3
  39. data/lib/active_merchant/billing/gateways/braintree_blue.rb +592 -203
  40. data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -4
  41. data/lib/active_merchant/billing/gateways/bridge_pay.rb +116 -61
  42. data/lib/active_merchant/billing/gateways/cams.rb +230 -0
  43. data/lib/active_merchant/billing/gateways/card_connect.rb +320 -0
  44. data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
  45. data/lib/active_merchant/billing/gateways/card_stream.rb +248 -97
  46. data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
  47. data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
  48. data/lib/active_merchant/billing/gateways/cashnet.rb +70 -26
  49. data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
  50. data/lib/active_merchant/billing/gateways/cecabank.rb +73 -53
  51. data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
  52. data/lib/active_merchant/billing/gateways/checkout.rb +32 -33
  53. data/lib/active_merchant/billing/gateways/checkout_v2.rb +340 -0
  54. data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
  55. data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
  56. data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
  57. data/lib/active_merchant/billing/gateways/conekta.rb +55 -34
  58. data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
  59. data/lib/active_merchant/billing/gateways/credorax.rb +506 -0
  60. data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
  61. data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
  62. data/lib/active_merchant/billing/gateways/cyber_source.rb +637 -221
  63. data/lib/active_merchant/billing/gateways/d_local.rb +303 -0
  64. data/lib/active_merchant/billing/gateways/data_cash.rb +57 -355
  65. data/lib/active_merchant/billing/gateways/decidir.rb +347 -0
  66. data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
  67. data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
  68. data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
  69. data/lib/active_merchant/billing/gateways/ebanx.rb +334 -0
  70. data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
  71. data/lib/active_merchant/billing/gateways/elavon.rb +377 -250
  72. data/lib/active_merchant/billing/gateways/element.rb +386 -0
  73. data/lib/active_merchant/billing/gateways/epay.rb +92 -71
  74. data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
  75. data/lib/active_merchant/billing/gateways/eway.rb +85 -73
  76. data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
  77. data/lib/active_merchant/billing/gateways/eway_rapid.rb +134 -80
  78. data/lib/active_merchant/billing/gateways/exact.rb +37 -36
  79. data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
  80. data/lib/active_merchant/billing/gateways/fat_zebra.rb +124 -74
  81. data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
  82. data/lib/active_merchant/billing/gateways/finansbank.rb +4 -5
  83. data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
  84. data/lib/active_merchant/billing/gateways/first_pay.rb +45 -23
  85. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +184 -87
  86. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
  87. data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
  88. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
  89. data/lib/active_merchant/billing/gateways/forte.rb +286 -0
  90. data/lib/active_merchant/billing/gateways/garanti.rb +31 -32
  91. data/lib/active_merchant/billing/gateways/global_collect.rb +507 -0
  92. data/lib/active_merchant/billing/gateways/global_transport.rb +25 -15
  93. data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
  94. data/lib/active_merchant/billing/gateways/hps.rb +252 -68
  95. data/lib/active_merchant/billing/gateways/iats_payments.rb +99 -38
  96. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
  97. data/lib/active_merchant/billing/gateways/inspire.rb +48 -48
  98. data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
  99. data/lib/active_merchant/billing/gateways/ipg.rb +415 -0
  100. data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
  101. data/lib/active_merchant/billing/gateways/iridium.rb +254 -244
  102. data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
  103. data/lib/active_merchant/billing/gateways/iveri.rb +254 -0
  104. data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
  105. data/lib/active_merchant/billing/gateways/jetpay.rb +200 -80
  106. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
  107. data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
  108. data/lib/active_merchant/billing/gateways/kushki.rb +277 -0
  109. data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
  110. data/lib/active_merchant/billing/gateways/linkpoint.rb +95 -85
  111. data/lib/active_merchant/billing/gateways/litle.rb +371 -94
  112. data/lib/active_merchant/billing/gateways/mastercard.rb +293 -0
  113. data/lib/active_merchant/billing/gateways/maxipago.rb +146 -123
  114. data/lib/active_merchant/billing/gateways/mercado_pago.rb +331 -0
  115. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +47 -23
  116. data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
  117. data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
  118. data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
  119. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +60 -44
  120. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +76 -23
  121. data/lib/active_merchant/billing/gateways/mercury.rb +73 -54
  122. data/lib/active_merchant/billing/gateways/metrics_global.rb +33 -43
  123. data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
  124. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
  125. data/lib/active_merchant/billing/gateways/migs.rb +101 -37
  126. data/lib/active_merchant/billing/gateways/mit.rb +260 -0
  127. data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
  128. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +30 -34
  129. data/lib/active_merchant/billing/gateways/moka.rb +290 -0
  130. data/lib/active_merchant/billing/gateways/monei.rb +422 -0
  131. data/lib/active_merchant/billing/gateways/moneris.rb +236 -72
  132. data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
  133. data/lib/active_merchant/billing/gateways/mundipagg.rb +363 -0
  134. data/lib/active_merchant/billing/gateways/nab_transact.rb +87 -68
  135. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
  136. data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
  137. data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
  138. data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
  139. data/lib/active_merchant/billing/gateways/netbilling.rb +82 -43
  140. data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
  141. data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
  142. data/lib/active_merchant/billing/gateways/nmi.rb +279 -174
  143. data/lib/active_merchant/billing/gateways/ogone.rb +96 -50
  144. data/lib/active_merchant/billing/gateways/omise.rb +323 -0
  145. data/lib/active_merchant/billing/gateways/openpay.rb +58 -23
  146. data/lib/active_merchant/billing/gateways/opp.rb +394 -0
  147. data/lib/active_merchant/billing/gateways/optimal_payment.rb +87 -69
  148. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
  149. data/lib/active_merchant/billing/gateways/orbital.rb +771 -328
  150. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +31 -32
  151. data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
  152. data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
  153. data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
  154. data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
  155. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +84 -68
  156. data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
  157. data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
  158. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
  159. data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
  160. data/lib/active_merchant/billing/gateways/pay_trace.rb +404 -0
  161. data/lib/active_merchant/billing/gateways/paybox_direct.rb +85 -49
  162. data/lib/active_merchant/billing/gateways/payeezy.rb +458 -0
  163. data/lib/active_merchant/billing/gateways/payex.rb +39 -42
  164. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +67 -41
  165. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
  166. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
  167. data/lib/active_merchant/billing/gateways/payflow.rb +215 -46
  168. data/lib/active_merchant/billing/gateways/payflow_express.rb +64 -68
  169. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
  170. data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
  171. data/lib/active_merchant/billing/gateways/payment_express.rb +78 -58
  172. data/lib/active_merchant/billing/gateways/paymentez.rb +353 -0
  173. data/lib/active_merchant/billing/gateways/paymill.rb +163 -75
  174. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -7
  175. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
  176. data/lib/active_merchant/billing/gateways/paypal.rb +37 -18
  177. data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
  178. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +5 -5
  179. data/lib/active_merchant/billing/gateways/paypal_express.rb +12 -6
  180. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
  181. data/lib/active_merchant/billing/gateways/paysafe.rb +412 -0
  182. data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
  183. data/lib/active_merchant/billing/gateways/paystation.rb +96 -91
  184. data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
  185. data/lib/active_merchant/billing/gateways/payu_latam.rb +479 -0
  186. data/lib/active_merchant/billing/gateways/payway.rb +27 -27
  187. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
  188. data/lib/active_merchant/billing/gateways/pin.rb +113 -37
  189. data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
  190. data/lib/active_merchant/billing/gateways/priority.rb +369 -0
  191. data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
  192. data/lib/active_merchant/billing/gateways/psigate.rb +55 -44
  193. data/lib/active_merchant/billing/gateways/psl_card.rb +32 -40
  194. data/lib/active_merchant/billing/gateways/qbms.rb +86 -76
  195. data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
  196. data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
  197. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
  198. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
  199. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
  200. data/lib/active_merchant/billing/gateways/quickpay.rb +10 -353
  201. data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
  202. data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
  203. data/lib/active_merchant/billing/gateways/realex.rb +154 -52
  204. data/lib/active_merchant/billing/gateways/redsys.rb +488 -161
  205. data/lib/active_merchant/billing/gateways/s5.rb +247 -0
  206. data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
  207. data/lib/active_merchant/billing/gateways/sage.rb +404 -133
  208. data/lib/active_merchant/billing/gateways/sage_pay.rb +145 -109
  209. data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
  210. data/lib/active_merchant/billing/gateways/secure_net.rb +62 -54
  211. data/lib/active_merchant/billing/gateways/secure_pay.rb +32 -42
  212. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +36 -27
  213. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
  214. data/lib/active_merchant/billing/gateways/securion_pay.rb +265 -0
  215. data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
  216. data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -54
  217. data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
  218. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
  219. data/lib/active_merchant/billing/gateways/spreedly_core.rb +108 -43
  220. data/lib/active_merchant/billing/gateways/stripe.rb +536 -120
  221. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +516 -0
  222. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +19 -25
  223. data/lib/active_merchant/billing/gateways/telr.rb +273 -0
  224. data/lib/active_merchant/billing/gateways/tns.rb +16 -217
  225. data/lib/active_merchant/billing/gateways/trans_first.rb +148 -34
  226. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
  227. data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
  228. data/lib/active_merchant/billing/gateways/transax.rb +6 -8
  229. data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
  230. data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
  231. data/lib/active_merchant/billing/gateways/trust_commerce.rb +162 -89
  232. data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
  233. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +332 -236
  234. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +185 -72
  235. data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
  236. data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
  237. data/lib/active_merchant/billing/gateways/viaklix.rb +19 -31
  238. data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
  239. data/lib/active_merchant/billing/gateways/vpos.rb +220 -0
  240. data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
  241. data/lib/active_merchant/billing/gateways/wepay.rb +108 -62
  242. data/lib/active_merchant/billing/gateways/wirecard.rb +52 -43
  243. data/lib/active_merchant/billing/gateways/wompi.rb +193 -0
  244. data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
  245. data/lib/active_merchant/billing/gateways/worldpay.rb +725 -121
  246. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
  247. data/lib/active_merchant/billing/gateways/worldpay_us.rb +79 -39
  248. data/lib/active_merchant/billing/gateways.rb +8 -11
  249. data/lib/active_merchant/billing/model.rb +2 -2
  250. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
  251. data/lib/active_merchant/billing/payment_token.rb +1 -1
  252. data/lib/active_merchant/billing/rails.rb +1 -1
  253. data/lib/active_merchant/billing/response.rb +19 -13
  254. data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
  255. data/lib/active_merchant/billing.rb +3 -0
  256. data/lib/active_merchant/connection.rb +196 -0
  257. data/lib/active_merchant/country.rb +13 -8
  258. data/lib/active_merchant/errors.rb +6 -0
  259. data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
  260. data/lib/active_merchant/network_connection_retries.rb +78 -0
  261. data/lib/active_merchant/post_data.rb +26 -0
  262. data/lib/active_merchant/posts_data.rb +92 -0
  263. data/lib/active_merchant/version.rb +1 -1
  264. data/lib/active_merchant.rb +14 -59
  265. data/lib/activemerchant.rb +1 -1
  266. data/lib/certs/cacert.pem +3214 -0
  267. data/lib/support/gateway_support.rb +8 -10
  268. data/lib/support/outbound_hosts.rb +13 -10
  269. data/lib/support/ssl_verify.rb +9 -14
  270. data/lib/support/ssl_version.rb +86 -0
  271. metadata +136 -94
  272. checksums.yaml.gz.sig +0 -1
  273. data/lib/active_merchant/billing/gateways/app55.rb +0 -176
  274. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
  275. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
  276. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
  277. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
  278. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
  279. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
  280. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -291
  281. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -87
  282. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
  283. data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
  284. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
  285. data/lib/active_merchant/billing/gateways/vindicia.rb +0 -385
  286. data/lib/active_merchant/offsite_payments_shim.rb +0 -19
  287. data.tar.gz.sig +0 -0
  288. metadata.gz.sig +0 -0
@@ -3,15 +3,15 @@ require 'json'
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class EwayRapidGateway < Gateway
6
- self.test_url = "https://api.sandbox.ewaypayments.com/"
7
- self.live_url = "https://api.ewaypayments.com/"
6
+ self.test_url = 'https://api.sandbox.ewaypayments.com/'
7
+ self.live_url = 'https://api.ewaypayments.com/'
8
8
 
9
9
  self.money_format = :cents
10
- self.supported_countries = ['AU', 'NZ', 'GB']
11
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
12
- self.homepage_url = "http://www.eway.com.au/"
13
- self.display_name = "eWAY Rapid 3.1"
14
- self.default_currency = "AUD"
10
+ self.supported_countries = %w[AU NZ GB SG MY HK]
11
+ self.supported_cardtypes = %i[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
15
 
16
16
  class_attribute :partner_id
17
17
 
@@ -28,6 +28,8 @@ module ActiveMerchant #:nodoc:
28
28
  # :transaction_type - One of: Purchase (default), MOTO
29
29
  # or Recurring. For stored card payments (aka - TokenPayments),
30
30
  # this must be either MOTO or Recurring.
31
+ # :invoice - The merchant’s invoice number for this
32
+ # transaction (optional).
31
33
  # :order_id - A merchant-supplied identifier for the
32
34
  # transaction (optional).
33
35
  # :description - A merchant-supplied description of the
@@ -42,24 +44,25 @@ module ActiveMerchant #:nodoc:
42
44
  # transaction (optional).
43
45
  # :application_id - A string identifying the application
44
46
  # submitting the transaction
45
- # (default: "https://github.com/Shopify/active_merchant")
47
+ # (default: "https://github.com/activemerchant/active_merchant")
46
48
  #
47
49
  # Returns an ActiveMerchant::Billing::Response object where authorization is the Transaction ID on success
48
- def purchase(amount, payment_method, options={})
50
+ def purchase(amount, payment_method, options = {})
49
51
  params = {}
50
52
  add_metadata(params, options)
51
53
  add_invoice(params, amount, options)
52
- add_customer_data(params, options)
54
+ add_customer_data(params, options, payment_method)
53
55
  add_credit_card(params, payment_method, options)
56
+ add_3ds_authenticated_data(params, options) if options[:three_d_secure]
54
57
  params['Method'] = payment_method.respond_to?(:number) ? 'ProcessPayment' : 'TokenPayment'
55
58
  commit(url_for('Transaction'), params)
56
59
  end
57
60
 
58
- def authorize(amount, payment_method, options={})
61
+ def authorize(amount, payment_method, options = {})
59
62
  params = {}
60
63
  add_metadata(params, options)
61
64
  add_invoice(params, amount, options)
62
- add_customer_data(params, options)
65
+ add_customer_data(params, options, payment_method)
63
66
  add_credit_card(params, payment_method, options)
64
67
  params['Method'] = 'Authorise'
65
68
  commit(url_for('Authorisation'), params)
@@ -70,13 +73,13 @@ module ActiveMerchant #:nodoc:
70
73
  add_metadata(params, options)
71
74
  add_invoice(params, amount, options)
72
75
  add_reference(params, identification)
73
- commit(url_for("CapturePayment"), params)
76
+ commit(url_for('CapturePayment'), params)
74
77
  end
75
78
 
76
79
  def void(identification, options = {})
77
80
  params = {}
78
81
  add_reference(params, identification)
79
- commit(url_for("CancelAuthorisation"), params)
82
+ commit(url_for('CancelAuthorisation'), params)
80
83
  end
81
84
 
82
85
  # Public: Refund a transaction.
@@ -85,6 +88,8 @@ module ActiveMerchant #:nodoc:
85
88
  # identification - The transaction id which is returned in the
86
89
  # authorization of the successful purchase transaction
87
90
  # options - A standard ActiveMerchant options hash:
91
+ # :invoice - The merchant’s invoice number for this
92
+ # transaction (optional).
88
93
  # :order_id - A merchant-supplied identifier for the
89
94
  # transaction (optional).
90
95
  # :description - A merchant-supplied description of the
@@ -99,14 +104,14 @@ module ActiveMerchant #:nodoc:
99
104
  # transaction (optional).
100
105
  # :application_id - A string identifying the application
101
106
  # submitting the transaction
102
- # (default: "https://github.com/Shopify/active_merchant")
107
+ # (default: "https://github.com/activemerchant/active_merchant")
103
108
  #
104
109
  # Returns an ActiveMerchant::Billing::Response object
105
110
  def refund(amount, identification, options = {})
106
111
  params = {}
107
112
  add_metadata(params, options)
108
- add_invoice(params, amount, options, "Refund")
109
- add_reference(params["Refund"], identification)
113
+ add_invoice(params, amount, options, 'Refund')
114
+ add_reference(params['Refund'], identification)
110
115
  add_customer_data(params, options)
111
116
  commit(url_for("Transaction/#{identification}/Refund"), params)
112
117
  end
@@ -125,7 +130,7 @@ module ActiveMerchant #:nodoc:
125
130
  # transaction (optional).
126
131
  # :application_id - A string identifying the application
127
132
  # submitting the transaction
128
- # (default: "https://github.com/Shopify/active_merchant")
133
+ # (default: "https://github.com/activemerchant/active_merchant")
129
134
  #
130
135
  # Returns an ActiveMerchant::Billing::Response object where the authorization is the customer_token on success
131
136
  def store(payment_method, options = {})
@@ -133,10 +138,10 @@ module ActiveMerchant #:nodoc:
133
138
  params = {}
134
139
  add_metadata(params, options)
135
140
  add_invoice(params, 0, options)
136
- add_customer_data(params, options)
141
+ add_customer_data(params, options, payment_method)
137
142
  add_credit_card(params, payment_method, options)
138
143
  params['Method'] = 'CreateTokenCustomer'
139
- commit(url_for("Transaction"), params)
144
+ commit(url_for('Transaction'), params)
140
145
  end
141
146
 
142
147
  # Public: Update a customer's data
@@ -155,18 +160,29 @@ module ActiveMerchant #:nodoc:
155
160
  # transaction (optional).
156
161
  # :application_id - A string identifying the application
157
162
  # submitting the transaction
158
- # (default: "https://github.com/Shopify/active_merchant")
163
+ # (default: "https://github.com/activemerchant/active_merchant")
159
164
  #
160
165
  # Returns an ActiveMerchant::Billing::Response object where the authorization is the customer_token on success
161
166
  def update(customer_token, payment_method, options = {})
162
167
  params = {}
163
168
  add_metadata(params, options)
164
169
  add_invoice(params, 0, options)
165
- add_customer_data(params, options)
170
+ add_customer_data(params, options, payment_method)
166
171
  add_credit_card(params, payment_method, options)
167
172
  add_customer_token(params, customer_token)
168
173
  params['Method'] = 'UpdateTokenCustomer'
169
- commit(url_for("Transaction"), params)
174
+ commit(url_for('Transaction'), params)
175
+ end
176
+
177
+ def supports_scrubbing
178
+ true
179
+ end
180
+
181
+ def scrub(transcript)
182
+ transcript.
183
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
184
+ gsub(%r(("Number\\?":\\?")[^"]*)i, '\1[FILTERED]').
185
+ gsub(%r(("CVN\\?":\\?"?)[^",]*)i, '\1[FILTERED]')
170
186
  end
171
187
 
172
188
  private
@@ -182,13 +198,26 @@ module ActiveMerchant #:nodoc:
182
198
  params
183
199
  end
184
200
 
185
- def add_invoice(params, money, options, key = "Payment")
201
+ def add_3ds_authenticated_data(params, options)
202
+ three_d_secure_options = options[:three_d_secure]
203
+ params['PaymentInstrument'] ||= {} if params['PaymentInstrument'].nil?
204
+ threed_secure_auth = params['PaymentInstrument']['ThreeDSecureAuth'] = {}
205
+ threed_secure_auth['Cryptogram'] = three_d_secure_options[:cavv]
206
+ threed_secure_auth['ECI'] = three_d_secure_options[:eci]
207
+ threed_secure_auth['XID'] = three_d_secure_options[:xid]
208
+ threed_secure_auth['AuthStatus'] = three_d_secure_options[:authentication_response_status]
209
+ threed_secure_auth['dsTransactionId'] = three_d_secure_options[:ds_transaction_id]
210
+ threed_secure_auth['Version'] = three_d_secure_options[:version]
211
+ end
212
+
213
+ def add_invoice(params, money, options, key = 'Payment')
186
214
  currency_code = options[:currency] || currency(money)
187
215
  params[key] = {
188
216
  'TotalAmount' => localized_amount(money, currency_code),
189
- 'InvoiceReference' => truncate(options[:order_id]),
217
+ 'InvoiceReference' => truncate(options[:order_id], 50),
218
+ 'InvoiceNumber' => truncate(options[:invoice] || options[:order_id], 12),
190
219
  'InvoiceDescription' => truncate(options[:description], 64),
191
- 'CurrencyCode' => currency_code,
220
+ 'CurrencyCode' => currency_code
192
221
  }
193
222
  end
194
223
 
@@ -196,43 +225,70 @@ module ActiveMerchant #:nodoc:
196
225
  params['TransactionID'] = reference
197
226
  end
198
227
 
199
- def add_customer_data(params, options)
200
- params['Customer'] ||= {}
201
- add_address(params['Customer'], (options[:billing_address] || options[:address]), {:email => options[:email]})
202
- params['ShippingAddress'] = {}
203
- add_address(params['ShippingAddress'], options[:shipping_address], {:skip_company => true})
228
+ def add_customer_data(params, options, payment_method = nil)
229
+ add_customer_fields(params, options, payment_method)
230
+ add_shipping_fields(params, options)
204
231
  end
205
232
 
206
- def add_address(params, address, options={})
207
- return unless address
233
+ def add_customer_fields(params, options, payment_method)
234
+ key = 'Customer'
235
+ params[key] ||= {}
236
+
237
+ customer_address = options[:billing_address] || options[:address]
208
238
 
209
- if address[:name]
210
- parts = address[:name].split(/\s+/)
211
- params['FirstName'] = parts.shift if parts.size > 1
212
- params['LastName'] = parts.join(" ")
239
+ add_name_and_email(params[key], customer_address, options[:email], payment_method)
240
+ add_address(params[key], customer_address)
241
+ end
242
+
243
+ def add_shipping_fields(params, options)
244
+ key = 'ShippingAddress'
245
+ params[key] = {}
246
+
247
+ add_name_and_email(params[key], options[:shipping_address], options[:email])
248
+ add_address(params[key], options[:shipping_address], { skip_company: true })
249
+ end
250
+
251
+ def add_name_and_email(params, address, email, payment_method = nil)
252
+ if address.present?
253
+ params['FirstName'], params['LastName'] = split_names(address[:name])
254
+ elsif payment_method_name_available?(payment_method)
255
+ params['FirstName'] = payment_method.first_name
256
+ params['LastName'] = payment_method.last_name
213
257
  end
258
+
259
+ params['Email'] = email
260
+ end
261
+
262
+ def payment_method_name_available?(payment_method)
263
+ payment_method.respond_to?(:first_name) && payment_method.respond_to?(:last_name) &&
264
+ payment_method.first_name.present? && payment_method.last_name.present?
265
+ end
266
+
267
+ def add_address(params, address, options = {})
268
+ return unless address
269
+
214
270
  params['Title'] = address[:title]
215
271
  params['CompanyName'] = address[:company] unless options[:skip_company]
216
- params['Street1'] = truncate(address[:address1])
217
- params['Street2'] = truncate(address[:address2])
218
- params['City'] = truncate(address[:city])
272
+ params['Street1'] = truncate(address[:address1], 50)
273
+ params['Street2'] = truncate(address[:address2], 50)
274
+ params['City'] = truncate(address[:city], 50)
219
275
  params['State'] = address[:state]
220
276
  params['PostalCode'] = address[:zip]
221
277
  params['Country'] = address[:country].to_s.downcase
222
- params['Phone'] = address[:phone]
278
+ params['Phone'] = address[:phone] || address[:phone_number]
223
279
  params['Fax'] = address[:fax]
224
- params['Email'] = options[:email]
225
280
  end
226
281
 
227
282
  def add_credit_card(params, credit_card, options)
228
283
  return unless credit_card
284
+
229
285
  params['Customer'] ||= {}
230
286
  if credit_card.respond_to? :number
231
287
  card_details = params['Customer']['CardDetails'] = {}
232
- card_details['Name'] = truncate(credit_card.name)
288
+ card_details['Name'] = truncate(credit_card.name, 50)
233
289
  card_details['Number'] = credit_card.number
234
- card_details['ExpiryMonth'] = "%02d" % (credit_card.month || 0)
235
- card_details['ExpiryYear'] = "%02d" % (credit_card.year || 0)
290
+ card_details['ExpiryMonth'] = '%02d' % (credit_card.month || 0)
291
+ card_details['ExpiryYear'] = '%02d' % (credit_card.year || 0)
236
292
  card_details['CVN'] = credit_card.verification_value
237
293
  else
238
294
  add_customer_token(params, credit_card)
@@ -250,8 +306,8 @@ module ActiveMerchant #:nodoc:
250
306
 
251
307
  def commit(url, params)
252
308
  headers = {
253
- "Authorization" => ("Basic " + Base64.strict_encode64(@options[:login].to_s + ":" + @options[:password].to_s).chomp),
254
- "Content-Type" => "application/json"
309
+ 'Authorization' => ('Basic ' + Base64.strict_encode64(@options[:login].to_s + ':' + @options[:password].to_s).chomp),
310
+ 'Content-Type' => 'application/json'
255
311
  }
256
312
  request = params.to_json
257
313
  raw = parse(ssl_post(url, request, headers))
@@ -261,13 +317,13 @@ module ActiveMerchant #:nodoc:
261
317
  succeeded,
262
318
  message_from(succeeded, raw),
263
319
  raw,
264
- :authorization => authorization_from(raw),
265
- :test => test?,
266
- :avs_result => avs_result_from(raw),
267
- :cvv_result => cvv_result_from(raw)
320
+ authorization: authorization_from(raw),
321
+ test: test?,
322
+ avs_result: avs_result_from(raw),
323
+ cvv_result: cvv_result_from(raw)
268
324
  )
269
325
  rescue ActiveMerchant::ResponseError => e
270
- return ActiveMerchant::Billing::Response.new(false, e.response.message, {:status_code => e.response.code}, :test => test?)
326
+ return ActiveMerchant::Billing::Response.new(false, e.response.message, { status_code: e.response.code }, test: test?)
271
327
  end
272
328
 
273
329
  def parse(data)
@@ -275,19 +331,19 @@ module ActiveMerchant #:nodoc:
275
331
  end
276
332
 
277
333
  def success?(response)
278
- if response['ResponseCode'] == "00"
334
+ if response['ResponseCode'] == '00'
279
335
  true
280
336
  elsif response['TransactionStatus']
281
337
  (response['TransactionStatus'] == true)
282
- elsif response["Succeeded"]
283
- (response["Succeeded"] == true)
338
+ elsif response['Succeeded']
339
+ (response['Succeeded'] == true)
284
340
  else
285
341
  false
286
342
  end
287
343
  end
288
344
 
289
345
  def parse_errors(message)
290
- errors = message.split(',').collect{|code| MESSAGES[code.strip]}.flatten.join(',')
346
+ errors = message.split(',').collect { |code| MESSAGES[code.strip] }.flatten.join(',')
291
347
  errors.presence || message
292
348
  end
293
349
 
@@ -299,48 +355,44 @@ module ActiveMerchant #:nodoc:
299
355
  elsif response['ResponseCode']
300
356
  ActiveMerchant::Billing::EwayGateway::MESSAGES[response['ResponseCode']]
301
357
  elsif succeeded
302
- "Succeeded"
358
+ 'Succeeded'
303
359
  else
304
- "Failed"
360
+ 'Failed'
305
361
  end
306
362
  end
307
363
 
308
364
  def authorization_from(response)
309
365
  # Note: TransactionID is always null for store requests, but TokenCustomerID is also sent back for purchase from
310
- # stored card transactions so we give precendence to TransactionID
366
+ # stored card transactions so we give precedence to TransactionID
311
367
  response['TransactionID'] || response['Customer']['TokenCustomerID']
312
368
  end
313
369
 
314
370
  def avs_result_from(response)
315
371
  verification = response['Verification'] || {}
316
- code = case verification['Address']
317
- when "Valid"
318
- "M"
319
- when "Invalid"
320
- "N"
321
- else
322
- "I"
323
- end
324
- {:code => code}
372
+ code =
373
+ case verification['Address']
374
+ when 'Valid'
375
+ 'M'
376
+ when 'Invalid'
377
+ 'N'
378
+ else
379
+ 'I'
380
+ end
381
+ { code: code }
325
382
  end
326
383
 
327
384
  def cvv_result_from(response)
328
385
  verification = response['Verification'] || {}
329
386
  case verification['CVN']
330
- when "Valid"
331
- "M"
332
- when "Invalid"
333
- "N"
387
+ when 'Valid'
388
+ 'M'
389
+ when 'Invalid'
390
+ 'N'
334
391
  else
335
- "P"
392
+ 'P'
336
393
  end
337
394
  end
338
395
 
339
- def truncate(value, max_size = 50)
340
- return nil unless value
341
- value.to_s[0, max_size]
342
- end
343
-
344
396
  MESSAGES = {
345
397
  'A2000' => 'Transaction Approved Successful',
346
398
  'A2008' => 'Honour With Identification Successful',
@@ -352,7 +404,7 @@ module ActiveMerchant #:nodoc:
352
404
  'D4403' => 'No Merchant Failed',
353
405
  'D4404' => 'Pick Up Card Failed',
354
406
  'D4405' => 'Do Not Honour Failed',
355
- 'D4406' => 'Error Failed',
407
+ 'D4406' => 'Error Failed',
356
408
  'D4407' => 'Pick Up Card, Special Failed',
357
409
  'D4409' => 'Request In Progress Failed',
358
410
  'D4412' => 'Invalid Transaction Failed',
@@ -406,6 +458,8 @@ module ActiveMerchant #:nodoc:
406
458
  'D4498' => 'PayPal Create Transaction Error Failed',
407
459
  'D4499' => 'Invalid Transaction for Auth/Void Failed',
408
460
  'S5000' => 'System Error',
461
+ 'S5011' => 'PayPal Connection Error',
462
+ 'S5012' => 'PayPal Settings Error',
409
463
  'S5085' => 'Started 3dSecure',
410
464
  'S5086' => 'Routed 3dSecure',
411
465
  'S5087' => 'Completed 3dSecure',
@@ -517,7 +571,7 @@ module ActiveMerchant #:nodoc:
517
571
  'V6150' => 'Invalid Refund Amount',
518
572
  'V6151' => 'Refund amount greater than original transaction',
519
573
  'V6152' => 'Original transaction already refunded for total amount',
520
- 'V6153' => 'Card type not support by merchant',
574
+ 'V6153' => 'Card type not support by merchant'
521
575
  }
522
576
  end
523
577
  end
@@ -3,40 +3,35 @@ module ActiveMerchant #:nodoc:
3
3
  class ExactGateway < Gateway
4
4
  self.live_url = self.test_url = 'https://secure2.e-xact.com/vplug-in/transaction/rpc-enc/service.asmx'
5
5
 
6
- API_VERSION = "8.5"
6
+ API_VERSION = '8.5'
7
7
 
8
- TEST_LOGINS = [ {:login => "A00049-01", :password => "test1"},
9
- {:login => "A00427-01", :password => "testus"} ]
10
-
11
- TRANSACTIONS = { :sale => "00",
12
- :authorization => "01",
13
- :capture => "32",
14
- :credit => "34" }
8
+ TEST_LOGINS = [{ login: 'A00049-01', password: 'test1' },
9
+ { login: 'A00427-01', password: 'testus' }]
15
10
 
11
+ TRANSACTIONS = { sale: '00',
12
+ authorization: '01',
13
+ capture: '32',
14
+ credit: '34' }
16
15
 
17
16
  ENVELOPE_NAMESPACES = { 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
18
17
  'xmlns:env' => 'http://schemas.xmlsoap.org/soap/envelope/',
19
- 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
20
- }
18
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' }
21
19
 
22
- SEND_AND_COMMIT_ATTRIBUTES = { 'xmlns:n1' => "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Request",
23
- 'env:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/'
24
- }
20
+ SEND_AND_COMMIT_ATTRIBUTES = { 'xmlns:n1' => 'http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Request',
21
+ 'env:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/' }
25
22
 
26
23
  SEND_AND_COMMIT_SOURCE_ATTRIBUTES = { 'xmlns:n2' => 'http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes',
27
- 'xsi:type' => 'n2:Transaction'
28
- }
24
+ 'xsi:type' => 'n2:Transaction' }
29
25
 
30
- POST_HEADERS = { 'soapAction' => "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/SendAndCommit",
31
- 'Content-Type' => 'text/xml'
32
- }
26
+ POST_HEADERS = { 'soapAction' => 'http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/SendAndCommit',
27
+ 'Content-Type' => 'text/xml' }
33
28
 
34
- SUCCESS = "true"
29
+ SUCCESS = 'true'
35
30
 
36
- SENSITIVE_FIELDS = [ :verification_str2, :expiry_date, :card_number ]
31
+ SENSITIVE_FIELDS = %i[verification_str2 expiry_date card_number]
37
32
 
38
- self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :discover]
39
- self.supported_countries = ['CA', 'US']
33
+ self.supported_countries = %w[CA US]
34
+ self.supported_cardtypes = %i[visa master american_express jcb discover]
40
35
  self.homepage_url = 'http://www.e-xact.com'
41
36
  self.display_name = 'E-xact'
42
37
 
@@ -68,6 +63,7 @@ module ActiveMerchant #:nodoc:
68
63
  end
69
64
 
70
65
  private
66
+
71
67
  def build_request(action, body)
72
68
  xml = Builder::XmlMarkup.new
73
69
 
@@ -160,14 +156,20 @@ module ActiveMerchant #:nodoc:
160
156
  end
161
157
 
162
158
  def commit(action, request)
163
- response = parse(ssl_post(self.live_url, build_request(action, request), POST_HEADERS))
164
-
165
- Response.new(successful?(response), message_from(response), response,
166
- :test => test?,
167
- :authorization => authorization_from(response),
168
- :avs_result => { :code => response[:avs] },
169
- :cvv_result => response[:cvv2]
170
- )
159
+ response = parse(ssl_post(self.live_url, build_request(action, request), POST_HEADERS))
160
+
161
+ Response.new(successful?(response), message_from(response), response,
162
+ test: test?,
163
+ authorization: authorization_from(response),
164
+ avs_result: { code: response[:avs] },
165
+ cvv_result: response[:cvv2])
166
+ rescue ResponseError => e
167
+ case e.response.code
168
+ when '401'
169
+ return Response.new(false, "Invalid Login: #{e.response.body}", {}, test: test?)
170
+ else
171
+ raise
172
+ end
171
173
  end
172
174
 
173
175
  def successful?(response)
@@ -176,9 +178,9 @@ module ActiveMerchant #:nodoc:
176
178
 
177
179
  def authorization_from(response)
178
180
  if response[:authorization_num] && response[:transaction_tag]
179
- "#{response[:authorization_num]};#{response[:transaction_tag]}"
181
+ "#{response[:authorization_num]};#{response[:transaction_tag]}"
180
182
  else
181
- ''
183
+ ''
182
184
  end
183
185
  end
184
186
 
@@ -198,13 +200,13 @@ module ActiveMerchant #:nodoc:
198
200
  response = {}
199
201
  xml = REXML::Document.new(xml)
200
202
 
201
- if root = REXML::XPath.first(xml, "//types:TransactionResult")
203
+ if root = REXML::XPath.first(xml, '//types:TransactionResult')
202
204
  parse_elements(response, root)
203
- elsif root = REXML::XPath.first(xml, "//soap:Fault")
205
+ elsif root = REXML::XPath.first(xml, '//soap:Fault')
204
206
  parse_elements(response, root)
205
207
  end
206
208
 
207
- response.delete_if{ |k,v| SENSITIVE_FIELDS.include?(k) }
209
+ response.delete_if { |k, _v| SENSITIVE_FIELDS.include?(k) }
208
210
  end
209
211
 
210
212
  def parse_elements(response, root)
@@ -215,4 +217,3 @@ module ActiveMerchant #:nodoc:
215
217
  end
216
218
  end
217
219
  end
218
-