activemerchant 1.133.0 → 1.138.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +450 -0
  3. data/CONTRIBUTORS +1 -0
  4. data/lib/active_merchant/billing/apple_pay_payment_token.rb +2 -2
  5. data/lib/active_merchant/billing/base.rb +2 -2
  6. data/lib/active_merchant/billing/check.rb +16 -4
  7. data/lib/active_merchant/billing/compatibility.rb +4 -4
  8. data/lib/active_merchant/billing/credit_card.rb +35 -16
  9. data/lib/active_merchant/billing/credit_card_formatting.rb +13 -2
  10. data/lib/active_merchant/billing/credit_card_methods.rb +74 -19
  11. data/lib/active_merchant/billing/gateway.rb +22 -2
  12. data/lib/active_merchant/billing/gateways/adyen.rb +282 -87
  13. data/lib/active_merchant/billing/gateways/airwallex.rb +46 -25
  14. data/lib/active_merchant/billing/gateways/alelo.rb +29 -11
  15. data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
  16. data/lib/active_merchant/billing/gateways/authorize_net.rb +49 -41
  17. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +14 -10
  18. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -5
  19. data/lib/active_merchant/billing/gateways/axcessms.rb +9 -5
  20. data/lib/active_merchant/billing/gateways/balanced.rb +2 -2
  21. data/lib/active_merchant/billing/gateways/bambora_apac.rb +2 -2
  22. data/lib/active_merchant/billing/gateways/bank_frick.rb +2 -2
  23. data/lib/active_merchant/billing/gateways/banwire.rb +6 -4
  24. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +8 -8
  25. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +2 -2
  26. data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
  27. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +12 -8
  28. data/lib/active_merchant/billing/gateways/beanstream.rb +2 -2
  29. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +2 -2
  30. data/lib/active_merchant/billing/gateways/blue_pay.rb +15 -7
  31. data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -5
  32. data/lib/active_merchant/billing/gateways/bogus.rb +2 -2
  33. data/lib/active_merchant/billing/gateways/borgun.rb +2 -2
  34. data/lib/active_merchant/billing/gateways/bpoint.rb +2 -2
  35. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +3 -1
  36. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +68 -23
  37. data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
  38. data/lib/active_merchant/billing/gateways/braintree_blue.rb +266 -89
  39. data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -3
  40. data/lib/active_merchant/billing/gateways/bridge_pay.rb +2 -2
  41. data/lib/active_merchant/billing/gateways/cams.rb +2 -2
  42. data/lib/active_merchant/billing/gateways/card_connect.rb +7 -4
  43. data/lib/active_merchant/billing/gateways/card_save.rb +2 -2
  44. data/lib/active_merchant/billing/gateways/card_stream.rb +12 -13
  45. data/lib/active_merchant/billing/gateways/cardknox.rb +2 -2
  46. data/lib/active_merchant/billing/gateways/cardprocess.rb +2 -2
  47. data/lib/active_merchant/billing/gateways/cashnet.rb +4 -4
  48. data/lib/active_merchant/billing/gateways/cc5.rb +2 -2
  49. data/lib/active_merchant/billing/gateways/cecabank/cecabank_common.rb +36 -0
  50. data/lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb +331 -0
  51. data/lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb +220 -0
  52. data/lib/active_merchant/billing/gateways/cecabank.rb +9 -242
  53. data/lib/active_merchant/billing/gateways/cenpos.rb +9 -3
  54. data/lib/active_merchant/billing/gateways/checkout.rb +5 -5
  55. data/lib/active_merchant/billing/gateways/checkout_v2.rb +362 -50
  56. data/lib/active_merchant/billing/gateways/clearhaus.rb +2 -2
  57. data/lib/active_merchant/billing/gateways/commerce_hub.rb +117 -35
  58. data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
  59. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  60. data/lib/active_merchant/billing/gateways/creditcall.rb +2 -2
  61. data/lib/active_merchant/billing/gateways/credorax.rb +109 -20
  62. data/lib/active_merchant/billing/gateways/ct_payment.rb +6 -6
  63. data/lib/active_merchant/billing/gateways/culqi.rb +2 -2
  64. data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +2 -2
  65. data/lib/active_merchant/billing/gateways/cyber_source.rb +379 -100
  66. data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +147 -76
  67. data/lib/active_merchant/billing/gateways/d_local.rb +45 -22
  68. data/lib/active_merchant/billing/gateways/data_cash.rb +22 -18
  69. data/lib/active_merchant/billing/gateways/datatrans.rb +284 -0
  70. data/lib/active_merchant/billing/gateways/decidir.rb +82 -46
  71. data/lib/active_merchant/billing/gateways/decidir_plus.rb +31 -35
  72. data/lib/active_merchant/billing/gateways/deepstack.rb +382 -0
  73. data/lib/active_merchant/billing/gateways/dibs.rb +3 -3
  74. data/lib/active_merchant/billing/gateways/digitzs.rb +2 -2
  75. data/lib/active_merchant/billing/gateways/ebanx.rb +116 -68
  76. data/lib/active_merchant/billing/gateways/efsnet.rb +13 -8
  77. data/lib/active_merchant/billing/gateways/elavon.rb +80 -47
  78. data/lib/active_merchant/billing/gateways/element.rb +39 -10
  79. data/lib/active_merchant/billing/gateways/epay.rb +8 -4
  80. data/lib/active_merchant/billing/gateways/evo_ca.rb +8 -4
  81. data/lib/active_merchant/billing/gateways/eway.rb +6 -4
  82. data/lib/active_merchant/billing/gateways/eway_managed.rb +8 -4
  83. data/lib/active_merchant/billing/gateways/eway_rapid.rb +3 -3
  84. data/lib/active_merchant/billing/gateways/exact.rb +8 -4
  85. data/lib/active_merchant/billing/gateways/fat_zebra.rb +37 -7
  86. data/lib/active_merchant/billing/gateways/federated_canada.rb +8 -4
  87. data/lib/active_merchant/billing/gateways/finansbank.rb +2 -2
  88. data/lib/active_merchant/billing/gateways/first_giving.rb +2 -2
  89. data/lib/active_merchant/billing/gateways/first_pay/first_pay_common.rb +15 -0
  90. data/lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb +190 -0
  91. data/lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb +183 -0
  92. data/lib/active_merchant/billing/gateways/first_pay.rb +8 -174
  93. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +8 -4
  94. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +9 -5
  95. data/lib/active_merchant/billing/gateways/flex_charge.rb +359 -0
  96. data/lib/active_merchant/billing/gateways/flo2cash.rb +4 -2
  97. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +2 -2
  98. data/lib/active_merchant/billing/gateways/forte.rb +6 -4
  99. data/lib/active_merchant/billing/gateways/fortis.rb +347 -0
  100. data/lib/active_merchant/billing/gateways/garanti.rb +6 -4
  101. data/lib/active_merchant/billing/gateways/global_collect.rb +69 -50
  102. data/lib/active_merchant/billing/gateways/global_transport.rb +2 -2
  103. data/lib/active_merchant/billing/gateways/hdfc.rb +2 -2
  104. data/lib/active_merchant/billing/gateways/hi_pay.rb +287 -0
  105. data/lib/active_merchant/billing/gateways/hps.rb +40 -47
  106. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  107. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +2 -2
  108. data/lib/active_merchant/billing/gateways/inspire.rb +8 -6
  109. data/lib/active_merchant/billing/gateways/instapay.rb +9 -6
  110. data/lib/active_merchant/billing/gateways/ipg.rb +14 -10
  111. data/lib/active_merchant/billing/gateways/ipp.rb +2 -2
  112. data/lib/active_merchant/billing/gateways/iridium.rb +18 -8
  113. data/lib/active_merchant/billing/gateways/itransact.rb +8 -4
  114. data/lib/active_merchant/billing/gateways/iveri.rb +12 -9
  115. data/lib/active_merchant/billing/gateways/ixopay.rb +4 -4
  116. data/lib/active_merchant/billing/gateways/jetpay.rb +6 -4
  117. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +9 -6
  118. data/lib/active_merchant/billing/gateways/komoju.rb +2 -2
  119. data/lib/active_merchant/billing/gateways/kushki.rb +79 -16
  120. data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
  121. data/lib/active_merchant/billing/gateways/linkpoint.rb +8 -4
  122. data/lib/active_merchant/billing/gateways/litle.rb +37 -54
  123. data/lib/active_merchant/billing/gateways/loan_payment_pro.rb +267 -0
  124. data/lib/active_merchant/billing/gateways/loan_payment_pro_ach.rb +93 -0
  125. data/lib/active_merchant/billing/gateways/mastercard.rb +4 -4
  126. data/lib/active_merchant/billing/gateways/maxipago.rb +4 -4
  127. data/lib/active_merchant/billing/gateways/mercado_pago.rb +32 -11
  128. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +10 -7
  129. data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
  130. data/lib/active_merchant/billing/gateways/merchant_partners.rb +2 -2
  131. data/lib/active_merchant/billing/gateways/merchant_ware.rb +13 -6
  132. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +13 -6
  133. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +21 -5
  134. data/lib/active_merchant/billing/gateways/mercury.rb +11 -5
  135. data/lib/active_merchant/billing/gateways/metrics_global.rb +10 -8
  136. data/lib/active_merchant/billing/gateways/micropayment.rb +2 -2
  137. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -6
  138. data/lib/active_merchant/billing/gateways/migs.rb +8 -4
  139. data/lib/active_merchant/billing/gateways/mit.rb +10 -5
  140. data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -2
  141. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +21 -13
  142. data/lib/active_merchant/billing/gateways/moka.rb +2 -2
  143. data/lib/active_merchant/billing/gateways/monei.rb +3 -3
  144. data/lib/active_merchant/billing/gateways/moneris.rb +11 -5
  145. data/lib/active_merchant/billing/gateways/money_movers.rb +8 -4
  146. data/lib/active_merchant/billing/gateways/multi_pay.rb +267 -0
  147. data/lib/active_merchant/billing/gateways/mundipagg.rb +5 -3
  148. data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -10
  149. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +2 -2
  150. data/lib/active_merchant/billing/gateways/net_registry.rb +6 -2
  151. data/lib/active_merchant/billing/gateways/netaxept.rb +4 -4
  152. data/lib/active_merchant/billing/gateways/netbanx.rb +4 -6
  153. data/lib/active_merchant/billing/gateways/netbilling.rb +8 -4
  154. data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
  155. data/lib/active_merchant/billing/gateways/network_merchants.rb +9 -5
  156. data/lib/active_merchant/billing/gateways/nmi.rb +29 -8
  157. data/lib/active_merchant/billing/gateways/nuvei.rb +573 -0
  158. data/lib/active_merchant/billing/gateways/ogone.rb +8 -4
  159. data/lib/active_merchant/billing/gateways/omise.rb +2 -2
  160. data/lib/active_merchant/billing/gateways/openpay.rb +6 -4
  161. data/lib/active_merchant/billing/gateways/opp.rb +3 -4
  162. data/lib/active_merchant/billing/gateways/optimal_payment.rb +12 -6
  163. data/lib/active_merchant/billing/gateways/orbital/orbital_codes.rb +273 -0
  164. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
  165. data/lib/active_merchant/billing/gateways/orbital.rb +114 -94
  166. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +9 -6
  167. data/lib/active_merchant/billing/gateways/pagarme.rb +2 -2
  168. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  169. data/lib/active_merchant/billing/gateways/pay_arc.rb +9 -7
  170. data/lib/active_merchant/billing/gateways/pay_conex.rb +6 -4
  171. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +8 -4
  172. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -5
  173. data/lib/active_merchant/billing/gateways/pay_junction.rb +8 -4
  174. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +2 -2
  175. data/lib/active_merchant/billing/gateways/pay_secure.rb +8 -4
  176. data/lib/active_merchant/billing/gateways/pay_trace.rb +36 -22
  177. data/lib/active_merchant/billing/gateways/paybox_direct.rb +14 -14
  178. data/lib/active_merchant/billing/gateways/payeezy.rb +26 -13
  179. data/lib/active_merchant/billing/gateways/payex.rb +8 -6
  180. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +3 -3
  181. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +2 -2
  182. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +2 -2
  183. data/lib/active_merchant/billing/gateways/payflow.rb +12 -11
  184. data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -2
  185. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -2
  186. data/lib/active_merchant/billing/gateways/payflow_uk.rb +2 -2
  187. data/lib/active_merchant/billing/gateways/payment_express.rb +10 -6
  188. data/lib/active_merchant/billing/gateways/paymentez.rb +30 -16
  189. data/lib/active_merchant/billing/gateways/paymill.rb +6 -4
  190. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +17 -12
  191. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +2 -2
  192. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +2 -2
  193. data/lib/active_merchant/billing/gateways/paypal.rb +4 -2
  194. data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
  195. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +2 -2
  196. data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -2
  197. data/lib/active_merchant/billing/gateways/paysafe.rb +48 -24
  198. data/lib/active_merchant/billing/gateways/payscout.rb +9 -6
  199. data/lib/active_merchant/billing/gateways/paystation.rb +9 -5
  200. data/lib/active_merchant/billing/gateways/payu_in.rb +2 -2
  201. data/lib/active_merchant/billing/gateways/payu_latam.rb +7 -5
  202. data/lib/active_merchant/billing/gateways/payway.rb +6 -2
  203. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +6 -6
  204. data/lib/active_merchant/billing/gateways/pin.rb +126 -41
  205. data/lib/active_merchant/billing/gateways/plexo.rb +71 -20
  206. data/lib/active_merchant/billing/gateways/plugnpay.rb +6 -2
  207. data/lib/active_merchant/billing/gateways/priority.rb +29 -24
  208. data/lib/active_merchant/billing/gateways/pro_pay.rb +2 -2
  209. data/lib/active_merchant/billing/gateways/psigate.rb +8 -4
  210. data/lib/active_merchant/billing/gateways/psl_card.rb +6 -2
  211. data/lib/active_merchant/billing/gateways/qbms.rb +9 -5
  212. data/lib/active_merchant/billing/gateways/quantum.rb +9 -5
  213. data/lib/active_merchant/billing/gateways/quickbooks.rb +27 -17
  214. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +7 -4
  215. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +8 -4
  216. data/lib/active_merchant/billing/gateways/quickpay.rb +2 -2
  217. data/lib/active_merchant/billing/gateways/qvalent.rb +2 -2
  218. data/lib/active_merchant/billing/gateways/rapyd.rb +172 -53
  219. data/lib/active_merchant/billing/gateways/reach.rb +16 -9
  220. data/lib/active_merchant/billing/gateways/redsys.rb +7 -15
  221. data/lib/active_merchant/billing/gateways/redsys_rest.rb +545 -0
  222. data/lib/active_merchant/billing/gateways/s5.rb +5 -5
  223. data/lib/active_merchant/billing/gateways/safe_charge.rb +47 -24
  224. data/lib/active_merchant/billing/gateways/sage.rb +14 -6
  225. data/lib/active_merchant/billing/gateways/sage_pay.rb +81 -7
  226. data/lib/active_merchant/billing/gateways/sallie_mae.rb +8 -4
  227. data/lib/active_merchant/billing/gateways/secure_net.rb +9 -5
  228. data/lib/active_merchant/billing/gateways/secure_pay.rb +10 -8
  229. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +25 -15
  230. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +8 -4
  231. data/lib/active_merchant/billing/gateways/securion_pay.rb +26 -12
  232. data/lib/active_merchant/billing/gateways/shift4.rb +34 -26
  233. data/lib/active_merchant/billing/gateways/shift4_v2.rb +117 -0
  234. data/lib/active_merchant/billing/gateways/simetrik.rb +26 -17
  235. data/lib/active_merchant/billing/gateways/skip_jack.rb +8 -4
  236. data/lib/active_merchant/billing/gateways/smart_ps.rb +10 -7
  237. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -4
  238. data/lib/active_merchant/billing/gateways/spreedly_core.rb +4 -6
  239. data/lib/active_merchant/billing/gateways/stripe.rb +88 -84
  240. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +388 -77
  241. data/lib/active_merchant/billing/gateways/sum_up.rb +224 -0
  242. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +6 -4
  243. data/lib/active_merchant/billing/gateways/telr.rb +6 -7
  244. data/lib/active_merchant/billing/gateways/trans_first.rb +6 -4
  245. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +10 -18
  246. data/lib/active_merchant/billing/gateways/transact_pro.rb +3 -3
  247. data/lib/active_merchant/billing/gateways/transax.rb +2 -2
  248. data/lib/active_merchant/billing/gateways/transnational.rb +2 -2
  249. data/lib/active_merchant/billing/gateways/trexle.rb +2 -2
  250. data/lib/active_merchant/billing/gateways/trust_commerce.rb +9 -5
  251. data/lib/active_merchant/billing/gateways/usa_epay.rb +2 -2
  252. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -31
  253. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +8 -4
  254. data/lib/active_merchant/billing/gateways/vanco.rb +2 -4
  255. data/lib/active_merchant/billing/gateways/vantiv_express.rb +668 -0
  256. data/lib/active_merchant/billing/gateways/verifi.rb +12 -8
  257. data/lib/active_merchant/billing/gateways/versa_pay.rb +307 -0
  258. data/lib/active_merchant/billing/gateways/viaklix.rb +8 -4
  259. data/lib/active_merchant/billing/gateways/visanet_peru.rb +5 -5
  260. data/lib/active_merchant/billing/gateways/vpos.rb +25 -13
  261. data/lib/active_merchant/billing/gateways/webpay.rb +3 -3
  262. data/lib/active_merchant/billing/gateways/wepay.rb +6 -4
  263. data/lib/active_merchant/billing/gateways/wirecard.rb +10 -6
  264. data/lib/active_merchant/billing/gateways/wompi.rb +14 -7
  265. data/lib/active_merchant/billing/gateways/world_net.rb +2 -2
  266. data/lib/active_merchant/billing/gateways/worldpay.rb +297 -113
  267. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +16 -13
  268. data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
  269. data/lib/active_merchant/billing/gateways/xpay.rb +244 -0
  270. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +15 -3
  271. data/lib/active_merchant/billing/payment_token.rb +2 -2
  272. data/lib/active_merchant/billing/response.rb +7 -6
  273. data/lib/active_merchant/billing.rb +1 -0
  274. data/lib/active_merchant/connection.rb +8 -20
  275. data/lib/active_merchant/country.rb +3 -1
  276. data/lib/active_merchant/errors.rb +12 -2
  277. data/lib/active_merchant/net_http_ssl_connection.rb +35 -0
  278. data/lib/active_merchant/posts_data.rb +19 -4
  279. data/lib/active_merchant/version.rb +1 -1
  280. data/lib/active_merchant/versionable.rb +29 -0
  281. data/lib/certs/cacert.pem +1326 -1491
  282. data/lib/support/gateway_support.rb +3 -3
  283. data/lib/support/ssl_verify.rb +6 -6
  284. data/lib/support/ssl_version.rb +8 -8
  285. metadata +35 -9
