activemerchant 1.79.2 → 1.129.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (279) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG +1391 -0
  3. data/README.md +29 -14
  4. data/lib/active_merchant/billing/avs_result.rb +25 -28
  5. data/lib/active_merchant/billing/base.rb +0 -13
  6. data/lib/active_merchant/billing/check.rb +55 -22
  7. data/lib/active_merchant/billing/compatibility.rb +10 -12
  8. data/lib/active_merchant/billing/credit_card.rb +82 -62
  9. data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
  10. data/lib/active_merchant/billing/credit_card_methods.rb +328 -58
  11. data/lib/active_merchant/billing/cvv_result.rb +0 -1
  12. data/lib/active_merchant/billing/gateway.rb +61 -56
  13. data/lib/active_merchant/billing/gateways/adyen.rb +562 -87
  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 +35 -36
  17. data/lib/active_merchant/billing/gateways/authorize_net.rb +297 -196
  18. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
  19. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +94 -98
  20. data/lib/active_merchant/billing/gateways/axcessms.rb +64 -66
  21. data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
  22. data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
  23. data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
  24. data/lib/active_merchant/billing/gateways/banwire.rb +12 -12
  25. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +140 -69
  26. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
  27. data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
  28. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +115 -115
  29. data/lib/active_merchant/billing/gateways/beanstream.rb +39 -13
  30. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -2
  31. data/lib/active_merchant/billing/gateways/blue_pay.rb +87 -58
  32. data/lib/active_merchant/billing/gateways/blue_snap.rb +405 -104
  33. data/lib/active_merchant/billing/gateways/bogus.rb +34 -30
  34. data/lib/active_merchant/billing/gateways/borgun.rb +97 -47
  35. data/lib/active_merchant/billing/gateways/bpoint.rb +20 -20
  36. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -3
  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 +561 -259
  40. data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
  41. data/lib/active_merchant/billing/gateways/bridge_pay.rb +53 -54
  42. data/lib/active_merchant/billing/gateways/cams.rb +31 -31
  43. data/lib/active_merchant/billing/gateways/card_connect.rb +85 -33
  44. data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
  45. data/lib/active_merchant/billing/gateways/card_stream.rb +187 -169
  46. data/lib/active_merchant/billing/gateways/cardknox.rb +24 -25
  47. data/lib/active_merchant/billing/gateways/cardprocess.rb +9 -7
  48. data/lib/active_merchant/billing/gateways/cashnet.rb +43 -27
  49. data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
  50. data/lib/active_merchant/billing/gateways/cecabank.rb +62 -52
  51. data/lib/active_merchant/billing/gateways/cenpos.rb +63 -62
  52. data/lib/active_merchant/billing/gateways/checkout.rb +21 -23
  53. data/lib/active_merchant/billing/gateways/checkout_v2.rb +391 -113
  54. data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -3
  55. data/lib/active_merchant/billing/gateways/clearhaus.rb +40 -41
  56. data/lib/active_merchant/billing/gateways/commerce_hub.rb +361 -0
  57. data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
  58. data/lib/active_merchant/billing/gateways/conekta.rb +35 -30
  59. data/lib/active_merchant/billing/gateways/creditcall.rb +59 -59
  60. data/lib/active_merchant/billing/gateways/credorax.rb +326 -145
  61. data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
  62. data/lib/active_merchant/billing/gateways/culqi.rb +53 -53
  63. data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
  64. data/lib/active_merchant/billing/gateways/cyber_source.rb +566 -208
  65. data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +456 -0
  66. data/lib/active_merchant/billing/gateways/d_local.rb +342 -0
  67. data/lib/active_merchant/billing/gateways/data_cash.rb +40 -56
  68. data/lib/active_merchant/billing/gateways/decidir.rb +358 -0
  69. data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
  70. data/lib/active_merchant/billing/gateways/dibs.rb +34 -40
  71. data/lib/active_merchant/billing/gateways/digitzs.rb +48 -45
  72. data/lib/active_merchant/billing/gateways/ebanx.rb +110 -60
  73. data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
  74. data/lib/active_merchant/billing/gateways/elavon.rb +351 -189
  75. data/lib/active_merchant/billing/gateways/element.rb +106 -56
  76. data/lib/active_merchant/billing/gateways/epay.rb +74 -64
  77. data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
  78. data/lib/active_merchant/billing/gateways/eway.rb +74 -73
  79. data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
  80. data/lib/active_merchant/billing/gateways/eway_rapid.rb +105 -60
  81. data/lib/active_merchant/billing/gateways/exact.rb +29 -37
  82. data/lib/active_merchant/billing/gateways/ezic.rb +21 -22
  83. data/lib/active_merchant/billing/gateways/fat_zebra.rb +70 -48
  84. data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
  85. data/lib/active_merchant/billing/gateways/finansbank.rb +3 -4
  86. data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
  87. data/lib/active_merchant/billing/gateways/first_pay.rb +33 -13
  88. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +106 -105
  89. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
  90. data/lib/active_merchant/billing/gateways/flo2cash.rb +36 -36
  91. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +2 -2
  92. data/lib/active_merchant/billing/gateways/forte.rb +70 -40
  93. data/lib/active_merchant/billing/gateways/garanti.rb +24 -31
  94. data/lib/active_merchant/billing/gateways/global_collect.rb +378 -154
  95. data/lib/active_merchant/billing/gateways/global_transport.rb +12 -13
  96. data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
  97. data/lib/active_merchant/billing/gateways/hps.rb +236 -69
  98. data/lib/active_merchant/billing/gateways/iats_payments.rb +61 -39
  99. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  100. data/lib/active_merchant/billing/gateways/inspire.rb +41 -47
  101. data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
  102. data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
  103. data/lib/active_merchant/billing/gateways/ipp.rb +25 -24
  104. data/lib/active_merchant/billing/gateways/iridium.rb +243 -244
  105. data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
  106. data/lib/active_merchant/billing/gateways/iveri.rb +73 -34
  107. data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
  108. data/lib/active_merchant/billing/gateways/jetpay.rb +145 -152
  109. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +154 -159
  110. data/lib/active_merchant/billing/gateways/komoju.rb +16 -16
  111. data/lib/active_merchant/billing/gateways/kushki.rb +127 -57
  112. data/lib/active_merchant/billing/gateways/latitude19.rb +111 -115
  113. data/lib/active_merchant/billing/gateways/linkpoint.rb +82 -85
  114. data/lib/active_merchant/billing/gateways/litle.rb +247 -53
  115. data/lib/active_merchant/billing/gateways/mastercard.rb +41 -23
  116. data/lib/active_merchant/billing/gateways/maxipago.rb +5 -5
  117. data/lib/active_merchant/billing/gateways/mercado_pago.rb +135 -49
  118. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +62 -29
  119. data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
  120. data/lib/active_merchant/billing/gateways/merchant_partners.rb +40 -40
  121. data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
  122. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +42 -44
  123. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +52 -14
  124. data/lib/active_merchant/billing/gateways/mercury.rb +47 -51
  125. data/lib/active_merchant/billing/gateways/metrics_global.rb +32 -42
  126. data/lib/active_merchant/billing/gateways/micropayment.rb +42 -45
  127. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
  128. data/lib/active_merchant/billing/gateways/migs.rb +45 -40
  129. data/lib/active_merchant/billing/gateways/mit.rb +260 -0
  130. data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -2
  131. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +29 -31
  132. data/lib/active_merchant/billing/gateways/moka.rb +290 -0
  133. data/lib/active_merchant/billing/gateways/monei.rb +255 -138
  134. data/lib/active_merchant/billing/gateways/moneris.rb +226 -88
  135. data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
  136. data/lib/active_merchant/billing/gateways/mundipagg.rb +117 -43
  137. data/lib/active_merchant/billing/gateways/nab_transact.rb +28 -31
  138. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +13 -15
  139. data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
  140. data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
  141. data/lib/active_merchant/billing/gateways/netbanx.rb +167 -80
  142. data/lib/active_merchant/billing/gateways/netbilling.rb +27 -30
  143. data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
  144. data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
  145. data/lib/active_merchant/billing/gateways/nmi.rb +134 -48
  146. data/lib/active_merchant/billing/gateways/ogone.rb +88 -58
  147. data/lib/active_merchant/billing/gateways/omise.rb +30 -31
  148. data/lib/active_merchant/billing/gateways/openpay.rb +45 -26
  149. data/lib/active_merchant/billing/gateways/opp.rb +166 -144
  150. data/lib/active_merchant/billing/gateways/optimal_payment.rb +67 -64
  151. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
  152. data/lib/active_merchant/billing/gateways/orbital.rb +726 -382
  153. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +26 -27
  154. data/lib/active_merchant/billing/gateways/pagarme.rb +47 -56
  155. data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
  156. data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
  157. data/lib/active_merchant/billing/gateways/pay_conex.rb +39 -40
  158. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +65 -65
  159. data/lib/active_merchant/billing/gateways/pay_hub.rb +39 -39
  160. data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
  161. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +70 -54
  162. data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
  163. data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
  164. data/lib/active_merchant/billing/gateways/paybox_direct.rb +71 -47
  165. data/lib/active_merchant/billing/gateways/payeezy.rb +159 -32
  166. data/lib/active_merchant/billing/gateways/payex.rb +39 -42
  167. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +41 -36
  168. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
  169. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
  170. data/lib/active_merchant/billing/gateways/payflow.rb +178 -54
  171. data/lib/active_merchant/billing/gateways/payflow_express.rb +61 -65
  172. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +0 -1
  173. data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -2
  174. data/lib/active_merchant/billing/gateways/payment_express.rb +66 -58
  175. data/lib/active_merchant/billing/gateways/paymentez.rb +114 -25
  176. data/lib/active_merchant/billing/gateways/paymill.rb +134 -133
  177. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
  178. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
  179. data/lib/active_merchant/billing/gateways/paypal.rb +27 -14
  180. data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
  181. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +2 -2
  182. data/lib/active_merchant/billing/gateways/paypal_express.rb +5 -2
  183. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  184. data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
  185. data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
  186. data/lib/active_merchant/billing/gateways/paystation.rb +79 -82
  187. data/lib/active_merchant/billing/gateways/payu_in.rb +59 -58
  188. data/lib/active_merchant/billing/gateways/payu_latam.rb +139 -97
  189. data/lib/active_merchant/billing/gateways/payway.rb +27 -27
  190. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
  191. data/lib/active_merchant/billing/gateways/pin.rb +87 -34
  192. data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
  193. data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
  194. data/lib/active_merchant/billing/gateways/priority.rb +392 -0
  195. data/lib/active_merchant/billing/gateways/pro_pay.rb +139 -140
  196. data/lib/active_merchant/billing/gateways/psigate.rb +44 -44
  197. data/lib/active_merchant/billing/gateways/psl_card.rb +29 -37
  198. data/lib/active_merchant/billing/gateways/qbms.rb +75 -76
  199. data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
  200. data/lib/active_merchant/billing/gateways/quickbooks.rb +142 -55
  201. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +103 -107
  202. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +156 -158
  203. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +7 -8
  204. data/lib/active_merchant/billing/gateways/quickpay.rb +1 -3
  205. data/lib/active_merchant/billing/gateways/qvalent.rb +137 -68
  206. data/lib/active_merchant/billing/gateways/rapyd.rb +319 -0
  207. data/lib/active_merchant/billing/gateways/reach.rb +277 -0
  208. data/lib/active_merchant/billing/gateways/realex.rb +132 -50
  209. data/lib/active_merchant/billing/gateways/redsys.rb +382 -186
  210. data/lib/active_merchant/billing/gateways/s5.rb +16 -16
  211. data/lib/active_merchant/billing/gateways/safe_charge.rb +83 -47
  212. data/lib/active_merchant/billing/gateways/sage.rb +49 -48
  213. data/lib/active_merchant/billing/gateways/sage_pay.rb +76 -83
  214. data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
  215. data/lib/active_merchant/billing/gateways/secure_net.rb +32 -40
  216. data/lib/active_merchant/billing/gateways/secure_pay.rb +30 -40
  217. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +23 -26
  218. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
  219. data/lib/active_merchant/billing/gateways/securion_pay.rb +69 -31
  220. data/lib/active_merchant/billing/gateways/shift4.rb +342 -0
  221. data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
  222. data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -53
  223. data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
  224. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
  225. data/lib/active_merchant/billing/gateways/spreedly_core.rb +66 -47
  226. data/lib/active_merchant/billing/gateways/stripe.rb +309 -148
  227. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +556 -0
  228. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +18 -23
  229. data/lib/active_merchant/billing/gateways/telr.rb +46 -48
  230. data/lib/active_merchant/billing/gateways/tns.rb +8 -7
  231. data/lib/active_merchant/billing/gateways/trans_first.rb +37 -37
  232. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +249 -245
  233. data/lib/active_merchant/billing/gateways/transact_pro.rb +25 -27
  234. data/lib/active_merchant/billing/gateways/transax.rb +6 -8
  235. data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
  236. data/lib/active_merchant/billing/gateways/trexle.rb +22 -18
  237. data/lib/active_merchant/billing/gateways/trust_commerce.rb +161 -88
  238. data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
  239. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +231 -238
  240. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +129 -55
  241. data/lib/active_merchant/billing/gateways/vanco.rb +42 -33
  242. data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
  243. data/lib/active_merchant/billing/gateways/viaklix.rb +18 -22
  244. data/lib/active_merchant/billing/gateways/visanet_peru.rb +115 -74
  245. data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
  246. data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
  247. data/lib/active_merchant/billing/gateways/wepay.rb +38 -41
  248. data/lib/active_merchant/billing/gateways/wirecard.rb +36 -37
  249. data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
  250. data/lib/active_merchant/billing/gateways/world_net.rb +39 -38
  251. data/lib/active_merchant/billing/gateways/worldpay.rb +756 -142
  252. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +73 -83
  253. data/lib/active_merchant/billing/gateways/worldpay_us.rb +31 -31
  254. data/lib/active_merchant/billing/model.rb +2 -2
  255. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +3 -3
  256. data/lib/active_merchant/billing/rails.rb +1 -1
  257. data/lib/active_merchant/billing/response.rb +32 -13
  258. data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
  259. data/lib/active_merchant/billing.rb +1 -0
  260. data/lib/active_merchant/connection.rb +24 -38
  261. data/lib/active_merchant/country.rb +9 -5
  262. data/lib/active_merchant/errors.rb +4 -1
  263. data/lib/active_merchant/net_http_ssl_connection.rb +2 -0
  264. data/lib/active_merchant/network_connection_retries.rb +28 -31
  265. data/lib/active_merchant/post_data.rb +5 -3
  266. data/lib/active_merchant/posts_data.rb +5 -7
  267. data/lib/active_merchant/version.rb +1 -1
  268. data/lib/active_merchant.rb +3 -3
  269. data/lib/activemerchant.rb +1 -1
  270. data/lib/certs/cacert.pem +1592 -2329
  271. data/lib/support/gateway_support.rb +8 -10
  272. data/lib/support/ssl_verify.rb +9 -14
  273. data/lib/support/ssl_version.rb +9 -10
  274. metadata +98 -37
  275. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
  276. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
  277. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
  278. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
  279. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -309
