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
@@ -2,7 +2,6 @@ require 'rexml/document'
2
2
 
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
-
6
5
  # To learn more about the Moneris gateway, please contact
7
6
  # eselectplus@moneris.com for a copy of their integration guide. For
8
7
  # information on remote testing, please see "Test Environment Penny Value
@@ -14,7 +13,7 @@ module ActiveMerchant #:nodoc:
14
13
  self.live_url = 'https://www3.moneris.com/gateway2/servlet/MpgRequest'
15
14
 
16
15
  self.supported_countries = ['CA']
17
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover]
16
+ self.supported_cardtypes = %i[visa master american_express diners_club discover]
18
17
  self.homepage_url = 'http://www.moneris.com/'
19
18
  self.display_name = 'Moneris'
20
19
 
@@ -34,7 +33,7 @@ module ActiveMerchant #:nodoc:
34
33
  requires!(options, :login, :password)
35
34
  @cvv_enabled = options[:cvv_enabled]
36
35
  @avs_enabled = options[:avs_enabled]
37
- options = { :crypt_type => 7 }.merge(options)
36
+ options[:crypt_type] = 7 unless options.has_key?(:crypt_type)
38
37
  super
39
38
  end
40
39
 
@@ -47,12 +46,20 @@ module ActiveMerchant #:nodoc:
47
46
  requires!(options, :order_id)
48
47
  post = {}
49
48
  add_payment_source(post, creditcard_or_datakey, options)
50
- post[:amount] = amount(money)
51
- post[:order_id] = options[:order_id]
52
- post[:address] = options[:billing_address] || options[:address]
49
+ post[:amount] = amount(money)
50
+ post[:order_id] = options[:order_id]
51
+ post[:address] = options[:billing_address] || options[:address]
53
52
  post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
54
- action = (post[:data_key].blank?) ? 'preauth' : 'res_preauth_cc'
55
- commit(action, post)
53
+ add_external_mpi_fields(post, options)
54
+ add_stored_credential(post, options)
55
+ action = if post[:cavv] || options[:three_d_secure]
56
+ 'cavv_preauth'
57
+ elsif post[:data_key].blank?
58
+ 'preauth'
59
+ else
60
+ 'res_preauth_cc'
61
+ end
62
+ commit(action, post, options)
56
63
  end
57
64
 
58
65
  # This action verifies funding on a customer's card and readies them for
@@ -63,12 +70,20 @@ module ActiveMerchant #:nodoc:
63
70
  requires!(options, :order_id)
64
71
  post = {}
65
72
  add_payment_source(post, creditcard_or_datakey, options)
66
- post[:amount] = amount(money)
67
- post[:order_id] = options[:order_id]
68
- post[:address] = options[:billing_address] || options[:address]
73
+ post[:amount] = amount(money)
74
+ post[:order_id] = options[:order_id]
75
+ post[:address] = options[:billing_address] || options[:address]
69
76
  post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
70
- action = (post[:data_key].blank?) ? 'purchase' : 'res_purchase_cc'
71
- commit(action, post)
77
+ add_external_mpi_fields(post, options)
78
+ add_stored_credential(post, options)
79
+ action = if post[:cavv] || options[:three_d_secure]
80
+ 'cavv_purchase'
81
+ elsif post[:data_key].blank?
82
+ 'purchase'
83
+ else
84
+ 'res_purchase_cc'
85
+ end
86
+ commit(action, post, options)
72
87
  end
73
88
 
74
89
  # This method retrieves locked funds from a customer's account (from a
@@ -79,7 +94,7 @@ module ActiveMerchant #:nodoc:
79
94
  # gateways the two numbers are concatenated together with a ; separator as
80
95
  # the authorization number returned by authorization
81
96
  def capture(money, authorization, options = {})
82
- commit 'completion', crediting_params(authorization, :comp_amount => amount(money))
97
+ commit 'completion', crediting_params(authorization, comp_amount: amount(money))
83
98
  end
84
99
 
85
100
  # Voiding requires the original transaction ID and order ID of some open
@@ -117,15 +132,43 @@ module ActiveMerchant #:nodoc:
117
132
  end
