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
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class CardStreamGateway < Gateway
4
4
  THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE = 'Specifying the :threeDSRequired initialization option is deprecated. Please use the `:threeds_required => true` *transaction* option instead.'
5
5
 
@@ -248,12 +248,10 @@ module ActiveMerchant #:nodoc:
248
248
  add_pair(post, :orderRef, options[:description] || options[:order_id], required: true)
249
249
  add_pair(post, :statementNarrative1, options[:merchant_name]) if options[:merchant_name]
250
250
  add_pair(post, :statementNarrative2, options[:dynamic_descriptor]) if options[:dynamic_descriptor]
251
- if credit_card_or_reference.respond_to?(:number)
252
- if %w[american_express diners_club].include?(card_brand(credit_card_or_reference).to_s)
253
- add_pair(post, :item1Quantity, 1)
254
- add_pair(post, :item1Description, (options[:description] || options[:order_id]).slice(0, 15))
255
- add_pair(post, :item1GrossValue, localized_amount(money, options[:currency] || currency(money)))
256
- end
251
+ if credit_card_or_reference.respond_to?(:number) && %w[american_express diners_club].include?(card_brand(credit_card_or_reference).to_s)
252
+ add_pair(post, :item1Quantity, 1)
253
+ add_pair(post, :item1Description, (options[:description] || options[:order_id]).slice(0, 15))
254
+ add_pair(post, :item1GrossValue, localized_amount(money, options[:currency] || currency(money)))
257
255
  end
258
256
 
259
257
  add_pair(post, :type, options[:type] || '1')
@@ -331,12 +329,13 @@ module ActiveMerchant #:nodoc:
331
329
  def commit(action, parameters)
332
330
  parameters.update(
333
331
  merchantID: @options[:login],
334
- action: action
332
+ action:
335
333
  )
336
334
  # adds a signature to the post hash/array
337
335
  add_hmac(parameters)
338
336
 
339
- response = parse(ssl_post(self.live_url, post_data(action, parameters)))
337
+ api_url = @options[:custom_api_url] || self.live_url
338
+ response = parse(ssl_post(api_url, post_data(action, parameters)))
340
339
 