@@ -1,31 +1,26 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class EbanxGateway < Gateway
4
- self.test_url = 'https://sandbox.ebanx.com/ws/'
5
- self.live_url = 'https://api.ebanx.com/ws/'
4
+ self.test_url = 'https://sandbox.ebanxpay.com/ws/'
5
+ self.live_url = 'https://api.ebanxpay.com/ws/'
6
6
 
7
- self.supported_countries = ['BR', 'MX', 'CO']
7
+ self.supported_countries = %w(BR MX CO CL AR PE)
8
8
  self.default_currency = 'USD'
9
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club]
9
+ self.supported_cardtypes = %i[visa master american_express discover diners_club elo hipercard]
10
10
 
11
11
  self.homepage_url = 'http://www.ebanx.com/'
12
- self.display_name = 'Ebanx'
13
-
14
- CARD_BRAND = {
15
- visa: "visa",
16
- master: "master_card",
17
- american_express: "amex",
18
- discover: "discover",
19
- diners_club: "diners"
20
- }
12
+ self.display_name = 'EBANX'
13
+
14
+ TAGS = ['Spreedly']
21
15
 
22
16
  URL_MAP = {
23
- purchase: "direct",
24
- authorize: "direct",
25
- capture: "capture",
26
- refund: "refund",
27
- void: "cancel",
28
- store: "token"
17
+ purchase: 'direct',
18
+ authorize: 'direct',
19
+ capture: 'capture',
20
+ refund: 'refund',
21
+ void: 'cancel',
22
+ store: 'token',
23
+ inquire: 'query'
29
24
  }