118
133
 
119
134
  def refund(money, authorization, options = {})
120
- commit 'refund', crediting_params(authorization, :amount => amount(money))
135
+ commit 'refund', crediting_params(authorization, amount: amount(money))
121
136
  end
122
137
 
138
+ def verify(credit_card, options = {})
139
+ requires!(options, :order_id)
140
+ post = {}
141
+ add_payment_source(post, credit_card, options)
142
+ post[:order_id] = options[:order_id]
143
+ post[:address] = options[:billing_address] || options[:address]
144
+ post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
145
+ add_stored_credential(post, options)
146
+ action = if post[:data_key].blank?
147
+ 'card_verification'
148
+ else
149
+ 'res_card_verification_cc'
150
+ end
151
+ commit(action, post)
152
+ end
153
+
154
+ # When passing a :duration option (time in seconds) you can create a
155
+ # temporary vault record to avoid incurring Moneris vault storage fees
156
+ #
157
+ # https://developer.moneris.com/Documentation/NA/E-Commerce%20Solutions/API/Vault#vaulttokenadd
123
158
  def store(credit_card, options = {})
124
159
  post = {}
125
160
  post[:pan] = credit_card.number
126
161
  post[:expdate] = expdate(credit_card)
162
+ post[:address] = options[:billing_address] || options[:address]
127
163
  post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
128
- commit('res_add_cc', post)
164
+ add_stored_credential(post, options)
165
+
166
+ if options[:duration]
167
+ post[:duration] = options[:duration]
168
+ commit('res_temp_add', post)
169
+ else
170
+ commit('res_add_cc', post)
171
+ end
129
172
  end
130
173
 
131
174
  def unstore(data_key, options = {})
@@ -143,35 +186,115 @@ module ActiveMerchant #:nodoc:
143
186
  commit('res_update_cc', post)
144
187
  end
145
188
 
189
+ def supports_scrubbing?
190
+ true
191
+ end
192
+
193
+ def scrub(transcript)
194
+ transcript.
195
+ gsub(%r((<store_id>).+(</store_id>)), '\1[FILTERED]\2').
196
+ gsub(%r((<api_token>).+(</api_token>)), '\1[FILTERED]\2').
197
+ gsub(%r((<pan>).+(</pan>)), '\1[FILTERED]\2').
198
+ gsub(%r((<cvd_value>).+(</cvd_value>)), '\1[FILTERED]\2').
199
+ gsub(%r((<cavv>).+(</cavv>)), '\1[FILTERED]\2')
200
+ end
201
+
146
202
  private # :nodoc: all
147
203
 
148
204
  def expdate(creditcard)
149
- sprintf("%.4i", creditcard.year)[-2..-1] + sprintf("%.2i", creditcard.month)
205
+ sprintf('%.4i', creditcard.year)[-2..-1] + sprintf('%.2i', creditcard.month)
206
+ end
207
+
208
+ def add_external_mpi_fields(post, options)
209
+ # See these pages:
210
+ # https://developer.moneris.com/livedemo/3ds2/cavv_purchase/tool/php
211
+ # https://developer.moneris.com/livedemo/3ds2/cavv_preauth/guide/php
212
+ return unless options[:three_d_secure]
213
+
214
+ three_d_secure_options = options[:three_d_secure]
215
+
216
+ post[:threeds_version] = three_d_secure_options[:version]
217
+ post[:crypt_type] = three_d_secure_options[:eci]
218
+ post[:cavv] = three_d_secure_options[:cavv]
219
+ post[:threeds_server_trans_id] = three_d_secure_options[:three_ds_server_trans_id]
220
+ post[:ds_trans_id] = three_d_secure_options[:ds_transaction_id]
150
221
  end
151
222
 
152
- def add_payment_source(post, source, options)
153
- if source.is_a?(String)
154
- post[:data_key] = source
155
- post[:cust_id] = options[:customer]
223
+ def add_payment_source(post, payment_method, options)
224
+ if payment_method.is_a?(String)
225
+ post[:data_key] = payment_method
226
+ post[:cust_id] = options[:customer]
156
227
  else
