activemerchant 1.100.0 → 1.133.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +1057 -0
  3. data/README.md +11 -9
  4. data/lib/active_merchant/billing/avs_result.rb +9 -9
  5. data/lib/active_merchant/billing/base.rb +0 -13
  6. data/lib/active_merchant/billing/check.rb +49 -17
  7. data/lib/active_merchant/billing/compatibility.rb +5 -4
  8. data/lib/active_merchant/billing/credit_card.rb +55 -8
  9. data/lib/active_merchant/billing/credit_card_formatting.rb +1 -0
  10. data/lib/active_merchant/billing/credit_card_methods.rb +209 -36
  11. data/lib/active_merchant/billing/cvv_result.rb +0 -1
  12. data/lib/active_merchant/billing/gateway.rb +38 -36
  13. data/lib/active_merchant/billing/gateways/adyen.rb +399 -78
  14. data/lib/active_merchant/billing/gateways/airwallex.rb +370 -0
  15. data/lib/active_merchant/billing/gateways/alelo.rb +256 -0
  16. data/lib/active_merchant/billing/gateways/allied_wallet.rb +14 -14
  17. data/lib/active_merchant/billing/gateways/authorize_net.rb +200 -130
  18. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +27 -20
  19. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +48 -51
  20. data/lib/active_merchant/billing/gateways/axcessms.rb +13 -15
  21. data/lib/active_merchant/billing/gateways/balanced.rb +43 -36
  22. data/lib/active_merchant/billing/gateways/bambora_apac.rb +16 -20
  23. data/lib/active_merchant/billing/gateways/bank_frick.rb +13 -13
  24. data/lib/active_merchant/billing/gateways/banwire.rb +5 -5
  25. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +43 -30
  26. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +1 -1
  27. data/lib/active_merchant/billing/gateways/be2bill.rb +5 -5
  28. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +37 -36
  29. data/lib/active_merchant/billing/gateways/beanstream.rb +21 -3
  30. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/blue_pay.rb +53 -28
  32. data/lib/active_merchant/billing/gateways/blue_snap.rb +176 -54
  33. data/lib/active_merchant/billing/gateways/bogus.rb +24 -20
  34. data/lib/active_merchant/billing/gateways/borgun.rb +92 -38
  35. data/lib/active_merchant/billing/gateways/bpoint.rb +15 -15
  36. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +8 -2
  37. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
  38. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  39. data/lib/active_merchant/billing/gateways/braintree_blue.rb +387 -175
  40. data/lib/active_merchant/billing/gateways/bridge_pay.rb +13 -13
  41. data/lib/active_merchant/billing/gateways/cams.rb +10 -10
  42. data/lib/active_merchant/billing/gateways/card_connect.rb +33 -14
  43. data/lib/active_merchant/billing/gateways/card_save.rb +3 -4
  44. data/lib/active_merchant/billing/gateways/card_stream.rb +67 -40
  45. data/lib/active_merchant/billing/gateways/cardknox.rb +13 -13
  46. data/lib/active_merchant/billing/gateways/cardprocess.rb +4 -2
  47. data/lib/active_merchant/billing/gateways/cashnet.rb +28 -12
  48. data/lib/active_merchant/billing/gateways/cc5.rb +9 -9
  49. data/lib/active_merchant/billing/gateways/cecabank.rb +38 -38
  50. data/lib/active_merchant/billing/gateways/cenpos.rb +29 -28
  51. data/lib/active_merchant/billing/gateways/checkout.rb +7 -9
  52. data/lib/active_merchant/billing/gateways/checkout_v2.rb +316 -68
  53. data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -2
  54. data/lib/active_merchant/billing/gateways/clearhaus.rb +32 -33
  55. data/lib/active_merchant/billing/gateways/commerce_hub.rb +370 -0
  56. data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
  57. data/lib/active_merchant/billing/gateways/conekta.rb +8 -6
  58. data/lib/active_merchant/billing/gateways/creditcall.rb +18 -17
  59. data/lib/active_merchant/billing/gateways/credorax.rb +152 -63
  60. data/lib/active_merchant/billing/gateways/ct_payment.rb +15 -14
  61. data/lib/active_merchant/billing/gateways/culqi.rb +30 -28
  62. data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
  63. data/lib/active_merchant/billing/gateways/cyber_source.rb +496 -187
  64. data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
  65. data/lib/active_merchant/billing/gateways/d_local.rb +148 -31
  66. data/lib/active_merchant/billing/gateways/data_cash.rb +34 -37
  67. data/lib/active_merchant/billing/gateways/decidir.rb +134 -21
  68. data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
  69. data/lib/active_merchant/billing/gateways/dibs.rb +10 -10
  70. data/lib/active_merchant/billing/gateways/digitzs.rb +11 -8
  71. data/lib/active_merchant/billing/gateways/ebanx.rb +90 -40
  72. data/lib/active_merchant/billing/gateways/efsnet.rb +36 -36
  73. data/lib/active_merchant/billing/gateways/elavon.rb +349 -194
  74. data/lib/active_merchant/billing/gateways/element.rb +71 -21
  75. data/lib/active_merchant/billing/gateways/epay.rb +43 -43
  76. data/lib/active_merchant/billing/gateways/evo_ca.rb +12 -13
  77. data/lib/active_merchant/billing/gateways/eway.rb +9 -9
  78. data/lib/active_merchant/billing/gateways/eway_managed.rb +55 -56
  79. data/lib/active_merchant/billing/gateways/eway_rapid.rb +37 -22
  80. data/lib/active_merchant/billing/gateways/exact.rb +19 -20
  81. data/lib/active_merchant/billing/gateways/ezic.rb +9 -9
  82. data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -19
  83. data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -7
  84. data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
  85. data/lib/active_merchant/billing/gateways/first_giving.rb +5 -4
  86. data/lib/active_merchant/billing/gateways/first_pay.rb +7 -7
  87. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +39 -38
  88. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +51 -31
  89. data/lib/active_merchant/billing/gateways/flo2cash.rb +24 -24
  90. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  91. data/lib/active_merchant/billing/gateways/forte.rb +38 -22
  92. data/lib/active_merchant/billing/gateways/garanti.rb +12 -15
  93. data/lib/active_merchant/billing/gateways/global_collect.rb +333 -89
  94. data/lib/active_merchant/billing/gateways/global_transport.rb +8 -9
  95. data/lib/active_merchant/billing/gateways/hdfc.rb +22 -23
  96. data/lib/active_merchant/billing/gateways/hps.rb +171 -50
  97. data/lib/active_merchant/billing/gateways/iats_payments.rb +47 -25
  98. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  99. data/lib/active_merchant/billing/gateways/inspire.rb +22 -27
  100. data/lib/active_merchant/billing/gateways/instapay.rb +5 -8
  101. data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
  102. data/lib/active_merchant/billing/gateways/ipp.rb +9 -9
  103. data/lib/active_merchant/billing/gateways/iridium.rb +30 -31
  104. data/lib/active_merchant/billing/gateways/itransact.rb +11 -10
  105. data/lib/active_merchant/billing/gateways/iveri.rb +62 -23
  106. data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
  107. data/lib/active_merchant/billing/gateways/jetpay.rb +10 -17
  108. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +13 -18
  109. data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
  110. data/lib/active_merchant/billing/gateways/kushki.rb +100 -22
  111. data/lib/active_merchant/billing/gateways/latitude19.rb +20 -19
  112. data/lib/active_merchant/billing/gateways/linkpoint.rb +71 -72
  113. data/lib/active_merchant/billing/gateways/litle.rb +181 -45
  114. data/lib/active_merchant/billing/gateways/mastercard.rb +16 -22
  115. data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
  116. data/lib/active_merchant/billing/gateways/mercado_pago.rb +89 -18
  117. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +58 -24
  118. data/lib/active_merchant/billing/gateways/merchant_one.rb +7 -10
  119. data/lib/active_merchant/billing/gateways/merchant_partners.rb +19 -19
  120. data/lib/active_merchant/billing/gateways/merchant_ware.rb +18 -22
  121. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +15 -17
  122. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +46 -8
  123. data/lib/active_merchant/billing/gateways/mercury.rb +19 -23
  124. data/lib/active_merchant/billing/gateways/metrics_global.rb +24 -33
  125. data/lib/active_merchant/billing/gateways/micropayment.rb +11 -12
  126. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
  127. data/lib/active_merchant/billing/gateways/migs.rb +18 -21
  128. data/lib/active_merchant/billing/gateways/mit.rb +260 -0
  129. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +10 -12
  130. data/lib/active_merchant/billing/gateways/moka.rb +290 -0
  131. data/lib/active_merchant/billing/gateways/monei.rb +236 -150
  132. data/lib/active_merchant/billing/gateways/moneris.rb +122 -53
  133. data/lib/active_merchant/billing/gateways/money_movers.rb +6 -7
  134. data/lib/active_merchant/billing/gateways/mundipagg.rb +69 -23
  135. data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -20
  136. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +10 -12
  137. data/lib/active_merchant/billing/gateways/net_registry.rb +8 -9
  138. data/lib/active_merchant/billing/gateways/netaxept.rb +12 -12
  139. data/lib/active_merchant/billing/gateways/netbanx.rb +128 -46
  140. data/lib/active_merchant/billing/gateways/netbilling.rb +18 -21
  141. data/lib/active_merchant/billing/gateways/netpay.rb +5 -4
  142. data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -10
  143. data/lib/active_merchant/billing/gateways/nmi.rb +69 -27
  144. data/lib/active_merchant/billing/gateways/ogone.rb +62 -31
  145. data/lib/active_merchant/billing/gateways/omise.rb +15 -16
  146. data/lib/active_merchant/billing/gateways/openpay.rb +33 -15
  147. data/lib/active_merchant/billing/gateways/opp.rb +39 -33
  148. data/lib/active_merchant/billing/gateways/optimal_payment.rb +43 -42
  149. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
  150. data/lib/active_merchant/billing/gateways/orbital.rb +623 -362
  151. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +20 -20
  152. data/lib/active_merchant/billing/gateways/pagarme.rb +16 -23
  153. data/lib/active_merchant/billing/gateways/pago_facil.rb +4 -6
  154. data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
  155. data/lib/active_merchant/billing/gateways/pay_conex.rb +17 -17
  156. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -33
  157. data/lib/active_merchant/billing/gateways/pay_hub.rb +10 -10
  158. data/lib/active_merchant/billing/gateways/pay_junction.rb +31 -31
  159. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +36 -18
  160. data/lib/active_merchant/billing/gateways/pay_secure.rb +10 -11
  161. data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
  162. data/lib/active_merchant/billing/gateways/paybox_direct.rb +64 -40
  163. data/lib/active_merchant/billing/gateways/payeezy.rb +130 -27
  164. data/lib/active_merchant/billing/gateways/payex.rb +24 -25
  165. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +17 -17
  166. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
  167. data/lib/active_merchant/billing/gateways/payflow.rb +103 -25
  168. data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
  169. data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
  170. data/lib/active_merchant/billing/gateways/payment_express.rb +22 -18
  171. data/lib/active_merchant/billing/gateways/paymentez.rb +89 -24
  172. data/lib/active_merchant/billing/gateways/paymill.rb +14 -16
  173. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
  174. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
  175. data/lib/active_merchant/billing/gateways/paypal.rb +13 -5
  176. data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
  177. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
  178. data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -1
  179. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  180. data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
  181. data/lib/active_merchant/billing/gateways/payscout.rb +8 -9
  182. data/lib/active_merchant/billing/gateways/paystation.rb +6 -9
  183. data/lib/active_merchant/billing/gateways/payu_in.rb +20 -19
  184. data/lib/active_merchant/billing/gateways/payu_latam.rb +70 -37
  185. data/lib/active_merchant/billing/gateways/payway.rb +22 -22
  186. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
  187. data/lib/active_merchant/billing/gateways/pin.rb +60 -21
  188. data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
  189. data/lib/active_merchant/billing/gateways/plugnpay.rb +20 -21
  190. data/lib/active_merchant/billing/gateways/priority.rb +392 -0
  191. data/lib/active_merchant/billing/gateways/pro_pay.rb +13 -14
  192. data/lib/active_merchant/billing/gateways/psigate.rb +29 -29
  193. data/lib/active_merchant/billing/gateways/psl_card.rb +7 -8
  194. data/lib/active_merchant/billing/gateways/qbms.rb +25 -26
  195. data/lib/active_merchant/billing/gateways/quantum.rb +9 -11
  196. data/lib/active_merchant/billing/gateways/quickbooks.rb +126 -39
  197. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +98 -98
  198. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +19 -23
  199. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
  200. data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
  201. data/lib/active_merchant/billing/gateways/qvalent.rb +36 -20
  202. data/lib/active_merchant/billing/gateways/rapyd.rb +319 -0
  203. data/lib/active_merchant/billing/gateways/reach.rb +277 -0
  204. data/lib/active_merchant/billing/gateways/realex.rb +42 -16
  205. data/lib/active_merchant/billing/gateways/redsys.rb +191 -86
  206. data/lib/active_merchant/billing/gateways/s5.rb +10 -9
  207. data/lib/active_merchant/billing/gateways/safe_charge.rb +70 -33
  208. data/lib/active_merchant/billing/gateways/sage.rb +19 -21
  209. data/lib/active_merchant/billing/gateways/sage_pay.rb +57 -57
  210. data/lib/active_merchant/billing/gateways/sallie_mae.rb +3 -4
  211. data/lib/active_merchant/billing/gateways/secure_net.rb +19 -26
  212. data/lib/active_merchant/billing/gateways/secure_pay.rb +24 -33
  213. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +18 -20
  214. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +4 -5
  215. data/lib/active_merchant/billing/gateways/securion_pay.rb +48 -7
  216. data/lib/active_merchant/billing/gateways/shift4.rb +345 -0
  217. data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
  218. data/lib/active_merchant/billing/gateways/skip_jack.rb +19 -19
  219. data/lib/active_merchant/billing/gateways/smart_ps.rb +26 -32
  220. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +24 -25
  221. data/lib/active_merchant/billing/gateways/spreedly_core.rb +27 -21
  222. data/lib/active_merchant/billing/gateways/stripe.rb +126 -53
  223. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +441 -113
  224. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +7 -8
  225. data/lib/active_merchant/billing/gateways/telr.rb +17 -18
  226. data/lib/active_merchant/billing/gateways/tns.rb +3 -7
  227. data/lib/active_merchant/billing/gateways/trans_first.rb +10 -9
  228. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +28 -24
  229. data/lib/active_merchant/billing/gateways/transact_pro.rb +13 -15
  230. data/lib/active_merchant/billing/gateways/transax.rb +1 -2
  231. data/lib/active_merchant/billing/gateways/trexle.rb +5 -2
  232. data/lib/active_merchant/billing/gateways/trust_commerce.rb +57 -47
  233. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -2
  234. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +176 -184
  235. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +60 -48
  236. data/lib/active_merchant/billing/gateways/vanco.rb +17 -8
  237. data/lib/active_merchant/billing/gateways/verifi.rb +13 -14
  238. data/lib/active_merchant/billing/gateways/viaklix.rb +9 -14
  239. data/lib/active_merchant/billing/gateways/visanet_peru.rb +26 -21
  240. data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
  241. data/lib/active_merchant/billing/gateways/webpay.rb +4 -4
  242. data/lib/active_merchant/billing/gateways/wepay.rb +14 -16
  243. data/lib/active_merchant/billing/gateways/wirecard.rb +14 -16
  244. data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
  245. data/lib/active_merchant/billing/gateways/world_net.rb +36 -35
  246. data/lib/active_merchant/billing/gateways/worldpay.rb +556 -190
  247. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +47 -54
  248. data/lib/active_merchant/billing/gateways/worldpay_us.rb +16 -16
  249. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +2 -2
  250. data/lib/active_merchant/billing/response.rb +25 -6
  251. data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
  252. data/lib/active_merchant/billing.rb +1 -0
  253. data/lib/active_merchant/connection.rb +14 -15
  254. data/lib/active_merchant/country.rb +3 -1
  255. data/lib/active_merchant/errors.rb +4 -1
  256. data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
  257. data/lib/active_merchant/network_connection_retries.rb +15 -17
  258. data/lib/active_merchant/post_data.rb +3 -2
  259. data/lib/active_merchant/posts_data.rb +2 -2
  260. data/lib/active_merchant/version.rb +1 -1
  261. data/lib/active_merchant.rb +2 -2
  262. data/lib/certs/cacert.pem +1587 -2361
  263. data/lib/support/gateway_support.rb +1 -1
  264. data/lib/support/ssl_verify.rb +3 -7
  265. data/lib/support/ssl_version.rb +2 -3
  266. metadata +86 -34
  267. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Active Merchant