30
25
 
31
26
  HTTP_METHOD = {
@@ -34,51 +29,63 @@ module ActiveMerchant #:nodoc:
34
29
  capture: :get,
35
30
  refund: :post,
36
31
  void: :get,
37
- store: :post
32
+ store: :post,
33
+ inquire: :get
34
+ }
35
+
36
+ VERIFY_AMOUNT_PER_COUNTRY = {
37
+ 'br' => 100,
38
+ 'ar' => 100,
39
+ 'co' => 50000,
40
+ 'pe' => 300,
41
+ 'mx' => 2000,
42
+ 'cl' => 80000
38
43
  }
39
44
 
40
- def initialize(options={})
45
+ def initialize(options = {})
41
46
  requires!(options, :integration_key)
42
47
  super
43
48
  end
44
49
 
45
- def purchase(money, payment, options={})
50
+ def purchase(money, payment, options = {})
46
51
  post = { payment: {} }
47
52
  add_integration_key(post)
48
53
  add_operation(post)
49
54
  add_invoice(post, money, options)
50
55
  add_customer_data(post, payment, options)
51
- add_card_or_token(post, payment)
56
+ add_card_or_token(post, payment, options)
52
57
  add_address(post, options)
53
58
  add_customer_responsible_person(post, payment, options)