157
- if source.respond_to?(:track_data) && source.track_data.present?
158
- post[:pos_code] = '00'
159
- post[:track2] = source.track_data
228
+ if payment_method.respond_to?(:track_data) && payment_method.track_data.present?
229
+ post[:pos_code] = '00'
230
+ post[:track2] = payment_method.track_data
160
231
  else
161
- post[:pan] = source.number
162
- post[:expdate] = expdate(source)
163
- post[:cvd_value] = source.verification_value if source.verification_value?
232
+ post[:pan] = payment_method.number
233
+ post[:expdate] = expdate(payment_method)
234
+ post[:cvd_value] = payment_method.verification_value if payment_method.verification_value?
235
+ post[:cavv] = payment_method.payment_cryptogram if payment_method.is_a?(NetworkTokenizationCreditCard)
236
+ post[:wallet_indicator] = wallet_indicator(payment_method.source.to_s) if payment_method.is_a?(NetworkTokenizationCreditCard)
237
+ post[:crypt_type] = (payment_method.eci || 7) if payment_method.is_a?(NetworkTokenizationCreditCard)
238
+ end
239
+ post[:cust_id] = options[:customer] || payment_method.name
240
+ end
241
+ end
242
+
243
+ def add_cof(post, options)
244
+ post[:issuer_id] = options[:issuer_id] if options[:issuer_id]
245
+ post[:payment_indicator] = options[:payment_indicator] if options[:payment_indicator]
246
+ post[:payment_information] = options[:payment_information] if options[:payment_information]
247
+ end
248
+
249
+ def add_stored_credential(post, options)
250
+ add_cof(post, options)
251
+ # if any of :issuer_id, :payment_information, or :payment_indicator is not passed,
252
+ # then check for :stored credential options
253
+ return unless (stored_credential = options[:stored_credential]) && !cof_details_present?(options)
254
+
255
+ if stored_credential[:initial_transaction]
256
+ add_stored_credential_initial(post, options)
257
+ else
258
+ add_stored_credential_used(post, options)
259
+ end
260
+ end
261
+
262
+ def add_stored_credential_initial(post, options)
263
+ post[:payment_information] ||= '0'
264
+ post[:issuer_id] ||= ''
265
+ if options[:stored_credential][:initiator] == 'merchant'
266
+ case options[:stored_credential][:reason_type]
267
+ when 'recurring', 'installment'
268
+ post[:payment_indicator] ||= 'R'
269
+ when 'unscheduled'
270
+ post[:payment_indicator] ||= 'C'
164
271
  end
165
- post[:cust_id] = options[:customer] || source.name
272
+ else
273
+ post[:payment_indicator] ||= 'C'
274
+ end
275
+ end
276
+
277
+ def add_stored_credential_used(post, options)
278
+ post[:payment_information] ||= '2'
279
+ post[:issuer_id] = options[:stored_credential][:network_transaction_id] if options[:issuer_id].blank?
280
+ if options[:stored_credential][:initiator] == 'merchant'
281
+ case options[:stored_credential][:reason_type]
282
+ when 'recurring', 'installment'
283
+ post[:payment_indicator] ||= 'R'
284
+ when '', 'unscheduled'
285
+ post[:payment_indicator] ||= 'U'
286
+ end
287
+ else
288
+ post[:payment_indicator] ||= 'Z'
166
289
  end
167
290
  end
168
291
 
169
292
  # Common params used amongst the +credit+, +void+ and +capture+ methods
170
293
  def crediting_params(authorization, options = {})
171
294
  {
172
- :txn_number => split_authorization(authorization).first,
173
- :order_id => split_authorization(authorization).last,
174
- :crypt_type => options[:crypt_type] || @options[:crypt_type]
295
+ txn_number: split_authorization(authorization).first,
296
+ order_id: split_authorization(authorization).last,
297
+ crypt_type: options[:crypt_type] || @options[:crypt_type]
175
298
  }.merge(options)
176
299
  end
177
300
 
@@ -185,36 +308,47 @@ module ActiveMerchant #:nodoc:
185
308
  end
186
309
  end
187
310
 