@@ -0,0 +1,267 @@
1
+ module ActiveMerchant
2
+ module Billing
3
+ class MultiPayGateway < Gateway
4
+ self.test_url = 'https://ic2.multipay.mx:38263'
5
+ self.live_url = 'https://ic2.multipay.mx:38263'
6
+
7
+ self.supported_countries = ['CL']
8
+ self.default_currency = 'CLP'
9
+ self.supported_cardtypes = %i[visa master american_express]
10
+
11
+ self.homepage_url = 'https://www.multipay.mx'
12
+ self.display_name = 'MultiPay'
13
+
14
+ CURRENCY_CODES = {
15
+ 'CLP' => '152',
16
+ 'USD' => '840'
17
+ }
18
+
19
+ self.money_format = :cents
20
+
21
+ ERROR_MAPPING = {
22
+ 1 => 'Call Issuer',
23
+ 2 => 'Call Ref.',
24
+ 3 => 'Invalid business-03',
25
+ 4 => 'Hold Card',
26
+ 5 => 'Reject Card',
27
+ 6 => 'Error-Call',
28
+ 8 => 'Identify Client',
29
+ 9 => 'Request in progress',
30
+ 11 => 'VIP-11 approved ',
31
+ 12 => 'Invalid transaction',
32
+ 13 => 'Amount invalid',
33
+ 14 => 'invalid card',
34
+ 15 => 'No such issuer',
35
+ 19 => 'Repeat transaction',
36
+ 21 => 'No transactions-21',
37
+ 25 => 'Invalid ID-25',
38
+ 30 => 'Format Error',
39
+ 31 => 'Invalid bench',
40
+ 33 => 'Collect Expired Card',
41
+ 34 => 'Collect Expired Card',
42
+ 35 => 'Collect Card-35',
43
+ 36 => 'Collect Card-36',
44
+ 37 => 'Collect Card-37',
45
+ 38 => 'Allowable PIN tries exceeded',
46
+ 39 => 'No credit account',
47
+ 41 => 'Lost Card-41',
48
+ 43 => 'Stolen Card-43',
49
+ 51 => 'Insufficient Funds',
50
+ 52 => 'Without Check Account'
51
+ }
52
+
53
+ def initialize(options = {})
54
+ requires!(options, :company, :branch, :pos)
55
+ super
56
+
57
+ @company = options[:company]
58
+ @branch = options[:branch]
59
+ @pos = options[:pos]
60
+ @user = options[:user]
61
+ @password = options[:password]
62
+ end
63
+
64
+ def authorize(money, payment, options = {})
65
+ request_data = build_request_data(money, payment, options, 'AuthorizeSale')
66
+ commit('AuthorizeSale', { AuthorizeSale: request_data })
67
+ end
68
+
69
+ def capture(money, authorization, options = {})
70
+ post = {
71
+ Settlement: {
72
+ RequestType: 'Settlement',
73
+ SystemIdentification: '1.0.0',
74
+ CompanyIdentification: @company,
75
+ BranchIdentification: @branch,
76
+ POSIdentification: @pos,
77
+ UserID: options[:user_id],
78
+ Reference: options[:order_id],
79
+ Amount: money,
80
+ OrigReference: authorization
81
+ }.compact
82
+ }
83
+
84
+ commit('Settlement', post)
85
+ end
86
+
87
+ def purchase(money, payment, options = {})
88
+ request_data = build_request_data(money, payment, options, 'Sale')
89
+ commit('Sale', { Sale: request_data })
90
+ end
91
+
92
+ def supports_scrubbing?
93
+ true
94
+ end
95
+
96
+ def scrub(transcript)
97
+ transcript.
98
+ gsub(/(Authorization: (Bearer|Basic) )\S+/, '\1[FILTERED]').
99
+ gsub(/(\\?"CardNumber\\?":\\?")\d+/, '\1[FILTERED]').
100
+ gsub(/(\\?"SecurityCode\\?":\\?")\d+/, '\1[FILTERED]')
101
+ end
102
+
103
+ private
104
+
105
+ def build_request_data(money, payment, options, request_type)
106
+ {
107
+ RequestType: request_type,
108
+ SystemIdentification: '1.0.0', # optional
109
+ CompanyIdentification: @company,
110
+ BranchIdentification: @branch,
111
+ POSIdentification: @pos,
112
+ CardNumber: payment.number,
113
+ CardExp: expdate(payment),
114
+ SecurityCode: payment.verification_value,
115
+ Security: build_security_data(options),
116
+ Amount: money,
117
+ Reference: options[:order_id],
118
+ CurrencyCode: CURRENCY_CODES[options[:currency] || currency(money)],
119
+ CardReadMode: 'E',
120
+ FacilityPayments: options[:facility_payments] || 1,
121
+ ReadingDeviceType: 'Default',
122
+ MerchantNotifyURL: options[:notify_url],
123
+ UserID: options[:user_id]
124
+ }.compact
125
+ end
126
+
127
+ def build_required_information
128
+ [{ Name: 'Branch', Value: @branch }]
129
+ end
130
+
131
+ def build_security_data(options)
132
+ return unless options[:three_d_secure]
133
+
134
+ [{
135
+ Type: '3DSecure',
136
+ Values: [
137
+ {
138
+ Name: 'Method',
139
+ Value: options.dig(:three_d_secure, :method) || '3DS-SNAP'
140
+ },
141
+ {
142
+ Name: 'Data',
143
+ Value: {
144
+ AuthenticationECI: options.dig(:three_d_secure, :eci) || '07'
145
+ }.compact
146
+ }
147
+ ]
148
+ }]
149
+ end
150
+
151
+ def expdate(payment)
152
+ "#{format(payment.year, :two_digits)}#{format(payment.month, :two_digits)}"
153
+ end
154
+
155
+ def parse(body)
156
+ JSON.parse(body, symbolize_names: true)
157
+ rescue JSON::ParserError
158
+ {
159
+ success: false,
160
+ error: 'Invalid JSON response received from MultiPay'
161
+ }
162
+ end
163
+
164
+ def url(action)
165
+ "#{base_url}/token/Spreedly/Payments/Authorize/5.7.0/#{action}"
166
+ end
167
+
168
+ def access_token_valid?
169
+ @options[:access_token].present? && @options.fetch(:token_expires, 0).to_i > DateTime.now.strftime('%Q').to_i
170
+ end
171
+
172
+ def commit(action, parameters)
173
+ MultiResponse.run do |r|
174
+ r.process { fetch_access_token } unless access_token_valid?
175
+ r.process do
176
+ api_request(action, parameters).tap do |response|
177
+ response.params.merge!(@options.slice(:access_token, :token_expires)) if @options[:new_credentials]
178
+ end
179
+ end
180
+ end
181
+ end
182
+
183
+ def api_request(action, parameters)
184
+ response = parse(ssl_post(url(action), post_data(parameters), headers))
185
+ action_response = "#{action}Response".to_sym
186
+
187
+ Response.new(
188
+ success_from(response, action_response),
189
+ message_from(response, action_response),
190
+ response,
191
+ authorization: authorization_from(response, action_response),
192
+ avs_result: AVSResult.new(code: response[:avs_result_code]),
193
+ cvv_result: CVVResult.new(response[:cvv_result_code]),
194
+ test: test?,
195
+ error_code: error_code_from(response, action_response)
196
+ )
197
+ rescue StandardError => e
198
+ Response.new(false, "Error: #{e.message}", {}, test: test?)
199
+ end
200
+
201
+ def handle_response_error(error)
202
+ response = parse(error.response.body)
203
+ Response.new(
204
+ false,
205
+ response[:Message] || response[:ErrorDescription] || 'Unknown error',
206
+ response,
207
+ test: test?,
208
+ error_code: error_code_from(response)
209
+ )
210
+ end
211
+
212
+ def success_from(response, action)
213
+ %w[00].include?(response[action][:AuthResultCode])
214
+ end
215
+
216
+ def message_from(response, action)
217
+ response[action][:ResponseMessage] || 'Unknown error'
218
+ end
219
+
220
+ def authorization_from(response, action)
221
+ response[action][:Reference]
222
+ end
223
+
224
+ def error_code_from(response, action)
225
+ ERROR_MAPPING[response.dig(action, :AuthResultCode)]
226
+ end
227
+
228
+ def base_url
229
+ test? ? test_url : live_url
230
+ end
231
+
232
+ def fetch_access_token
233
+ url = "#{base_url}/token?grant_type=client_credentials"
234
+ response = parse(ssl_post(url, nil, auth_headers))
235
+
236
+ @options[:access_token] = response[:access_token]
237
+ @options[:token_expires] = DateTime.now.strftime('%Q').to_i + (response[:expires_in].to_i * 1000)
238
+ @options[:new_credentials] = true
239
+
240
+ success = response[:access_token].present?
241
+ Response.new(
242
+ success,
243
+ response[:token_type] || '',
244
+ response,
245
+ test: test?
246
+ )
247
+ rescue ResponseError => e
248
+ raise OAuthResponseError.new(e)
249
+ end
250
+
251
+ def headers
252
+ {
253
+ 'Content-Type' => 'application/json',
254
+ 'Authorization' => "Bearer #{@options[:access_token]}"
255
+ }
256
+ end
257
+
258
+ def auth_headers
259
+ { 'Authorization' => "Basic #{Base64.strict_encode64("#{@user}:#{@password}")}" }
260
+ end
261
+
262
+ def post_data(parameters)
263
+ parameters.to_json
264
+ end
265
+ end
266
+ end
267
+ end
@@ -1,7 +1,9 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class MundipaggGateway < Gateway
4
- self.live_url = 'https://api.mundipagg.com/core/v1'
4
+ version 'v1'
5
+
6
+ self.live_url = "https://api.mundipagg.com/core/#{fetch_version}"
5
7
 
6
8
  self.supported_countries = ['US']
7
9
  self.default_currency = 'USD'
@@ -1,12 +1,12 @@
1
1
  require 'rexml/document'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  # The National Australia Bank provide a payment gateway that seems to
6
6
  # be a rebadged Securepay Australia service, though some differences exist.
7
7
  class NabTransactGateway < Gateway
8
- API_VERSION = 'xml-4.2'
9
- PERIODIC_API_VERSION = 'spxml-4.2'
8
+ version 'xml-4.2'
9
+ version 'spxml-4.2', :periodic_api
10
10
 
11
11
  class_attribute :test_periodic_url, :live_periodic_url
12
12
 
@@ -146,7 +146,7 @@ module ActiveMerchant #:nodoc:
146
146
  xml.tag! 'messageID', SecureRandom.hex(15)
147
147
  xml.tag! 'messageTimestamp', generate_timestamp
148
148
  xml.tag! 'timeoutValue', request_timeout
149
- xml.tag! 'apiVersion', API_VERSION
149
+ xml.tag! 'apiVersion', fetch_version
150
150
  end
151
151
 
152
152
  xml.tag! 'MerchantInfo' do
@@ -177,7 +177,7 @@ module ActiveMerchant #:nodoc:
177
177
  xml.tag! 'messageID', SecureRandom.hex(15)
178
178
  xml.tag! 'messageTimestamp', generate_timestamp
179
179
  xml.tag! 'timeoutValue', request_timeout
180
- xml.tag! 'apiVersion', PERIODIC_API_VERSION
180
+ xml.tag! 'apiVersion', fetch_version(:periodic_api)
181
181
  end
182
182
 
183
183
  xml.tag! 'MerchantInfo' do
@@ -233,16 +233,24 @@ module ActiveMerchant #:nodoc:
233
233
  def commit(action, request)
234
234
  response = parse(ssl_post(test? ? self.test_url : self.live_url, build_request(action, request)))
235
235
 
236
- Response.new(success?(response), message_from(response), response,
236
+ Response.new(
237
+ success?(response),
238
+ message_from(response),
239
+ response,
237
240
  test: test?,
238
- authorization: authorization_from(action, response))
241
+ authorization: authorization_from(action, response)
242
+ )
239
243
  end
240
244
 
241
245
  def commit_periodic(action, request)
242
246
  response = parse(ssl_post(test? ? self.test_periodic_url : self.live_periodic_url, build_periodic_request(action, request)))
243
- Response.new(success?(response), message_from(response), response,
247
+ Response.new(
248
+ success?(response),
249
+ message_from(response),
250
+ response,
244
251
  test: test?,
245
- authorization: authorization_from(action, response))
252
+ authorization: authorization_from(action, response)
253
+ )
246
254
  end
247
255
 
248
256
  def success?(response)
@@ -1,7 +1,7 @@
1
1
  require 'nokogiri'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  class NcrSecurePayGateway < Gateway
6
6
  self.test_url = 'https://testbox.monetra.com:8665/'
7
7
  self.live_url = 'https://portal.ncrsecurepay.com:8444/'
@@ -144,8 +144,12 @@ module ActiveMerchant
144
144
  # get gateway response
145
145
  response = parse(ssl_post(self.live_url, post_data(action, params)))
146
146
 
147
- Response.new(response['status'] == 'approved', message_from(response), response,
148
- authorization: authorization_from(response, action))
147
+ Response.new(
148
+ response['status'] == 'approved',
149
+ message_from(response),
150
+ response,
151
+ authorization: authorization_from(response, action)
152
+ )
149
153
  end
150
154
 
151
155
  def post_data(action, params)
@@ -1,7 +1,7 @@
1
1
  require 'digest/md5'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  class NetaxeptGateway < Gateway
6
6
  self.test_url = 'https://epayment-test.bbs.no/'
7
7
  self.live_url = 'https://epayment.bbs.no/'
@@ -137,7 +137,7 @@ module ActiveMerchant #:nodoc:
137
137
  message,
138
138
  raw,
139
139
  test: test?,
140
- authorization: authorization
140
+ authorization:
141
141
  )
142
142
  end
143
143
 
@@ -146,7 +146,7 @@ module ActiveMerchant #:nodoc:
146
146
  doc = REXML::Document.new(result)
147
147
  extract_xml(doc.root).merge(container: doc.root.name)
148
148
  else
149
- { result: result }
149
+ { result: }
150
150
  end
151
151
  end
152
152
 
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class NetbanxGateway < Gateway
4
4
  # Netbanx is the new REST based API for Optimal Payments / Paysafe
5
5
  self.test_url = 'https://api.test.netbanx.com/'
@@ -210,7 +210,7 @@ module ActiveMerchant #:nodoc:
210
210
  month = format(credit_card.month, :two_digits)
211
211
 
212
212
  # returns a hash (necessary in the card JSON object)
213
- { month: month, year: year }
213
+ { month:, year: }
214
214
  end
215
215
 
216
216
  def add_order_id(post, options)
@@ -233,7 +233,7 @@ module ActiveMerchant #:nodoc:
233
233
  end
234
234
 
235
235
  def map_3ds(three_d_secure_options)
236
- mapped = {
236
+ {
237
237
  eci: three_d_secure_options[:eci],
238
238
  cavv: three_d_secure_options[:cavv],
239
239
  xid: three_d_secure_options[:xid],
@@ -241,8 +241,6 @@ module ActiveMerchant #:nodoc:
241
241
  threeDSecureVersion: three_d_secure_options[:version],
242
242
  directoryServerTransactionId: three_d_secure_options[:ds_transaction_id]
243
243
  }
244
-
245
- mapped
246
244
  end
247
245
 
248
246
  def parse(body)
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  # To perform PCI Compliant Repeat Billing
4
4
  #
5
5
  # Ensure that PCI Compliant Repeat Billing is enabled on your merchant account:
@@ -193,11 +193,15 @@ module ActiveMerchant #:nodoc:
193
193
  def commit(action, parameters)
194
194
  response = parse(ssl_post(self.live_url, post_data(action, parameters)))
195
195
 
196
- Response.new(success?(response), message_from(response), response,
196
+ Response.new(
197
+ success?(response),
198
+ message_from(response),
199
+ response,
197
200
  test: test_response?(response),
198
201
  authorization: response[:trans_id],
199
202
  avs_result: { code: response[:avs_code] },
200
- cvv_result: response[:cvv2_code])
203
+ cvv_result: response[:cvv2_code]
204
+ )
201
205
  rescue ActiveMerchant::ResponseError => e
202
206
  raise unless e.response.code =~ /^[67]\d\d$/
203
207
 
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  #
4
4
  # NETPAY Gateway
5
5
  #
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class NetworkMerchantsGateway < Gateway
4
4
  self.live_url = self.test_url = 'https://secure.networkmerchants.com/api/transact.php'
5
5
 
@@ -200,11 +200,15 @@ module ActiveMerchant #:nodoc:
200
200
 
201
201
  authorization = authorization_from(success, parameters, raw)
202
202
 
203
- Response.new(success, raw['responsetext'], raw,
203
+ Response.new(
204
+ success,
205
+ raw['responsetext'],
206
+ raw,
204
207
  test: test?,
205
- authorization: authorization,
208
+ authorization:,
206
209
  avs_result: { code: raw['avsresponse'] },
207
- cvv_result: raw['cvvresponse'])
210
+ cvv_result: raw['cvvresponse']
211
+ )
208
212
  end
209
213
 
210
214
  def build_request(action, parameters)
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class NmiGateway < Gateway
4
4
  include Empty
5
5
 
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
  self.test_url = self.live_url = 'https://secure.networkmerchants.com/api/transact.php'
9
9
  self.default_currency = 'USD'
10
10
  self.money_format = :dollars
11
- self.supported_countries = ['US']
11
+ self.supported_countries = %w[US CA]
12
12
  self.supported_cardtypes = %i[visa master american_express discover]
13
13
  self.homepage_url = 'http://nmi.com/'
14
14
  self.display_name = 'NMI'
@@ -34,6 +34,7 @@ module ActiveMerchant #:nodoc:
34
34
  def purchase(amount, payment_method, options = {})
35
35
  post = {}
36
36
  add_invoice(post, amount, options)
37
+ add_customer_vault_data(post, options)
37
38
  add_payment_method(post, payment_method, options)
38
39
  add_stored_credential(post, options)
39
40
  add_customer_data(post, options)
@@ -48,6 +49,7 @@ module ActiveMerchant #:nodoc:
48
49
  def authorize(amount, payment_method, options = {})
49
50
  post = {}
50
51
  add_invoice(post, amount, options)
52
+ add_customer_vault_data(post, options)
51
53
  add_payment_method(post, payment_method, options)
52
54
  add_stored_credential(post, options)
53
55
  add_customer_data(post, options)
@@ -97,6 +99,7 @@ module ActiveMerchant #:nodoc:
97
99
 
98
100
  def verify(payment_method, options = {})
99
101
  post = {}
102
+ add_customer_vault_data(post, options)
100
103
  add_payment_method(post, payment_method, options)
101
104
  add_customer_data(post, options)
102
105
  add_vendor_data(post, options)
@@ -134,6 +137,7 @@ module ActiveMerchant #:nodoc:
134
137
  gsub(%r((cvv=)\d+), '\1[FILTERED]').
135
138
  gsub(%r((checkaba=)\d+), '\1[FILTERED]').
136
139
  gsub(%r((checkaccount=)\d+), '\1[FILTERED]').
140
+ gsub(%r((cavv=)[^&\n]*), '\1[FILTERED]').
137
141
  gsub(%r((cryptogram=)[^&]+(&?)), '\1[FILTERED]\2')
138
142
  end
139
143
 
@@ -154,6 +158,7 @@ module ActiveMerchant #:nodoc:
154
158
  post[:orderdescription] = options[:description]
155
159
  post[:currency] = options[:currency] || currency(money)
156
160
  post[:billing_method] = 'recurring' if options[:recurring]
161
+ post[:industry] = options[:industry_indicator] if options[:industry_indicator]
157
162
  if (dup_seconds = (options[:dup_seconds] || self.class.duplicate_window))
158
163
  post[:dup_seconds] = dup_seconds
159
164
  end
@@ -166,7 +171,7 @@ module ActiveMerchant #:nodoc:
166
171
  elsif payment_method.is_a?(NetworkTokenizationCreditCard)
167
172
  post[:ccnumber] = payment_method.number
168
173
  post[:ccexp] = exp_date(payment_method)
169
- post[:token_cryptogram] = payment_method.payment_cryptogram
174
+ add_network_token_fields(post, payment_method)
170
175
  elsif card_brand(payment_method) == 'check'
171
176
  post[:payment] = 'check'
172
177
  post[:firstname] = payment_method.first_name
@@ -187,6 +192,17 @@ module ActiveMerchant #:nodoc:
187
192
  end
188
193
  end
189
194
 
195
+ def add_network_token_fields(post, payment_method)
196
+ if payment_method.source == :apple_pay || payment_method.source == :google_pay
197
+ post[:cavv] = payment_method.payment_cryptogram
198
+ post[:eci] = payment_method.eci
199
+ post[:decrypted_applepay_data] = 1 if payment_method.source == :apple_pay
200
+ post[:decrypted_googlepay_data] = 1 if payment_method.source == :google_pay
201
+ else
202
+ post[:token_cryptogram] = payment_method.payment_cryptogram
203
+ end
204
+ end
205
+
190
206
  def add_stored_credential(post, options)
191
207
  return unless (stored_credential = options[:stored_credential])
192
208
 
@@ -212,7 +228,8 @@ module ActiveMerchant #:nodoc:
212
228
  else
213
229
  post[:stored_credential_indicator] = 'used'
214
230
  # should only send :initial_transaction_id if it is a MIT
215
- post[:initial_transaction_id] = stored_credential[:network_transaction_id] if post[:initiated_by] == 'merchant'
231
+ ntid = options[:network_transaction_id] || stored_credential[:network_transaction_id]
232
+ post[:initial_transaction_id] = ntid if post[:initiated_by] == 'merchant'
216
233
  end
217
234
  end
218
235
 
@@ -266,6 +283,11 @@ module ActiveMerchant #:nodoc:
266
283
  post[:processor_id] = options[:processor_id] if options[:processor_id]
267
284
  end
268
285
 
286
+ def add_customer_vault_data(post, options)
287
+ post[:customer_vault] = options[:customer_vault] if options[:customer_vault]
288
+ post[:customer_vault_id] = options[:customer_vault_id] if options[:customer_vault_id]
289
+ end
290
+
269
291
  def add_merchant_defined_fields(post, options)
270
292
  (1..20).each do |each|
271
293
  key = "merchant_defined_field_#{each}".to_sym
@@ -334,8 +356,7 @@ module ActiveMerchant #:nodoc:
334
356
  end
335
357
 
336
358
  def headers
337
- headers = { 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8' }
338
- headers
359
+ { 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8' }
339
360
  end
340
361
 
341
362
  def post_data(action, params)
@@ -347,7 +368,7 @@ module ActiveMerchant #:nodoc:
347
368
  end
348
369
 
349
370
  def parse(body)
350
- Hash[CGI::parse(body).map { |k, v| [k.intern, v.first] }]
371
+ CGI::parse(body).map { |k, v| [k.intern, v.first] }.to_h
351
372
  end
352
373
 
353
374
  def success_from(response)