59
+ add_additional_data(post, options)
54
60
 
55
61
  commit(:purchase, post)
56
62
  end
57
63
 
58
- def authorize(money, payment, options={})
64
+ def authorize(money, payment, options = {})
59
65
  post = { payment: {} }
60
66
  add_integration_key(post)
61
67
  add_operation(post)
62
68
  add_invoice(post, money, options)
63
69
  add_customer_data(post, payment, options)
64
- add_card_or_token(post, payment)
70
+ add_card_or_token(post, payment, options)
65
71
  add_address(post, options)
66
72
  add_customer_responsible_person(post, payment, options)
73
+ add_additional_data(post, options)
67
74
  post[:payment][:creditcard][:auto_capture] = false
68
75
 
69
76
  commit(:authorize, post)
70
77
  end
71
78
 
72
- def capture(money, authorization, options={})
79
+ def capture(money, authorization, options = {})
73
80
  post = {}
74
81
  add_integration_key(post)
75
82
  post[:hash] = authorization
76
- post[:amount] = amount(money)
83
+ post[:amount] = amount(money) if options[:include_capture_amount].to_s == 'true'
77
84
 
78
85
  commit(:capture, post)
79
86
  end
80
87
 
81
- def refund(money, authorization, options={})
88
+ def refund(money, authorization, options = {})
82
89
  post = {}
83
90
  add_integration_key(post)
84
91
  add_operation(post)
@@ -89,7 +96,7 @@ module ActiveMerchant #:nodoc:
89
96
  commit(:refund, post)
90
97
  end
91
98
 
92
- def void(authorization, options={})
99
+ def void(authorization, options = {})
93
100
  post = {}
94
101
  add_integration_key(post)
95
102
  add_authorization(post, authorization)
@@ -97,7 +104,7 @@ module ActiveMerchant #:nodoc:
97
104
  commit(:void, post)
98
105
  end
99
106
 
100
- def store(credit_card, options={})
107
+ def store(credit_card, options = {})
101
108
  post = {}
102
109
  add_integration_key(post)
103
110
  add_payment_details(post, credit_card)
@@ -106,20 +113,28 @@ module ActiveMerchant #:nodoc:
106
113
  commit(:store, post)
107
114
  end
108
115
 