188
- def commit(action, parameters = {})
311
+ def commit(action, parameters = {}, options = {})
312
+ threed_ds_transaction = options[:three_d_secure].present?
313
+
189
314
  data = post_data(action, parameters)
190
315
  url = test? ? self.test_url : self.live_url
191
316
  raw = ssl_post(url, data)
192
317
  response = parse(raw)
193
318
 
194
- Response.new(successful?(response), message_from(response[:message]), response,
195
- :test => test?,
196
- :avs_result => { :code => response[:avs_result_code] },
197
- :cvv_result => response[:cvd_result_code] && response[:cvd_result_code][-1,1],
198
- :authorization => authorization_from(response)
319
+ Response.new(
320
+ successful?(action, response, threed_ds_transaction),
321
+ message_from(response[:message]),
322
+ response,
323
+ test: test?,
324
+ avs_result: { code: response[:avs_result_code] },
325
+ cvv_result: response[:cvd_result_code] && response[:cvd_result_code][-1, 1],
326
+ authorization: authorization_from(response)
199
327
  )
200
328
  end
201
329
 
202
330
  # Generates a Moneris authorization string of the form 'trans_id;receipt_id'.
203
331
  def authorization_from(response = {})
204
- if response[:trans_id] && response[:receipt_id]
205
- "#{response[:trans_id]};#{response[:receipt_id]}"
206
- end
332
+ "#{response[:trans_id]};#{response[:receipt_id]}" if response[:trans_id] && response[:receipt_id]
207
333
  end
208
334
 
209
335
  # Tests for a successful response from Moneris' servers
210
- def successful?(response)
211
- response[:response_code] &&
212
- response[:complete] &&
213
- (0..49).include?(response[:response_code].to_i)
336
+ def successful?(action, response, threed_ds_transaction = false)
337
+ # See 9.4 CAVV Result Codes in https://developer.moneris.com/livedemo/3ds2/reference/guide/php
338
+ cavv_accepted = if threed_ds_transaction
339
+ response[:cavv_result_code] && response[:cavv_result_code] == '2'
340
+ else
341
+ true
342
+ end
343
+
344
+ cavv_accepted &&
345
+ response[:response_code] &&
346
+ response[:complete] &&
347
+ (0..49).cover?(response[:response_code].to_i)
214
348
  end
215
349
 
216
350
  def parse(xml)
217
- response = { :message => "Global Error Receipt", :complete => false }
351
+ response = { message: 'Global Error Receipt', complete: false }
218
352
  hashify_xml!(xml, response)
219
353
  response
220
354
  end
@@ -222,16 +356,17 @@ module ActiveMerchant #:nodoc:
222
356
  def hashify_xml!(xml, response)
223
357
  xml = REXML::Document.new(xml)
224
358
  return if xml.root.nil?
359
+
225
360
  xml.elements.each('//receipt/*') do |node|
226
361
  response[node.name.underscore.to_sym] = normalize(node.text)
227
362
  end
228
363
  end
229
364
 
230
365
  def post_data(action, parameters = {})
231
- xml = REXML::Document.new
232
- root = xml.add_element("request")
233
- root.add_element("store_id").text = options[:login]
234
- root.add_element("api_token").text = options[:password]
366
+ xml = REXML::Document.new
367
+ root = xml.add_element('request')
368
+ root.add_element('store_id').text = options[:login]
369
+ root.add_element('api_token').text = options[:password]
235
370
  root.add_element(transaction_element(action, parameters))
236
371
 
237
372
  xml.to_s
@@ -247,6 +382,8 @@ module ActiveMerchant #:nodoc:
247
382
  transaction.add_element(avs_element(parameters[:address])) if @avs_enabled && parameters[:address]
248
383
  when :cvd_info
249
384
  transaction.add_element(cvd_element(parameters[:cvd_value])) if @cvv_enabled
385
+ when :cof_info
386
+ transaction.add_element(credential_on_file(parameters)) if cof_details_present?(parameters)
250
387
  else
251
388
  transaction.add_element(key.to_s).text = parameters[key] unless parameters[key].blank?
252
389
  end
@@ -260,8 +397,8 @@ module ActiveMerchant #:nodoc:
260
397
  tokens = full_address.split(/\s+/)
261
398
 
262
399
  element = REXML::Element.new('avs_info')
263
- element.add_element('avs_street_number').text = tokens.select{|x| x =~ /\d/}.join(' ')
264
- element.add_element('avs_street_name').text = tokens.reject{|x| x =~ /\d/}.join(' ')
400
+ element.add_element('avs_street_number').text = tokens.select { |x| x =~ /\d/ }.join(' ')
401
+ element.add_element('avs_street_name').text = tokens.reject { |x| x =~ /\d/ }.join(' ')
265
402
  element.add_element('avs_zipcode').text = address[:zip]
266
403
  element
267
404
  end
@@ -269,39 +406,66 @@ module ActiveMerchant #:nodoc:
269
406
  def cvd_element(cvd_value)
270
407
  element = REXML::Element.new('cvd_info')
271
408
  if cvd_value
272
- element.add_element('cvd_indicator').text = "1"
409
+ element.add_element('cvd_indicator').text = '1'
273
410
  element.add_element('cvd_value').text = cvd_value
274
411
  else
275
- element.add_element('cvd_indicator').text = "0"
412
+ element.add_element('cvd_indicator').text = '0'
276
413
  end
277
414
  element
278
415
  end
279
416
 
417
+ def cof_details_present?(parameters)
418
+ parameters[:issuer_id] && parameters[:payment_indicator] && parameters[:payment_information]
419
+ end
420
+
421
+ def credential_on_file(parameters)
422
+ issuer_id = parameters[:issuer_id]
423
+ payment_indicator = parameters[:payment_indicator]
424
+ payment_information = parameters[:payment_information]
425
+
426
+ cof_info = REXML::Element.new('cof_info')
427
+ cof_info.add_element('issuer_id').text = issuer_id
428
+ cof_info.add_element('payment_indicator').text = payment_indicator
429
+ cof_info.add_element('payment_information').text = payment_information
430
+ cof_info
431
+ end
432
+
433
+ def wallet_indicator(token_source)
434
+ return 'APP' if token_source == 'apple_pay'
435
+ return 'ANP' if token_source == 'android_pay'
436
+
437
+ nil
438
+ end
439
+
280
440
  def message_from(message)
281
441
  return 'Unspecified error' if message.blank?
282
- message.gsub(/[^\w]/, ' ').split.join(" ").capitalize
442
+
443
+ message.gsub(/[^\w]/, ' ').split.join(' ').capitalize
283
444
  end
284
445
 
285
446
  def actions
286
447
  {
287
- "purchase" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info, :track2, :pos_code],
288
- "preauth" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info, :track2, :pos_code],
289
- "command" => [:order_id],
290
- "refund" => [:order_id, :amount, :txn_number, :crypt_type],
291
- "indrefund" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
292
- "completion" => [:order_id, :comp_amount, :txn_number, :crypt_type],
293
- "purchasecorrection" => [:order_id, :txn_number, :crypt_type],
294
- "cavvpurcha" => [:order_id, :cust_id, :amount, :pan, :expdate, :cav],
295
- "cavvpreaut" => [:order_id, :cust_id, :amount, :pan, :expdate, :cavv],
296
- "transact" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
297
- "Batchcloseall" => [],
298
- "opentotals" => [:ecr_number],
299
- "batchclose" => [:ecr_number],
300
- "res_add_cc" => [:pan, :expdate, :crypt_type],
301
- "res_delete" => [:data_key],
302
- "res_update_cc" => [:data_key, :pan, :expdate, :crypt_type],
303
- "res_purchase_cc" => [:data_key, :order_id, :cust_id, :amount, :crypt_type],
304
- "res_preauth_cc" => [:data_key, :order_id, :cust_id, :amount, :crypt_type]
448
+ 'purchase' => %i[order_id cust_id amount pan expdate crypt_type avs_info cvd_info track2 pos_code cof_info],
449
+ 'preauth' => %i[order_id cust_id amount pan expdate crypt_type avs_info cvd_info track2 pos_code cof_info],
450
+ 'command' => [:order_id],
451
+ 'refund' => %i[order_id amount txn_number crypt_type],
452
+ 'indrefund' => %i[order_id cust_id amount pan expdate crypt_type],
453
+ 'completion' => %i[order_id comp_amount txn_number crypt_type],
454
+ 'purchasecorrection' => %i[order_id txn_number crypt_type],
455
+ 'cavv_preauth' => %i[order_id cust_id amount pan expdate cavv crypt_type wallet_indicator],
456
+ 'cavv_purchase' => %i[order_id cust_id amount pan expdate cavv crypt_type wallet_indicator],
457
+ 'card_verification' => %i[order_id cust_id pan expdate crypt_type avs_info cvd_info cof_info],
458
+ 'transact' => %i[order_id cust_id amount pan expdate crypt_type],
459
+ 'Batchcloseall' => [],
460
+ 'opentotals' => [:ecr_number],
461
+ 'batchclose' => [:ecr_number],
462
+ 'res_add_cc' => %i[pan expdate crypt_type avs_info cof_info],
463
+ 'res_temp_add' => %i[pan expdate crypt_type duration],
464
+ 'res_delete' => [:data_key],
465
+ 'res_update_cc' => %i[data_key pan expdate crypt_type avs_info cof_info],
466
+ 'res_purchase_cc' => %i[data_key order_id cust_id amount crypt_type cof_info],
467
+ 'res_preauth_cc' => %i[data_key order_id cust_id amount crypt_type cof_info],
468
+ 'res_card_verification_cc' => %i[order_id data_key expdate crypt_type cof_info]
305
469
  }