341
340
  Response.new(
342
341
  response[:responseCode] == '0',
@@ -364,9 +363,9 @@ module ActiveMerchant #:nodoc:
364
363
  end
365
364
 
366
365
  AVSResult.new({
367
- code: code,
368
- postal_match: postal_match,
369
- street_match: street_match
366
+ code:,
367
+ postal_match:,
368
+ street_match:
370
369
  })
371
370
  end
372
371
 
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class CardknoxGateway < Gateway
4
4
  self.live_url = 'https://x1.cardknox.com/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 CardprocessGateway < Gateway
4
4
  self.test_url = 'https://test.vr-pay-ecommerce.de/v1/payments'
5
5
  self.live_url = 'https://vr-pay-ecommerce.de/v1/payments'
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class CashnetGateway < Gateway
4
4
  include Empty
5
5
 
@@ -11,7 +11,7 @@ module ActiveMerchant #:nodoc:
11
11
  self.homepage_url = 'https://transactcampus.com'
12
12
  self.display_name = 'Cashnet'
13
13
  self.money_format = :dollars
14
- self.max_retries = 0
14
+ self.max_retries = 1
15
15
 
16
16
  # Creates a new CashnetGateway
17
17
  #
@@ -150,7 +150,7 @@ module ActiveMerchant #:nodoc:
150
150
  match = body.match(/<cngateway>(.*)<\/cngateway>/)
151
151
  return nil unless match
152
152
 
153
- Hash[CGI::parse(match[1]).map { |k, v| [k.to_sym, v.first] }]
153
+ CGI::parse(match[1]).map { |k, v| [k.to_sym, v.first] }.to_h
154
154
  end
155
155
 
156
156
  def handle_response(response)
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  # CC5 API is used by many banks in Turkey. Extend this base class to provide
4
4
  # concrete implementations.
5
5
  class CC5Gateway < Gateway
@@ -0,0 +1,36 @@
1
+ module CecabankCommon
2
+ #### CECA's MAGIC NUMBERS
3
+ CECA_ENCRIPTION = 'SHA2'
4
+ CECA_CURRENCIES_DICTIONARY = { 'EUR' => 978, 'USD' => 840, 'GBP' => 826 }
5
+
6
+ def self.included(base)
7
+ base.supported_countries = ['ES']
8
+ base.supported_cardtypes = %i[visa master american_express]
9
+ base.homepage_url = 'http://www.ceca.es/es/'
10
+ base.display_name = 'Cecabank'
11
+ base.default_currency = 'EUR'
12
+ base.money_format = :cents
13
+ end
14
+
15
+ # Creates a new CecabankGateway
16
+ #
17
+ # The gateway requires four values for connection to be passed
18
+ # in the +options+ hash.
19
+ #
20
+ # ==== Options
21
+ #
22
+ # * <tt>:merchant_id</tt> -- Cecabank's merchant_id (REQUIRED)
23
+ # * <tt>:acquirer_bin</tt> -- Cecabank's acquirer_bin (REQUIRED)
24
+ # * <tt>:terminal_id</tt> -- Cecabank's terminal_id (REQUIRED)
25
+ # * <tt>:cypher_key</tt> -- Cecabank's cypher key (REQUIRED)
26
+ # * <tt>:test</tt> -- +true+ or +false+. If true, perform transactions against the test server.
27
+ # Otherwise, perform transactions against the production server.
28
+ def initialize(options = {})
29
+ requires!(options, :merchant_id, :acquirer_bin, :terminal_id, :cypher_key)
30
+ super
31
+ end
32
+
33
+ def supports_scrubbing?
34
+ true
35
+ end
36
+ end
@@ -0,0 +1,331 @@
1
+ require 'active_merchant/billing/gateways/cecabank/cecabank_common'
2
+
3
+ module ActiveMerchant
4
+ module Billing
5
+ class CecabankJsonGateway < Gateway
6
+ include CecabankCommon
7
+
8
+ CECA_ACTIONS_DICTIONARY = {
9
+ purchase: :REST_AUTORIZACION,
10
+ authorize: :REST_PREAUTORIZACION,
11
+ capture: :REST_COBRO_PREAUTORIZACION,
12
+ refund: :REST_DEVOLUCION,
13
+ void: :REST_ANULACION
14
+ }.freeze
15
+
16
+ CECA_REASON_TYPES = {
17
+ installment: :I,
18
+ recurring: :R,
19
+ unscheduled: :C
20
+ }.freeze
21
+
22
+ CECA_INITIATOR = {
23
+ merchant: :N,
24
+ cardholder: :S
25
+ }.freeze
26
+
27
+ CECA_SCA_TYPES = {
28
+ low_value_exemption: :LOW,
29
+ transaction_risk_analysis_exemption: :TRA
30
+ }.freeze
31
+
32
+ WALLET_PAYMENT_METHODS = {
33
+ apple_pay: 'A',
34
+ google_pay: 'G'
35
+ }
36
+
37
+ self.test_url = 'https://tpv.ceca.es/tpvweb/rest/procesos/'
38
+ self.live_url = 'https://pgw.ceca.es/tpvweb/rest/procesos/'
39
+
40
+ def authorize(money, creditcard, options = {})
41
+ handle_purchase(:authorize, money, creditcard, options)
42
+ end
43
+
44
+ def capture(money, identification, options = {})
45
+ authorization, operation_number, _money = identification.split('#')
46
+
47
+ post = {}
48
+ options[:operation_number] = operation_number
49
+ add_auth_invoice_data(:capture, post, money, authorization, options)
50
+
51
+ commit('compra', post)
52
+ end
53
+
54
+ def purchase(money, creditcard, options = {})
55
+ handle_purchase(:purchase, money, creditcard, options)
56
+ end
57
+
58
+ def void(identification, options = {})
59
+ authorization, operation_number, money = identification.split('#')
60
+ options[:operation_number] = operation_number
61
+ handle_cancellation(:void, money.to_i, authorization, options)
62
+ end
63
+
64
+ def refund(money, identification, options = {})
65
+ authorization, operation_number, _money = identification.split('#')
66
+ options[:operation_number] = operation_number
67
+ handle_cancellation(:refund, money, authorization, options)
68
+ end
69
+
70
+ def scrub(transcript)
71
+ return '' if transcript.blank?
72
+
73
+ before_message = transcript.gsub(%r(\\\")i, "'").scan(/{[^>]*}/).first.gsub("'", '"')
74
+ request_data = JSON.parse(before_message)
75
+
76
+ if @options[:encryption_key]
77
+ params = parse(request_data['parametros'])
78
+ sensitive_fields = decrypt_sensitive_fields(params['encryptedData'])
79
+ filtered_params = filter_params(sensitive_fields)
80
+ params['encryptedData'] = encrypt_sensitive_fields(filtered_params)
81
+ else
82
+ params = filter_params(decode_params(request_data['parametros']))
83
+ end
84
+
85
+ request_data['parametros'] = encode_params(params)
86
+ before_message = before_message.gsub(%r(\")i, '\\\"')
87
+ after_message = request_data.to_json.gsub(%r(\")i, '\\\"')
88
+ transcript.sub(before_message, after_message)
89
+ end
90
+
91
+ private
92
+
93
+ def filter_params(params)
94
+ params.
95
+ gsub(%r(("pan\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
96
+ gsub(%r(("caducidad\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
97
+ gsub(%r(("cvv2\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
98
+ gsub(%r(("csc\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
99
+ gsub(%r(("authentication_value\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]')
100
+ end
101
+
102
+ def decrypt_sensitive_fields(data)
103
+ cipher = OpenSSL::Cipher.new('AES-256-CBC').decrypt
104
+ cipher.key = [@options[:encryption_key]].pack('H*')
105
+ cipher.iv = @options[:initiator_vector]&.split('')&.map(&:to_i)&.pack('c*')
106
+ cipher.update([data].pack('H*')) + cipher.final
107
+ end
108
+
109
+ def encrypt_sensitive_fields(data)
110
+ cipher = OpenSSL::Cipher.new('AES-256-CBC').encrypt
111
+ cipher.key = [@options[:encryption_key]].pack('H*')
112
+ cipher.iv = @options[:initiator_vector]&.split('')&.map(&:to_i)&.pack('c*')
113
+ encrypted = cipher.update(data.to_json) + cipher.final
114
+ encrypted.unpack1('H*')
115
+ end
116
+
117
+ def handle_purchase(action, money, creditcard, options)
118
+ post = { parametros: { accion: CECA_ACTIONS_DICTIONARY[action] } }
119
+
120
+ add_invoice(post, money, options)
121
+ add_payment_method(post, creditcard, options)
122
+ add_stored_credentials(post, creditcard, options)
123
+ add_three_d_secure(post, options)
124
+
125
+ commit('compra', post)
126
+ end
127
+
128
+ def handle_cancellation(action, money, authorization, options = {})
129
+ post = {}
130
+ add_auth_invoice_data(action, post, money, authorization, options)
131
+
132
+ commit('anulacion', post)
133
+ end
134
+
135
+ def add_auth_invoice_data(action, post, money, authorization, options)
136
+ params = post[:parametros] ||= {}
137
+ params[:accion] = CECA_ACTIONS_DICTIONARY[action]
138
+ params[:referencia] = authorization
139
+
140
+ add_invoice(post, money, options)
141
+ end
142
+
143
+ def add_encryption(post)
144
+ post[:cifrado] = CECA_ENCRIPTION
145
+ post[:parametros][:encryptedData] = encrypt_sensitive_fields(post[:parametros][:encryptedData]) if @options[:encryption_key]
146
+ end
147
+
148
+ def add_signature(post, params_encoded, options)
149
+ post[:firma] = Digest::SHA2.hexdigest(@options[:cypher_key].to_s + params_encoded)
150
+ end
151
+
152
+ def add_merchant_data(post)
153
+ params = post[:parametros] ||= {}
154
+
155
+ params[:merchantID] = @options[:merchant_id]
156
+ params[:acquirerBIN] = @options[:acquirer_bin]
157
+ params[:terminalID] = @options[:terminal_id]
158
+ end
159
+
160
+ def add_invoice(post, money, options)
161
+ post[:parametros][:numOperacion] = options[:operation_number] || options[:order_id]
162
+ post[:parametros][:importe] = amount(money)
163
+ post[:parametros][:tipoMoneda] = CECA_CURRENCIES_DICTIONARY[options[:currency] || currency(money)].to_s
164
+ post[:parametros][:exponente] = 2.to_s
165
+ end
166
+
167
+ def add_payment_method(post, payment_method, options)
168
+ params = post[:parametros] ||= {}
169
+ three_d_secure = options.fetch(:three_d_secure, {})
170
+
171
+ pm = {
172
+ pan: payment_method.number,
173
+ caducidad: strftime_yyyymm(payment_method)
174
+ }
175
+
176
+ if payment_method.is_a?(NetworkTokenizationCreditCard) && WALLET_PAYMENT_METHODS[payment_method.source.to_sym]
177
+ eci_to_format = payment_method.eci || three_d_secure[:eci]
178
+ eci_value = eci_to_format.to_s.rjust(2, '0') unless eci_to_format.nil?
179
+
180
+ pm[:wallet] = {
181
+
182
+ # the authentication value should come nil (for recurring cases) or should I remove it?
183
+ authentication_value: (payment_method.payment_cryptogram unless options.dig(:stored_credential, :network_transaction_id)),
184
+ xid: three_d_secure[:xid] || three_d_secure[:ds_transaction_id] || options[:xid],
185
+ walletType: WALLET_PAYMENT_METHODS[payment_method.source.to_sym],
186
+ eci: eci_value
187
+ }.compact.to_json
188
+ else
189
+ pm[CreditCard.brand?(payment_method.number) == 'american_express' ? :csc : :cvv2] = payment_method.verification_value
190
+ end
191
+ @options[:encryption_key] ? params[:encryptedData] = pm : params.merge!(pm)
192
+ end
193
+
194
+ def add_stored_credentials(post, creditcard, options)
195
+ return unless stored_credential = options[:stored_credential]
196
+
197
+ return if options[:exemption_type].blank? && !(stored_credential[:reason_type] && stored_credential[:initiator])
198
+
199
+ params = post[:parametros] ||= {}
200
+ params[:exencionSCA] = 'MIT'
201
+
202
+ requires!(stored_credential, :reason_type, :initiator)
203
+ reason_type = CECA_REASON_TYPES[stored_credential[:reason_type].to_sym]
204
+ initiator = CECA_INITIATOR[stored_credential[:initiator].to_sym]
205
+ params[:tipoCOF] = reason_type
206
+ params[:inicioRec] = initiator
207
+ if initiator == :S
208
+ requires!(options, :recurring_frequency)
209
+ params[:finRec] = options[:recurring_end_date] || strftime_yyyymmdd_last_day(creditcard)
210
+ params[:frecRec] = options[:recurring_frequency]
211
+ end
212
+
213
+ network_transaction_id = options[:network_transaction_id].present? ? options[:network_transaction_id] : stored_credential[:network_transaction_id]
214
+ params[:mmppTxId] = network_transaction_id unless network_transaction_id.blank?
215
+ end
216
+
217
+ def add_three_d_secure(post, options)
218
+ params = post[:parametros] ||= {}
219
+ return unless three_d_secure = options[:three_d_secure]
220
+
221
+ params[:exencionSCA] ||= CECA_SCA_TYPES.fetch(options[:exemption_type]&.to_sym, :NONE)
222
+
223
+ three_d_response = {
224
+ exemption_type: options[:exemption_type],
225
+ three_ds_version: three_d_secure[:version],
226
+ directory_server_transaction_id: three_d_secure[:ds_transaction_id],
227
+ acs_transaction_id: three_d_secure[:acs_transaction_id],
228
+ authentication_response_status: three_d_secure[:authentication_response_status],
229
+ three_ds_server_trans_id: three_d_secure[:three_ds_server_trans_id],
230
+ ecommerce_indicator: three_d_secure[:eci],
231
+ enrolled: three_d_secure[:enrolled]
232
+ }
233
+
234
+ if @options[:encryption_key]
235
+ params[:encryptedData].merge!({ authentication_value: three_d_secure[:cavv] })
236
+ else
237
+ three_d_response[:authentication_value] = three_d_secure[:cavv]
238
+ end
239
+
240
+ three_d_response[:amount] = post[:parametros][:importe]
241
+ params[:ThreeDsResponse] = three_d_response.to_json
242
+ end
243
+
244
+ def commit(action, post)
245
+ auth_options = {
246
+ operation_number: post.dig(:parametros, :numOperacion),
247
+ amount: post.dig(:parametros, :importe)
248
+ }
249
+
250
+ add_encryption(post)
251
+ add_merchant_data(post)
252
+ params_encoded = encode_post_parameters(post)
253
+ add_signature(post, params_encoded, options)
254
+
255
+ response = parse(ssl_post(url(action), post.to_json, headers))
256
+ response[:parametros] = parse(response[:parametros]) if response[:parametros]
257
+
258
+ Response.new(
259
+ success_from(response),
260
+ message_from(response),
261
+ response,
262
+ authorization: authorization_from(response, auth_options),
263
+ network_transaction_id: network_transaction_id_from(response),
264
+ test: test?,
265
+ error_code: error_code_from(response)
266
+ )
267
+ end
268
+
269
+ def url(action)
270
+ (test? ? self.test_url : self.live_url) + action
271
+ end
272
+
273
+ def host
274
+ URI.parse(url('')).host
275
+ end
276
+
277
+ def headers
278
+ {
279
+ 'Content-Type' => 'application/json',
280
+ 'Host' => host
281
+ }
282
+ end
283
+
284
+ def parse(string)
285
+ JSON.parse(string).with_indifferent_access
286
+ rescue JSON::ParserError
287
+ parse(decode_params(string))
288
+ end
289
+
290
+ def encode_post_parameters(post)
291
+ post[:parametros] = encode_params(post[:parametros])
292
+ end
293
+
294
+ def encode_params(params)
295
+ Base64.strict_encode64(params.is_a?(Hash) ? params.to_json : params)
296
+ end
297
+
298
+ def decode_params(params)
299
+ Base64.decode64(params)
300
+ end
301
+
302
+ def success_from(response)
303
+ response[:codResult].blank?
304
+ end
305
+
306
+ def message_from(response)
307
+ return response[:parametros].to_json if success_from(response)
308
+
309
+ response[:paramsEntradaError] || response[:idProceso]
310
+ end
311
+
312
+ def authorization_from(response, auth_options = {})
313
+ return unless response[:parametros]
314
+
315
+ [
316
+ response[:parametros][:referencia],
317
+ auth_options[:operation_number],
318
+ auth_options[:amount]
319
+ ].join('#')
320
+ end
321
+
322
+ def network_transaction_id_from(response)
323
+ response.dig(:parametros, :mmppTxId)
324
+ end
325
+
326
+ def error_code_from(response)
327
+ (response[:codResult] || :paramsEntradaError) unless success_from(response)
328
+ end
329
+ end
330
+ end
331
+ end