109
- def verify(credit_card, options={})
116
+ def verify(credit_card, options = {})
110
117
  MultiResponse.run(:use_first_response) do |r|
111
- r.process { authorize(100, credit_card, options) }
118
+ r.process { authorize(VERIFY_AMOUNT_PER_COUNTRY[customer_country(options)], credit_card, options) }
112
119
  r.process(:ignore_result) { void(r.authorization, options) }
113
120
  end
114
121
  end
115
122
 
123
+ def inquire(authorization, options = {})
124
+ post = {}
125
+ add_integration_key(post)
126
+ add_authorization(post, authorization)
127
+
128
+ commit(:inquire, post)
129
+ end
130
+
116
131
  def supports_scrubbing?
117
132
  true
118
133
  end
119
134
 
120
135
  def scrub(transcript)
121
136
  transcript.
122
- gsub(/(integration_key\\?":\\?")(\d*)/, '\1[FILTERED]').
137
+ gsub(/(integration_key\\?":\\?")(\w*)/, '\1[FILTERED]').
123
138
  gsub(/(card_number\\?":\\?")(\d*)/, '\1[FILTERED]').
124
139
  gsub(/(card_cvv\\?":\\?")(\d*)/, '\1[FILTERED]')
125
140
  end
@@ -131,7 +146,7 @@ module ActiveMerchant #:nodoc:
131
146
  end
132
147
 
133
148
  def add_operation(post)
134
- post[:operation] = "request"
149
+ post[:operation] = 'request'
135
150
  end
136
151
 
137
152
  def add_authorization(post, authorization)
@@ -140,14 +155,14 @@ module ActiveMerchant #:nodoc:
140
155
 
141
156
  def add_customer_data(post, payment, options)
142
157
  post[:payment][:name] = customer_name(payment, options)
143
- post[:payment][:email] = options[:email] || "unspecified@example.com"
158
+ post[:payment][:email] = options[:email]
144
159
  post[:payment][:document] = options[:document]
145
160
  post[:payment][:birth_date] = options[:birth_date] if options[:birth_date]
146
161
  end
147
162
 
148
163
  def add_customer_responsible_person(post, payment, options)
149
164
  post[:payment][:person_type] = options[:person_type] if options[:person_type]
150
- if options[:person_type] && options[:person_type].downcase == 'business'
165
+ if options[:person_type]&.casecmp('business')&.zero?
151
166
  post[:payment][:responsible] = {}
152
167
  post[:payment][:responsible][:name] = options[:responsible_name] if options[:responsible_name]
153
168
  post[:payment][:responsible][:document] = options[:responsible_document] if options[:responsible_document]
@@ -157,7 +172,7 @@ module ActiveMerchant #:nodoc:
157
172
 
158
173
  def add_address(post, options)
159
174
  if address = options[:billing_address] || options[:address]
160
- post[:payment][:address] = address[:address1].split[1..-1].join(" ") if address[:address1]
175
+ post[:payment][:address] = address[:address1].split[1..-1].join(' ') if address[:address1]
161
176
  post[:payment][:street_number] = address[:address1].split.first if address[:address1]
162
177
  post[:payment][:city] = address[:city]
163
178
  post[:payment][:state] = address[:state]
@@ -170,20 +185,20 @@ module ActiveMerchant #:nodoc:
170
185
  def add_invoice(post, money, options)
171
186
  post[:payment][:amount_total] = amount(money)
172
187
  post[:payment][:currency_code] = (options[:currency] || currency(money))
173
- post[:payment][:merchant_payment_code] = options[:order_id]
188
+ post[:payment][:merchant_payment_code] = Digest::MD5.hexdigest(options[:order_id])
174
189
  post[:payment][:instalments] = options[:instalments] || 1
190
+ post[:payment][:order_number] = options[:order_id][0..39] if options[:order_id]
175
191
  end
176
192
 
177
- def add_card_or_token(post, payment)
178
- if payment.is_a?(String)
179
- payment, brand = payment.split("|")
180
- end
181
- post[:payment][:payment_type_code] = payment.is_a?(String) ? brand : CARD_BRAND[payment.brand.to_sym]
193
+ def add_card_or_token(post, payment, options)
194
+ payment = payment.split('|')[0] if payment.is_a?(String)
195
+ post[:payment][:payment_type_code] = 'creditcard'
182
196
  post[:payment][:creditcard] = payment_details(payment)
197
+ post[:payment][:creditcard][:soft_descriptor] = options[:soft_descriptor] if options[:soft_descriptor]
183
198
  end
184
199
 
185
200
  def add_payment_details(post, payment)
186
- post[:payment_type_code] = CARD_BRAND[payment.brand.to_sym]
201
+ post[:payment_type_code] = 'creditcard'
187
202
  post[:creditcard] = payment_details(payment)
188
203
  end
189
204
 
@@ -200,13 +215,23 @@ module ActiveMerchant #:nodoc:
200
215
  end
201
216
  end
202
217
 