306
470
  end
307
471
  end
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
  self.homepage_url = 'http://mmoa.us/'
9
9
  self.display_name = 'MoneyMovers'
10
10
  self.supported_countries = ['US']
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
11
+ self.supported_cardtypes = %i[visa master american_express discover]
12
12
 
13
13
  def initialize(options = {})
14
14
  requires!(options, :login, :password)
@@ -45,7 +45,7 @@ module ActiveMerchant #:nodoc:
45
45
  end
46
46
 
47
47
  def refund(money, authorization, options = {})
48
- commit('refund', money, options.merge(:transactionid => authorization))
48
+ commit('refund', money, options.merge(transactionid: authorization))
49
49
  end
50
50
 
51
51
  def credit(money, authorization, options = {})
@@ -114,11 +114,10 @@ module ActiveMerchant #:nodoc:
114
114
  message = message_from(response)
115
115
 
116
116
  Response.new(success?(response), message, response,
117
- :test => test?,
118
- :authorization => response['transactionid'],
119
- :avs_result => {:code => response['avsresponse']},
120
- :cvv_result => response['cvvresponse']
121
- )
117
+ test: test?,
118
+ authorization: response['transactionid'],
119
+ avs_result: { code: response['avsresponse'] },
120
+ cvv_result: response['cvvresponse'])
122
121
  end
123
122
 
124
123
  def success?(response)
@@ -126,17 +125,17 @@ module ActiveMerchant #:nodoc:
126
125
  end
127
126
 
128
127
  def test?
129
- (@options[:login].eql?('demo')) && (@options[:password].eql?('password'))
128
+ @options[:login].eql?('demo') && @options[:password].eql?('password')
130
129
  end
131
130
 
132
131
  def message_from(response)
133
132
  case response['response'].to_i
134
133
  when APPROVED
135
- "Transaction Approved"
134
+ 'Transaction Approved'
136
135
  when DECLINED
137
- "Transaction Declined"
136
+ 'Transaction Declined'
138
137
  else
139
- "Error in transaction data or system error"
138
+ 'Error in transaction data or system error'
140
139
  end
141
140
  end
142
141
 
@@ -144,9 +143,8 @@ module ActiveMerchant #:nodoc:
144
143
  parameters[:type] = action
145
144
  parameters[:username] = @options[:login]
146
145
  parameters[:password] = @options[:password]
147
- parameters.map{|k, v| "#{k}=#{CGI.escape(v.to_s)}"}.join('&')
146
+ parameters.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
148
147
  end
149
148
  end
150
149
  end
151
150
  end
152
-