2
- [![Build Status](https://travis-ci.org/activemerchant/active_merchant.png?branch=master)](https://travis-ci.org/activemerchant/active_merchant)
3
- [![Code Climate](https://codeclimate.com/github/activemerchant/active_merchant.png)](https://codeclimate.com/github/activemerchant/active_merchant)
2
+ [![Build Status](https://github.com/activemerchant/active_merchant/workflows/CI/badge.svg?branch=master)](https://github.com/activemerchant/active_merchant/actions?query=workflow%3ACI)
3
+ [![Code Climate](https://codeclimate.com/github/activemerchant/active_merchant.svg)](https://codeclimate.com/github/activemerchant/active_merchant)
4
4
 
5
5
  Active Merchant is an extraction from the ecommerce system [Shopify](http://www.shopify.com).
6
6
  Shopify's requirements for a simple and unified API to access dozens of different payment
@@ -17,7 +17,7 @@ from an ever-growing set of contributors.
17
17
  See [GettingStarted.md](GettingStarted.md) if you want to learn more about using Active Merchant in your
18
18
  applications.
19
19
 
20
- If you'd like to contribute to Active Merchant, please start with our [contribution guide](CONTRIBUTING.md).
20
+ If you'd like to contribute to Active Merchant, please start with our [Contribution Guide](https://github.com/activemerchant/active_merchant/wiki/Contributing).
21
21
 
22
22
  ## Installation
23
23
 
@@ -81,6 +81,8 @@ if credit_card.validate.empty?
81
81
  end
82
82
  ```
83
83
 
84
+ ## Contributing
85
+
84
86
  For more in-depth documentation and tutorials, see [GettingStarted.md](GettingStarted.md) and the
85
87
  [API documentation](http://www.rubydoc.info/github/activemerchant/active_merchant/).
86
88
 
@@ -91,8 +93,9 @@ guide and [Standardized 3DS Fields](https://github.com/activemerchant/active_mer
91
93
 
92
94
  The [ActiveMerchant Wiki](https://github.com/activemerchant/active_merchant/wikis) contains a [table of features supported by each gateway](https://github.com/activemerchant/active_merchant/wiki/Gateway-Feature-Matrix).
93
95
 
96
+ * [Adyen](https://www.adyen.com/) - US, AT, AU, BE, BG, BR, CH, CY, CZ, DE, DK, EE, ES, FI, FR, GB, GI, GR, HK, HU, IE, IS, IT, LI, LT, LU, LV, MC, MT, MX, NL, NO, PL, PT, RO, SE, SG, SK, SI
94
97
  * [Authorize.Net CIM](http://www.authorize.net/) - US
95
- * [Authorize.Net](http://www.authorize.net/) - AD, AT, AU, BE, BG, CA, CH, CY, CZ, DE, DK, ES, FI, FR, GB, GB, GI, GR, HU, IE, IT, LI, LU, MC, MT, NL, NO, PL, PT, RO, SE, SI, SK, SM, TR, US, VA
98
+ * [Authorize.Net](http://www.authorize.net/) - AU, CA, US
96
99
  * [Axcess MS](http://www.axcessms.com/) - AD, AT, BE, BG, BR, CA, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GI, GR, HR, HU, IE, IL, IM, IS, IT, LI, LT, LU, LV, MC, MT, MX, NL, NO, PL, PT, RO, RU, SE, SI, SK, TR, US, VA
97
100
  * [Balanced](https://www.balancedpayments.com/) - US
98
101
  * [Bambora Asia-Pacific](http://www.bambora.com/) - AU, NZ
@@ -112,7 +115,7 @@ The [ActiveMerchant Wiki](https://github.com/activemerchant/active_merchant/wiki
112
115
  * [Cecabank](http://www.ceca.es/es/) - ES
113
116
  * [Cenpos](https://www.cenpos.com/) - AD, AI, AG, AR, AU, AT, BS, BB, BE, BZ, BM, BR, BN, BG, CA, HR, CY, CZ, DK, DM, EE, FI, FR, DE, GR, GD, GY, HK, HU, IS, IN, IL, IT, JP, LV, LI, LT, LU, MY, MT, MX, MC, MS, NL, PA, PL, PT, KN, LC, MF, VC, SM, SG, SK, SI, ZA, ES, SR, SE, CH, TR, GB, US, UY
114
117
  * [CAMS: Central Account Management System](https://www.centralams.com/) - US
115
- * [Checkout.com](https://www.checkout.com/) - AT, BE, BG, CY, CZ, DE, DK, EE, ES, FI, FR, GR, HR, HU, IE, IS, IT, LI, LT, LU, LV, MT, MU, NL, NO, PL, PT, RO, SE, SI, SK, US
118
+ * [Checkout.com](https://www.checkout.com/) - AD, AE, AR, AT, AU, BE, BG, BH, BR, CH, CL, CN, CO, CY, CZ, DE, DK, EE, EG, ES, FI, FR, GB, GR, HK, HR, HU, IE, IS, IT, JO, JP, KW, LI, LT, LU, LV, MC, MT, MX, MY, NL, NO, NZ, OM, PE, PL, PT, QA, RO, SA, SE, SG, SI, SK, SM, TR, US
116
119
  * [Clearhaus](https://www.clearhaus.com) - AD, AT, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GL, GR, HR, HU, IE, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK
117
120
  * [Commercegate](http://www.commercegate.com/) - AD, AT, AX, BE, BG, CH, CY, CZ, DE, DK, ES, FI, FR, GB, GG, GI, GR, HR, HU, IE, IM, IS, IT, JE, LI, LT, LU, LV, MC, MT, NL, NO, PL, PT, RO, SE, SI, SK, VA
118
121
  * [Conekta](https://conekta.io) - MX
@@ -157,9 +160,8 @@ The [ActiveMerchant Wiki](https://github.com/activemerchant/active_merchant/wiki
157
160
  * [Metrics Global](http://www.metricsglobal.com) - US
158
161
  * [MasterCard Internet Gateway Service (MiGS)](http://mastercard.com/mastercardsps) - AU, AE, BD, BN, EG, HK, ID, IN, JO, KW, LB, LK, MU, MV, MY, NZ, OM, PH, QA, SA, SG, TT, VN
159
162
  * [Modern Payments](http://www.modpay.com) - US
160
- * [MONEI](http://www.monei.net/) - AD, AT, BE, BG, CA, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GI, GR, HU, IE, IL, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK, TR, US, VA
163
+ * [MONEI](http://www.monei.com/) - AD, AT, BE, BG, CA, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GI, GR, HU, IE, IL, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK, TR, US, VA
161
164
  * [Moneris](http://www.moneris.com/) - CA
162
- * [Moneris (US)](http://www.monerisusa.com/) - US
163
165
  * [MoneyMovers](http://mmoa.us/) - US
164
166
  * [NAB Transact](http://transact.nab.com.au) - AU
165
167
  * [NELiX TransaX](https://www.nelixtransax.com/) - US
@@ -183,7 +185,7 @@ The [ActiveMerchant Wiki](https://github.com/activemerchant/active_merchant/wiki
183
185
  * [Paybox Direct](http://www.paybox.com/) - FR
184
186
  * [Payeezy](https://developer.payeezy.com/) - CA, US
185
187
  * [Payex](http://payex.com/) - DK, FI, NO, SE
186
- * [PaymentExpress](http://www.paymentexpress.com/) - AU, CA, DE, ES, FR, GB, HK, IE, MY, NL, NZ, SG, US, ZA
188
+ * [Windcave (formerly PaymentExpress)](https://www.windcave.com/) - AU, CA, DE, ES, FR, GB, HK, IE, MY, NL, NZ, SG, US, ZA
187
189
  * [PAYMILL](https://paymill.com) - AD, AT, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GI, GR, HU, IE, IL, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK, TR, VA
188
190
  * [PayPal Express Checkout](https://www.paypal.com/webapps/mpp/express-checkout) - US, CA, SG, AU
189
191
  * [PayPal Express Checkout (UK)](https://www.paypal.com/uk/webapps/mpp/express-checkout) - GB
@@ -244,4 +246,4 @@ Functionality or APIs that are deprecated will be marked as such. Deprecated fun
244
246
 
245
247
  ## Ruby and Rails compatibility policies
246
248
 
247
- Because Active Merchant is a payment library, it needs to take security seriously. For this reason, Active Merchant guarantees compatibility only with actively supported versions of Ruby and Rails. At the time of this writing, that means that Ruby 2.3+ and Rails 4.2+ are supported.
249
+ Because Active Merchant is a payment library, it needs to take security seriously. For this reason, Active Merchant guarantees compatibility only with actively supported versions of Ruby and Rails. At the time of this writing, that means that Ruby 2.5+ and Rails 5.0+ are supported.
@@ -39,10 +39,10 @@ module ActiveMerchant
39
39
 
40
40
  # Map vendor's AVS result code to a postal match code
41
41
  POSTAL_MATCH_CODE = {
42
- 'Y' => %w( D H F H J L M P Q V W X Y Z ),
43
- 'N' => %w( A C K N O ),
44
- 'X' => %w( G S ),
45
- nil => %w( B E I R T U )
42
+ 'Y' => %w(D H F H J L M P Q V W X Y Z),
43
+ 'N' => %w(A C K N O),
44
+ 'X' => %w(G S),
45
+ nil => %w(B E I R T U)
46
46
  }.inject({}) do |map, (type, codes)|
47
47
  codes.each { |code| map[code] = type }
48
48
  map
@@ -50,10 +50,10 @@ module ActiveMerchant
50
50
 
51
51
  # Map vendor's AVS result code to a street match code
52
52
  STREET_MATCH_CODE = {
53
- 'Y' => %w( A B D H J M O Q T V X Y ),
54
- 'N' => %w( C K L N W Z ),
55
- 'X' => %w( G S ),
56
- nil => %w( E F I P R U )
53
+ 'Y' => %w(A B D H J M O Q T V X Y),
54
+ 'N' => %w(C K L N W Z),
55
+ 'X' => %w(G S),
56
+ nil => %w(E F I P R U)
57
57
  }.inject({}) do |map, (type, codes)|
58
58
  codes.each { |code| map[code] = type }
59
59
  map
@@ -88,7 +88,7 @@ module ActiveMerchant
88
88
  { 'code' => code,
89
89
  'message' => message,
90
90
  'street_match' => street_match,
91
- 'postal_match' => postal_match}
91
+ 'postal_match' => postal_match }
92
92
  end
93
93
  end
94
94
  end
@@ -39,19 +39,6 @@ module ActiveMerchant #:nodoc:
39
39
  end
40
40
  end
41
41
 
42
- # Return the matching integration module
43
- # You can then get the notification from the module
44
- # * <tt>bogus</tt>: Bogus - Does nothing (for testing)
45
- # * <tt>chronopay</tt>: Chronopay
46
- # * <tt>paypal</tt>: Paypal
47
- #
48
- # chronopay = ActiveMerchant::Billing::Base.integration('chronopay')
49
- # notification = chronopay.notification(raw_post)
50
- #
51
- def self.integration(name)
52
- Billing::Integrations.const_get(name.to_s.downcase.camelize)
53
- end
54
-
55
42
  # A check to see if we're in test mode
56
43
  def self.test?
57
44
  mode == :test
@@ -13,6 +13,16 @@ module ActiveMerchant #:nodoc:
13
13
  # Used for Canadian bank accounts
14
14
  attr_accessor :institution_number, :transit_number
15
15
 
16
+ # Canadian Institution Numbers
17
+ # Partial list found here: https://en.wikipedia.org/wiki/Routing_number_(Canada)
18
+ CAN_INSTITUTION_NUMBERS = %w(
19
+ 001 002 003 004 006 010 016 030 039 117 127 177 219 245 260 269 270 308
20
+ 309 310 315 320 338 340 509 540 608 614 623 809 815 819 828 829 837 839
21
+ 865 879 889 899 241 242 248 250 265 275 277 290 294 301 303 307 311 314
22
+ 321 323 327 328 330 332 334 335 342 343 346 352 355 361 362 366 370 372
23
+ 376 378 807 853 890 618 842
24
+ )
25
+
16
26
  def name
17
27
  @name ||= "#{first_name} #{last_name}".strip
18
28
  end
@@ -29,19 +39,15 @@ module ActiveMerchant #:nodoc:
29
39
  def validate
30
40
  errors = []
31
41
 
32
- [:name, :routing_number, :account_number].each do |attr|
42
+ %i[name routing_number account_number].each do |attr|
33
43
  errors << [attr, 'cannot be empty'] if empty?(self.send(attr))
34
44
  end
35
45
 
36
46
  errors << [:routing_number, 'is invalid'] unless valid_routing_number?
37
47
 
38
- if(!empty?(account_holder_type) && !%w[business personal].include?(account_holder_type.to_s))
39
- errors << [:account_holder_type, 'must be personal or business']
40
- end
48
+ errors << [:account_holder_type, 'must be personal or business'] if !empty?(account_holder_type) && !%w[business personal].include?(account_holder_type.to_s)
41
49
 
42
- if(!empty?(account_type) && !%w[checking savings].include?(account_type.to_s))
43
- errors << [:account_type, 'must be checking or savings']
44
- end
50
+ errors << [:account_type, 'must be checking or savings'] if !empty?(account_type) && !%w[checking savings].include?(account_type.to_s)
45
51
 
46
52
  errors_hash(errors)
47
53
  end
@@ -54,25 +60,51 @@ module ActiveMerchant #:nodoc:
54
60
  false
55
61
  end
56
62
 
63
+ def valid_routing_number?
64
+ digits = routing_number.to_s.split('').map(&:to_i).select { |d| (0..9).cover?(d) }
65
+ case digits.size
66
+ when 9
67
+ return checksum(digits) == 0 || CAN_INSTITUTION_NUMBERS.include?(routing_number[1..3])
68
+ when 8
69
+ return CAN_INSTITUTION_NUMBERS.include?(routing_number[5..7])
70
+ end
71
+
72
+ false
73
+ end
74
+
57
75
  # Routing numbers may be validated by calculating a checksum and dividing it by 10. The
58
76
  # formula is:
59
77
  # (3(d1 + d4 + d7) + 7(d2 + d5 + d8) + 1(d3 + d6 + d9))mod 10 = 0
60
78
  # See http://en.wikipedia.org/wiki/Routing_transit_number#Internal_checksums
61
- def valid_routing_number?
79
+ def checksum(digits)
80
+ ((3 * (digits[0] + digits[3] + digits[6])) +
81
+ (7 * (digits[1] + digits[4] + digits[7])) +
82
+ (digits[2] + digits[5] + digits[8])) % 10
83
+ end
84
+
85
+ # Always return MICR-formatted routing number for Canadian routing numbers, US routing numbers unchanged
86
+ def micr_format_routing_number
62
87
  digits = routing_number.to_s.split('').map(&:to_i).select { |d| (0..9).cover?(d) }
63
88
  case digits.size
64
89
  when 9
65
- checksum = ((3 * (digits[0] + digits[3] + digits[6])) +
66
- (7 * (digits[1] + digits[4] + digits[7])) +
67
- (digits[2] + digits[5] + digits[8])) % 10
68
- case checksum
69
- when 0
70
- true
90
+ if checksum(digits) == 0
91
+ return routing_number
71
92
  else
72
- false
93
+ return routing_number[4..8] + routing_number[1..3]
73
94
  end
74
- else
75
- false
95
+ when 8
96
+ return routing_number
97
+ end
98
+ end
99
+
100
+ # Always return electronic-formatted routing number for Canadian routing numbers, US routing numbers unchanged
101
+ def electronic_format_routing_number
102
+ digits = routing_number.to_s.split('').map(&:to_i).select { |d| (0..9).cover?(d) }
103
+ case digits.size
104
+ when 9
105
+ return routing_number
106
+ when 8
107
+ return '0' + routing_number[5..7] + routing_number[0..4]
76
108
  end
77
109
  end
78
110
  end
@@ -28,7 +28,7 @@ module ActiveMerchant
28
28
  def self.humanize(lower_case_and_underscored_word)
29
29
  result = lower_case_and_underscored_word.to_s.dup
30
30
  result.gsub!(/_id$/, '')
31
- result.gsub!(/_/, ' ')
31
+ result.tr!('_', ' ')
32
32
  result.gsub(/([a-z\d]*)/i, &:downcase).gsub(/^\w/) { $&.upcase }
33
33
  end
34
34
  end
@@ -56,7 +56,7 @@ module ActiveMerchant
56
56
  private
57
57
 
58
58
  def internal_errors
59
- @errors ||= Errors.new
59
+ @internal_errors ||= Errors.new
60
60
  end
61
61
 
62
62
  class Errors < Hash
@@ -75,7 +75,7 @@ module ActiveMerchant
75
75
  end
76
76
 
77
77
  def empty?
78
- all? { |k, v| v&.empty? }
78
+ all? { |_k, v| v&.empty? }
79
79
  end
80
80
 
81
81
  def on(field)
@@ -98,7 +98,8 @@ module ActiveMerchant
98
98
  result = []
99
99
 
100
100
  self.each do |key, messages|
101
- next unless(messages && !messages.empty?)
101
+ next unless messages && !messages.empty?
102
+
102
103
  if key == 'base'
103
104
  result << messages.first.to_s
104
105
  else
@@ -18,10 +18,27 @@ module ActiveMerchant #:nodoc:
18
18
  # * Dankort
19
19
  # * Maestro
20
20
  # * Forbrugsforeningen
21
+ # * Sodexo
22
+ # * Vr
23
+ # * Carnet
24
+ # * Synchrony
25
+ # * Routex
21
26
  # * Elo
22
27
  # * Alelo
23
28
  # * Cabal
24
29
  # * Naranja
30
+ # * UnionPay
31
+ # * Alia
32
+ # * Olimpica
33
+ # * Creditel
34
+ # * Confiable
35
+ # * Mada
36
+ # * BpPlus
37
+ # * Passcard
38
+ # * Edenred
39
+ # * Anda
40
+ # * Creditos directos (Tarjeta D)
41
+ # * Panal
25
42
  #
26
43
  # For testing purposes, use the 'bogus' credit card brand. This skips the vast majority of
27
44
  # validations, allowing you to focus on your core concerns until you're ready to be more concerned
@@ -51,6 +68,8 @@ module ActiveMerchant #:nodoc:
51
68
  class CreditCard < Model
52
69
  include CreditCardMethods
53
70
 
71
+ BRANDS_WITH_SPACES_IN_NUMBER = %w(bp_plus)
72
+
54
73
  class << self
55
74
  # Inherited, but can be overridden w/o changing parent's value
56
75
  attr_accessor :require_verification_value
@@ -66,7 +85,7 @@ module ActiveMerchant #:nodoc:
66
85
  attr_reader :number
67
86
 
68
87
  def number=(value)
69
- @number = (empty?(value) ? value : value.to_s.gsub(/[^\d]/, ''))
88
+ @number = (empty?(value) ? value : filter_number(value))
70
89
  end
71
90
 
72
91
  # Returns or sets the expiry month for the card.
@@ -92,10 +111,27 @@ module ActiveMerchant #:nodoc:
92
111
  # * +'dankort'+
93
112
  # * +'maestro'+
94
113
  # * +'forbrugsforeningen'+
114
+ # * +'sodexo'+
115
+ # * +'vr'+
116
+ # * +'carnet'+
117
+ # * +'synchrony'+
118
+ # * +'routex'+
95
119
  # * +'elo'+
96
120
  # * +'alelo'+
97
121
  # * +'cabal'+
98
122
  # * +'naranja'+
123
+ # * +'union_pay'+
124
+ # * +'alia'+
125
+ # * +'olimpica'+
126
+ # * +'creditel'+
127
+ # * +'confiable'+
128
+ # * +'mada'+
129
+ # * +'bp_plus'+
130
+ # * +'passcard'+
131
+ # * +'edenred'+
132
+ # * +'anda'+
133
+ # * +'tarjeta-d'+
134
+ # * +'panal'+
99
135
  #
100
136
  # Or, if you wish to test your implementation, +'bogus'+.
101
137
  #
@@ -186,7 +222,7 @@ module ActiveMerchant #:nodoc:
186
222
  'contactless' => 'Data was read by a Contactless EMV kernel. Issuer script results are not available.',
187
223
  'contactless_magstripe' => 'Contactless data was read with a non-EMV protocol.',
188
224
  'contact' => 'Data was read using the EMV protocol. Issuer script results may follow.',
189
- 'contact_quickchip' => 'Data was read by the Quickchip EMV kernel. Issuer script results are not available.',
225
+ 'contact_quickchip' => 'Data was read by the Quickchip EMV kernel. Issuer script results are not available.'
190
226
  }
191
227
 
192
228
  # Returns the ciphertext of the card's encrypted PIN.
@@ -317,8 +353,21 @@ module ActiveMerchant #:nodoc:
317
353
  icc_data.present?
318
354
  end
319
355
 
356
+ def allow_spaces_in_card?(number = nil)
357
+ BRANDS_WITH_SPACES_IN_NUMBER.include?(self.class.brand?(self.number || number))
358
+ end
359
+
320
360
  private
321
361
 
362
+ def filter_number(value)
363
+ regex = if allow_spaces_in_card?(value)
364
+ /[^\d ]/
365
+ else
366
+ /[^\d]/
367
+ end
368
+ value.to_s.gsub(regex, '')
369
+ end
370
+
322
371
  def validate_essential_attributes #:nodoc:
323
372
  errors = []
324
373
 
@@ -327,7 +376,7 @@ module ActiveMerchant #:nodoc:
327
376
  errors << [:last_name, 'cannot be empty'] if last_name.blank?
328
377
  end
329
378
 
330
- if(empty?(month) || empty?(year))
379
+ if empty?(month) || empty?(year)
331
380
  errors << [:month, 'is required'] if empty?(month)
332
381
  errors << [:year, 'is required'] if empty?(year)
333
382
  else
@@ -336,7 +385,7 @@ module ActiveMerchant #:nodoc:
336
385
  if expired?
337
386
  errors << [:year, 'expired']
338
387
  else
339
- errors << [:year, 'is not a valid year'] if !valid_expiry_year?(year)
388
+ errors << [:year, 'is not a valid year'] if !valid_expiry_year?(year)
340
389
  end
341
390
  end
342
391
 
@@ -347,7 +396,7 @@ module ActiveMerchant #:nodoc:
347
396
  errors = []
348
397
 
349
398
  if !empty?(brand)
350
- errors << [:brand, 'is invalid'] if !CreditCard.card_companies.include?(brand)
399
+ errors << [:brand, 'is invalid'] if !CreditCard.card_companies.include?(brand)
351
400
  end
352
401
 
353
402
  if empty?(number)
@@ -367,9 +416,7 @@ module ActiveMerchant #:nodoc:
367
416
  errors = []
368
417
 
369
418
  if verification_value?
370
- unless valid_card_verification_value?(verification_value, brand)
371
- errors << [:verification_value, "should be #{card_verification_value_length(brand)} digits"]
372
- end
419
+ errors << [:verification_value, "should be #{card_verification_value_length(brand)} digits"] unless valid_card_verification_value?(verification_value, brand)
373
420
  elsif requires_verification_value? && !valid_card_verification_value?(verification_value, brand)
374
421
  errors << [:verification_value, 'is required']
375
422
  end
@@ -15,6 +15,7 @@ module ActiveMerchant #:nodoc:
15
15
  case option
16
16
  when :two_digits then sprintf('%.2i', number.to_i)[-2..-1]
17
17
  when :four_digits then sprintf('%.4i', number.to_i)[-4..-1]
18
+ when :four_digits_year then number.to_s.length == 2 ? '20' + number.to_s : format(number, :four_digits)
18
19
  else number
19
20
  end
20
21
  end