218
+ def add_additional_data(post, options)
219
+ post[:device_id] = options[:device_id] if options[:device_id]
220
+ post[:metadata] = options[:metadata] if options[:metadata]
221
+ post[:metadata] = {} if post[:metadata].nil?
222
+ post[:metadata][:merchant_payment_code] = options[:order_id] if options[:order_id]
223
+ post[:processing_type] = options[:processing_type] if options[:processing_type]
224
+ post[:payment][:tags] = TAGS
225
+ end
226
+
203
227
  def parse(body)
204
228
  JSON.parse(body)
205
229
  end
206
230
 
207
231
  def commit(action, parameters)
208
232
  url = url_for((test? ? test_url : live_url), action, parameters)
209
- response = parse(ssl_request(HTTP_METHOD[action], url, post_data(action, parameters), {}))
233
+
234
+ response = parse(ssl_request(HTTP_METHOD[action], url, post_data(action, parameters), headers(parameters)))
210
235
 
211
236
  success = success_from(action, response)
212
237
 
@@ -220,60 +245,85 @@ module ActiveMerchant #:nodoc:
220
245
  )
221
246
  end
222
247
 
248
+ def headers(params)
249
+ processing_type = params[:processing_type]
250
+ commit_headers = { 'x-ebanx-client-user-agent': "ActiveMerchant/#{ActiveMerchant::VERSION}" }
251
+
252
+ add_processing_type_to_commit_headers(commit_headers, processing_type) if processing_type == 'local'
253
+
254
+ commit_headers
255
+ end
256
+
257
+ def add_processing_type_to_commit_headers(commit_headers, processing_type)
258
+ commit_headers['x-ebanx-api-processing-type'] = processing_type
259
+ end
260
+
223
261
  def success_from(action, response)
224
- if [:purchase, :capture, :refund].include?(action)
225
- response.try(:[], "payment").try(:[], "status") == "CO"
262
+ payment_status = response.try(:[], 'payment').try(:[], 'status')
263
+
264
+ if %i[purchase capture refund].include?(action)
265
+ payment_status == 'CO'
226
266
  elsif action == :authorize
227
- response.try(:[], "payment").try(:[], "status") == "PE"
267
+ payment_status == 'PE'
228
268
  elsif action == :void
229
- response.try(:[], "payment").try(:[], "status") == "CA"
230
- elsif action == :store
231
- response.try(:[], "status") == "SUCCESS"
269
+ payment_status == 'CA'
270
+ elsif %i[store inquire].include?(action)
271
+ response.try(:[], 'status') == 'SUCCESS'
232
272
  else
233
273
  false
234
274
  end
235
275
  end
236
276
 
237
277
  def message_from(response)
238
- return response["status_message"] if response["status"] == "ERROR"
239
- response.try(:[], "payment").try(:[], "transaction_status").try(:[], "description")
278
+ return response['status_message'] if response['status'] == 'ERROR'
279
+
280
+ response.try(:[], 'payment').try(:[], 'transaction_status').try(:[], 'description')
240
281
  end
241
282
 
242
283
  def authorization_from(action, parameters, response)
243
284
  if action == :store
244
- "#{response.try(:[], "token")}|#{CARD_BRAND[parameters[:payment_type_code].to_sym]}"
285
+ if success_from(action, response)
286
+ "#{response.try(:[], 'token')}|#{response['payment_type_code']}"
287
+ else
288
+ response.try(:[], 'token')
289
+ end
245
290
  else
246
- response.try(:[], "payment").try(:[], "hash")
291
+ response.try(:[], 'payment').try(:[], 'hash')
247
292
  end
248
293
  end
249
294
 
250
295
  def post_data(action, parameters = {})
251
296
  return nil if requires_http_get(action)
252
297
  return convert_to_url_form_encoded(parameters) if action == :refund
298
+
253
299
  "request_body=#{parameters.to_json}"
254
300
  end
255
301
 
256
302
  def url_for(hostname, action, parameters)
257
303
  return "#{hostname}#{URL_MAP[action]}?#{convert_to_url_form_encoded(parameters)}" if requires_http_get(action)
304
+
258
305
  "#{hostname}#{URL_MAP[action]}"
259
306
  end
260
307
 
261
308
  def requires_http_get(action)
262
- return true if [:capture, :void].include?(action)
309
+ return true if %i[capture void inquire].include?(action)
310
+
263
311
  false
264
312
  end
265
313
 
266
314
  def convert_to_url_form_encoded(parameters)
267
315
  parameters.map do |key, value|
268
316
  next if value != false && value.blank?
317
+
269
318
  "#{key}=#{value}"
270
- end.compact.join("&")
319
+ end.compact.join('&')
271
320
  end
272
321
 
273
322
  def error_code_from(response, success)
274
323
  unless success
275
- return response["status_code"] if response["status"] == "ERROR"
276
- response.try(:[], "payment").try(:[], "transaction_status").try(:[], "code")
324
+ return response['status_code'] if response['status'] == 'ERROR'
325
+
326
+ response.try(:[], 'payment').try(:[], 'transaction_status').try(:[], 'code')
277
327
  end
278
328
  end
279
329
 
@@ -286,7 +336,7 @@ module ActiveMerchant #:nodoc:
286
336
  def customer_name(payment, options)
287
337
  address_name = options[:billing_address][:name] if options[:billing_address] && options[:billing_address][:name]
288
338
  if payment.is_a?(String)
289
- address_name || "Not Provided"
339
+ address_name || 'Not Provided'
290
340
  else
291
341
  payment.name
292
342
  end
@@ -2,10 +2,9 @@ require 'rexml/document'
2
2
 
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
-
6
5
  class EfsnetGateway < Gateway
7
6
  self.supported_countries = ['US']
8
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
7
+ self.supported_cardtypes = %i[visa master american_express discover]
9
8
  self.homepage_url = 'http://www.concordefsnet.com/'
10
9
  self.display_name = 'Efsnet'
11
10
 
@@ -54,8 +53,8 @@ module ActiveMerchant #:nodoc:
54
53
 
55
54
  def void(identification, options = {})
56
55
  requires!(options, :order_id)
57
- original_transaction_id, _ = identification.split(";")
58
- commit(:void_transaction, {:reference_number => format_reference_number(options[:order_id]), :transaction_id => original_transaction_id})
56
+ original_transaction_id, = identification.split(';')
57
+ commit(:void_transaction, { reference_number: format_reference_number(options[:order_id]), transaction_id: original_transaction_id })
59
58
  end
60
59
 
61
60
  def voice_authorize(money, authorization_code, creditcard, options = {})
@@ -77,16 +76,16 @@ module ActiveMerchant #:nodoc:
77
76
  private
78
77
 
79
78
  def build_refund_or_settle_request(money, identification, options = {})
80
- original_transaction_id, original_transaction_amount = identification.split(";")
79
+ original_transaction_id, original_transaction_amount = identification.split(';')
81
80
 
82
81
  requires!(options, :order_id)
83
82
 
84
83
  {
85
- :reference_number => format_reference_number(options[:order_id]),
86
- :transaction_amount => amount(money),
87
- :original_transaction_amount => original_transaction_amount,
88
- :original_transaction_id => original_transaction_id,
89
- :client_ip_address => options[:ip]
84
+ reference_number: format_reference_number(options[:order_id]),
85
+ transaction_amount: amount(money),
86
+ original_transaction_amount: original_transaction_amount,
87
+ original_transaction_id: original_transaction_id,
88
+ client_ip_address: options[:ip]
90
89
  }
91
90
  end
92
91
 
@@ -94,65 +93,63 @@ module ActiveMerchant #:nodoc:
94
93
  requires!(options, :order_id)
95
94
 
96
95
  post = {
97
- :reference_number => format_reference_number(options[:order_id]),
98
- :authorization_number => options[:authorization_number],
99
- :transaction_amount => amount(money),
100
- :client_ip_address => options[:ip]
96
+ reference_number: format_reference_number(options[:order_id]),
97
+ authorization_number: options[:authorization_number],
98
+ transaction_amount: amount(money),
99
+ client_ip_address: options[:ip]
101
100
 
102
101
  }
103
- add_creditcard(post,creditcard)
104
- add_address(post,options)
102
+ add_creditcard(post, creditcard)
103
+ add_address(post, options)
105
104
  post
106
105
  end
107
106
 
108
107
  def format_reference_number(number)
109
- number.to_s.slice(0,12)
108
+ number.to_s.slice(0, 12)
110
109
  end
111
110
 
112
- def add_address(post,options)
111
+ def add_address(post, options)
113
112
  if address = options[:billing_address] || options[:address]
114
113
  if address[:address2]
115
- post[:billing_address] = address[:address1].to_s << ' ' << address[:address2].to_s
114
+ post[:billing_address] = address[:address1].to_s << ' ' << address[:address2].to_s
116
115
  else
117
116
  post[:billing_address] = address[:address1].to_s
118
117
  end
119
118
  post[:billing_city] = address[:city].to_s
120
- post[:billing_state] = address[:state].blank? ? 'n/a' : address[:state]
119
+ post[:billing_state] = address[:state].blank? ? 'n/a' : address[:state]
121
120
  post[:billing_postal_code] = address[:zip].to_s
122
121
  post[:billing_country] = address[:country].to_s
123
122
  end
124
123
 
125
124
  if address = options[:shipping_address]
126
125
  if address[:address2]
127
- post[:shipping_address] = address[:address1].to_s << ' ' << address[:address2].to_s
126
+ post[:shipping_address] = address[:address1].to_s << ' ' << address[:address2].to_s
128
127
  else
129
128
  post[:shipping_address] = address[:address1].to_s
130
129
  end
131
130
  post[:shipping_city] = address[:city].to_s
132
- post[:shipping_state] = address[:state].blank? ? 'n/a' : address[:state]
131
+ post[:shipping_state] = address[:state].blank? ? 'n/a' : address[:state]
133
132
  post[:shipping_postal_code] = address[:zip].to_s
134
133
  post[:shipping_country] = address[:country].to_s
135
134
  end
136
135
  end
137
136
 
138
137
  def add_creditcard(post, creditcard)
139
- post[:billing_name] = creditcard.name if creditcard.name
140
- post[:account_number] = creditcard.number
138
+ post[:billing_name] = creditcard.name if creditcard.name
139
+ post[:account_number] = creditcard.number
141
140
  post[:card_verification_value] = creditcard.verification_value if creditcard.verification_value?
142
- post[:expiration_month] = sprintf("%.2i", creditcard.month)
143
- post[:expiration_year] = sprintf("%.4i", creditcard.year)[-2..-1]
141
+ post[:expiration_month] = sprintf('%.2i', creditcard.month)
142
+ post[:expiration_year] = sprintf('%.4i', creditcard.year)[-2..-1]
144
143
  end
145
144
 
146
-
147
145
  def commit(action, parameters)
148
146
  response = parse(ssl_post(test? ? self.test_url : self.live_url, post_data(action, parameters), 'Content-Type' => 'text/xml'))
149
147
 
150
148
  Response.new(success?(response), message_from(response[:result_message]), response,
151
- :test => test?,
152
- :authorization => authorization_from(response, parameters),
153
- :avs_result => { :code => response[:avs_response_code] },
154
- :cvv_result => response[:cvv_response_code]
155
- )
149
+ test: test?,
150
+ authorization: authorization_from(response, parameters),
151
+ avs_result: { code: response[:avs_response_code] },
152
+ cvv_result: response[:cvv_response_code])
156
153
  end
157
154
 
158
155
  def success?(response)
@@ -160,7 +157,7 @@ module ActiveMerchant #:nodoc:
160
157
  end
161
158
 
162
159
  def authorization_from(response, params)
163
- [ response[:transaction_id], params[:transaction_amount] ].compact.join(';')
160
+ [response[:transaction_id], params[:transaction_amount]].compact.join(';')
164
161
  end
165
162
 
166
163
  def parse(xml)
@@ -169,9 +166,7 @@ module ActiveMerchant #:nodoc:
169
166
  xml = REXML::Document.new(xml)
170
167
 
171
168
  xml.elements.each('//Reply//TransactionReply/*') do |node|
172
-
173
169
  response[node.name.underscore.to_sym] = normalize(node.text)
174
-
175
170
  end unless xml.root.nil?
176
171
 
177
172
  response
@@ -179,10 +174,10 @@ module ActiveMerchant #:nodoc:
179
174
 
180
175
  def post_data(action, parameters = {})
181
176
  xml = REXML::Document.new("<?xml version='1.0' encoding='UTF-8'?>")
182
- root = xml.add_element("Request")
183
- root.attributes["StoreID"] = options[:login]
184
- root.attributes["StoreKey"] = options[:password]
185
- root.attributes["ApplicationID"] = 'ot 1.0'
177
+ root = xml.add_element('Request')
178
+ root.attributes['StoreID'] = options[:login]
179
+ root.attributes['StoreKey'] = options[:password]
180
+ root.attributes['ApplicationID'] = 'ot 1.0'
186
181
  transaction = root.add_element(action.to_s.camelize)
187
182
 
188
183
  actions[action].each do |key|
@@ -194,25 +189,26 @@ module ActiveMerchant #:nodoc:
194
189
 
195
190
  def message_from(message)
196
191
  return 'Unspecified error' if message.blank?
197
- message.gsub(/[^\w]/, ' ').split.join(" ").capitalize
192
+
193
+ message.gsub(/[^\w]/, ' ').split.join(' ').capitalize
198
194
  end
199
195
 
200
196
  def actions
201
197
  ACTIONS
202
198
  end
203
199
 
204
- CREDIT_CARD_FIELDS = %w(AuthorizationNumber ClientIpAddress BillingAddress BillingCity BillingState BillingPostalCode BillingCountry BillingName CardVerificationValue ExpirationMonth ExpirationYear ReferenceNumber TransactionAmount AccountNumber )
200
+ CREDIT_CARD_FIELDS = %w(AuthorizationNumber ClientIpAddress BillingAddress BillingCity BillingState BillingPostalCode BillingCountry BillingName CardVerificationValue ExpirationMonth ExpirationYear ReferenceNumber TransactionAmount AccountNumber)
205
201
 
206
202
  ACTIONS = {
207
- :credit_card_authorize => CREDIT_CARD_FIELDS,
208
- :credit_card_charge => CREDIT_CARD_FIELDS,
209
- :credit_card_voice_authorize => CREDIT_CARD_FIELDS,
210
- :credit_card_capture => CREDIT_CARD_FIELDS,
211
- :credit_card_credit => CREDIT_CARD_FIELDS + ["OriginalTransactionAmount"],
212
- :credit_card_refund => %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
213
- :void_transaction => %w(ReferenceNumber TransactionID),
214
- :credit_card_settle => %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
215
- :system_check => %w(SystemCheck),
203
+ credit_card_authorize: CREDIT_CARD_FIELDS,
204
+ credit_card_charge: CREDIT_CARD_FIELDS,
205
+ credit_card_voice_authorize: CREDIT_CARD_FIELDS,
206
+ credit_card_capture: CREDIT_CARD_FIELDS,
207
+ credit_card_credit: CREDIT_CARD_FIELDS + ['OriginalTransactionAmount'],
208
+ credit_card_refund: %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
209
+ void_transaction: %w(ReferenceNumber TransactionID),
210
+ credit_card_settle: %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
211
+ system_check: %w(SystemCheck)
216
212
  }
217
213
  end
218
214
  end