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
@@ -3,15 +3,15 @@ require 'json'
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class EwayRapidGateway < Gateway
6
- self.test_url = "https://api.sandbox.ewaypayments.com/"
7
- self.live_url = "https://api.ewaypayments.com/"
6
+ self.test_url = 'https://api.sandbox.ewaypayments.com/'
7
+ self.live_url = 'https://api.ewaypayments.com/'
8
8
 
9
9
  self.money_format = :cents
10
- self.supported_countries = ['AU', 'NZ', 'GB', 'SG', 'MY', 'HK']
11
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
12
- self.homepage_url = "http://www.eway.com.au/"
13
- self.display_name = "eWAY Rapid 3.1"
14
- self.default_currency = "AUD"
10
+ self.supported_countries = %w[AU NZ GB SG MY HK]
11
+ self.supported_cardtypes = %i[visa master american_express diners_club jcb]
12
+ self.homepage_url = 'http://www.eway.com.au/'
13
+ self.display_name = 'eWAY Rapid 3.1'
14
+ self.default_currency = 'AUD'
15
15
 
16
16
  class_attribute :partner_id
17
17
 
@@ -47,21 +47,22 @@ module ActiveMerchant #:nodoc:
47
47
  # (default: "https://github.com/activemerchant/active_merchant")
48
48
  #
49
49
  # Returns an ActiveMerchant::Billing::Response object where authorization is the Transaction ID on success
50
- def purchase(amount, payment_method, options={})
50
+ def purchase(amount, payment_method, options = {})
51
51
  params = {}
52
52
  add_metadata(params, options)
53
53
  add_invoice(params, amount, options)
54
- add_customer_data(params, options)
54
+ add_customer_data(params, options, payment_method)
55
55
  add_credit_card(params, payment_method, options)
56
+ add_3ds_authenticated_data(params, options) if options[:three_d_secure]
56
57
  params['Method'] = payment_method.respond_to?(:number) ? 'ProcessPayment' : 'TokenPayment'
57
58
  commit(url_for('Transaction'), params)
58
59
  end
59
60
 
60
- def authorize(amount, payment_method, options={})
61
+ def authorize(amount, payment_method, options = {})
61
62
  params = {}
62
63
  add_metadata(params, options)
63
64
  add_invoice(params, amount, options)
64
- add_customer_data(params, options)
65
+ add_customer_data(params, options, payment_method)
65
66
  add_credit_card(params, payment_method, options)
66
67
  params['Method'] = 'Authorise'
67
68
  commit(url_for('Authorisation'), params)
@@ -72,13 +73,13 @@ module ActiveMerchant #:nodoc:
72
73
  add_metadata(params, options)
73
74
  add_invoice(params, amount, options)
74
75
  add_reference(params, identification)
75
- commit(url_for("CapturePayment"), params)
76
+ commit(url_for('CapturePayment'), params)
76
77
  end
77
78
 
78
79
  def void(identification, options = {})
79
80
  params = {}
80
81
  add_reference(params, identification)
81
- commit(url_for("CancelAuthorisation"), params)
82
+ commit(url_for('CancelAuthorisation'), params)
82
83
  end
83
84
 
84
85
  # Public: Refund a transaction.
@@ -109,8 +110,8 @@ module ActiveMerchant #:nodoc:
109
110
  def refund(amount, identification, options = {})
110
111
  params = {}
111
112
  add_metadata(params, options)
112
- add_invoice(params, amount, options, "Refund")
113
- add_reference(params["Refund"], identification)
113
+ add_invoice(params, amount, options, 'Refund')
114
+ add_reference(params['Refund'], identification)
114
115
  add_customer_data(params, options)
115
116
  commit(url_for("Transaction/#{identification}/Refund"), params)
116
117
  end
@@ -137,10 +138,10 @@ module ActiveMerchant #:nodoc:
137
138
  params = {}
138
139
  add_metadata(params, options)
139
140
  add_invoice(params, 0, options)
140
- add_customer_data(params, options)
141
+ add_customer_data(params, options, payment_method)
141
142
  add_credit_card(params, payment_method, options)
142
143
  params['Method'] = 'CreateTokenCustomer'
143
- commit(url_for("Transaction"), params)
144
+ commit(url_for('Transaction'), params)
144
145
  end
145
146
 
146
147
  # Public: Update a customer's data
@@ -166,11 +167,11 @@ module ActiveMerchant #:nodoc:
166
167
  params = {}
167
168
  add_metadata(params, options)
168
169
  add_invoice(params, 0, options)
169
- add_customer_data(params, options)
170
+ add_customer_data(params, options, payment_method)
170
171
  add_credit_card(params, payment_method, options)
171
172
  add_customer_token(params, customer_token)
172
173
  params['Method'] = 'UpdateTokenCustomer'
173
- commit(url_for("Transaction"), params)
174
+ commit(url_for('Transaction'), params)
174
175
  end
175
176
 
176
177
  def supports_scrubbing
@@ -197,14 +198,26 @@ module ActiveMerchant #:nodoc:
197
198
  params
198
199
  end
199
200
 
200
- def add_invoice(params, money, options, key = "Payment")
201
+ def add_3ds_authenticated_data(params, options)
202
+ three_d_secure_options = options[:three_d_secure]
203
+ params['PaymentInstrument'] ||= {} if params['PaymentInstrument'].nil?
204
+ threed_secure_auth = params['PaymentInstrument']['ThreeDSecureAuth'] = {}
205
+ threed_secure_auth['Cryptogram'] = three_d_secure_options[:cavv]
206
+ threed_secure_auth['ECI'] = three_d_secure_options[:eci]
207
+ threed_secure_auth['XID'] = three_d_secure_options[:xid]
208
+ threed_secure_auth['AuthStatus'] = three_d_secure_options[:authentication_response_status]
209
+ threed_secure_auth['dsTransactionId'] = three_d_secure_options[:ds_transaction_id]
210
+ threed_secure_auth['Version'] = three_d_secure_options[:version]
211
+ end
212
+
213
+ def add_invoice(params, money, options, key = 'Payment')
201
214
  currency_code = options[:currency] || currency(money)
202
215
  params[key] = {
203
216
  'TotalAmount' => localized_amount(money, currency_code),
204
217
  'InvoiceReference' => truncate(options[:order_id], 50),
205
218
  'InvoiceNumber' => truncate(options[:invoice] || options[:order_id], 12),
206
219
  'InvoiceDescription' => truncate(options[:description], 64),
207
- 'CurrencyCode' => currency_code,
220
+ 'CurrencyCode' => currency_code
208
221
  }
209
222
  end
210
223
 
@@ -212,17 +225,48 @@ module ActiveMerchant #:nodoc:
212
225
  params['TransactionID'] = reference
213
226
  end
214
227
 
215
- def add_customer_data(params, options)
216
- params['Customer'] ||= {}
217
- add_address(params['Customer'], (options[:billing_address] || options[:address]), {:email => options[:email]})
218
- params['ShippingAddress'] = {}
219
- add_address(params['ShippingAddress'], options[:shipping_address], {:skip_company => true})
228
+ def add_customer_data(params, options, payment_method = nil)
229
+ add_customer_fields(params, options, payment_method)
230
+ add_shipping_fields(params, options)
231
+ end
232
+
233
+ def add_customer_fields(params, options, payment_method)
234
+ key = 'Customer'
235
+ params[key] ||= {}
236
+
237
+ customer_address = options[:billing_address] || options[:address]
238
+
239
+ add_name_and_email(params[key], customer_address, options[:email], payment_method)
240
+ add_address(params[key], customer_address)
220
241
  end
221
242
 
222
- def add_address(params, address, options={})
243
+ def add_shipping_fields(params, options)
244
+ key = 'ShippingAddress'
245
+ params[key] = {}
246
+
247
+ add_name_and_email(params[key], options[:shipping_address], options[:email])
248
+ add_address(params[key], options[:shipping_address], { skip_company: true })
249
+ end
250
+
251
+ def add_name_and_email(params, address, email, payment_method = nil)
252
+ if address.present?
253
+ params['FirstName'], params['LastName'] = split_names(address[:name])
254
+ elsif payment_method_name_available?(payment_method)
255
+ params['FirstName'] = payment_method.first_name
256
+ params['LastName'] = payment_method.last_name
257
+ end
258
+
259
+ params['Email'] = email
260
+ end
261
+
262
+ def payment_method_name_available?(payment_method)
263
+ payment_method.respond_to?(:first_name) && payment_method.respond_to?(:last_name) &&
264
+ payment_method.first_name.present? && payment_method.last_name.present?
265
+ end
266
+
267
+ def add_address(params, address, options = {})
223
268
  return unless address
224
269
 
225
- params['FirstName'], params['LastName'] = split_names(address[:name])
226
270
  params['Title'] = address[:title]
227
271
  params['CompanyName'] = address[:company] unless options[:skip_company]
228
272
  params['Street1'] = truncate(address[:address1], 50)
@@ -231,20 +275,20 @@ module ActiveMerchant #:nodoc:
231
275
  params['State'] = address[:state]
232
276
  params['PostalCode'] = address[:zip]
233
277
  params['Country'] = address[:country].to_s.downcase
234
- params['Phone'] = address[:phone]
278
+ params['Phone'] = address[:phone] || address[:phone_number]
235
279
  params['Fax'] = address[:fax]
236
- params['Email'] = options[:email]
237
280
  end
238
281
 
239
282
  def add_credit_card(params, credit_card, options)
240
283
  return unless credit_card
284
+
241
285
  params['Customer'] ||= {}
242
286
  if credit_card.respond_to? :number
243
287
  card_details = params['Customer']['CardDetails'] = {}
244
288
  card_details['Name'] = truncate(credit_card.name, 50)
245
289
  card_details['Number'] = credit_card.number
246
- card_details['ExpiryMonth'] = "%02d" % (credit_card.month || 0)
247
- card_details['ExpiryYear'] = "%02d" % (credit_card.year || 0)
290
+ card_details['ExpiryMonth'] = '%02d' % (credit_card.month || 0)
291
+ card_details['ExpiryYear'] = '%02d' % (credit_card.year || 0)
248
292
  card_details['CVN'] = credit_card.verification_value
249
293
  else
250
294
  add_customer_token(params, credit_card)
@@ -262,8 +306,8 @@ module ActiveMerchant #:nodoc:
262
306
 
263
307
  def commit(url, params)
264
308
  headers = {
265
- "Authorization" => ("Basic " + Base64.strict_encode64(@options[:login].to_s + ":" + @options[:password].to_s).chomp),
266
- "Content-Type" => "application/json"
309
+ 'Authorization' => ('Basic ' + Base64.strict_encode64(@options[:login].to_s + ':' + @options[:password].to_s).chomp),
310
+ 'Content-Type' => 'application/json'
267
311
  }
268
312
  request = params.to_json
269
313
  raw = parse(ssl_post(url, request, headers))
@@ -273,13 +317,13 @@ module ActiveMerchant #:nodoc:
273
317
  succeeded,
274
318
  message_from(succeeded, raw),
275
319
  raw,
276
- :authorization => authorization_from(raw),
277
- :test => test?,
278
- :avs_result => avs_result_from(raw),
279
- :cvv_result => cvv_result_from(raw)
320
+ authorization: authorization_from(raw),
321
+ test: test?,
322
+ avs_result: avs_result_from(raw),
323
+ cvv_result: cvv_result_from(raw)
280
324
  )
281
325
  rescue ActiveMerchant::ResponseError => e
282
- return ActiveMerchant::Billing::Response.new(false, e.response.message, {:status_code => e.response.code}, :test => test?)
326
+ return ActiveMerchant::Billing::Response.new(false, e.response.message, { status_code: e.response.code }, test: test?)
283
327
  end
284
328
 
285
329
  def parse(data)
@@ -287,19 +331,19 @@ module ActiveMerchant #:nodoc:
287
331
  end
288
332
 
289
333
  def success?(response)
290
- if response['ResponseCode'] == "00"
334
+ if response['ResponseCode'] == '00'
291
335
  true
292
336
  elsif response['TransactionStatus']
293
337
  (response['TransactionStatus'] == true)
294
- elsif response["Succeeded"]
295
- (response["Succeeded"] == true)
338
+ elsif response['Succeeded']
339
+ (response['Succeeded'] == true)
296
340
  else
297
341
  false
298
342
  end
299
343
  end
300
344
 
301
345
  def parse_errors(message)
302
- errors = message.split(',').collect{|code| MESSAGES[code.strip]}.flatten.join(',')
346
+ errors = message.split(',').collect { |code| MESSAGES[code.strip] }.flatten.join(',')
303
347
  errors.presence || message
304
348
  end
305
349
 
@@ -311,9 +355,9 @@ module ActiveMerchant #:nodoc:
311
355
  elsif response['ResponseCode']
312
356
  ActiveMerchant::Billing::EwayGateway::MESSAGES[response['ResponseCode']]
313
357
  elsif succeeded
314
- "Succeeded"
358
+ 'Succeeded'
315
359
  else
316
- "Failed"
360
+ 'Failed'
317
361
  end
318
362
  end
319
363
 
@@ -325,26 +369,27 @@ module ActiveMerchant #:nodoc:
325
369
 
326
370
  def avs_result_from(response)
327
371
  verification = response['Verification'] || {}
328
- code = case verification['Address']
329
- when "Valid"
330
- "M"
331
- when "Invalid"
332
- "N"
333
- else
334
- "I"
335
- end
336
- {:code => code}
372
+ code =
373
+ case verification['Address']
374
+ when 'Valid'
375
+ 'M'
376
+ when 'Invalid'
377
+ 'N'
378
+ else
379
+ 'I'
380
+ end
381
+ { code: code }
337
382
  end
338
383
 
339
384
  def cvv_result_from(response)
340
385
  verification = response['Verification'] || {}
341
386
  case verification['CVN']
342
- when "Valid"
343
- "M"
344
- when "Invalid"
345
- "N"
387
+ when 'Valid'
388
+ 'M'
389
+ when 'Invalid'
390
+ 'N'
346
391
  else
347
- "P"
392
+ 'P'
348
393
  end
349
394
  end
350
395
 
@@ -526,7 +571,7 @@ module ActiveMerchant #:nodoc:
526
571
  'V6150' => 'Invalid Refund Amount',
527
572
  'V6151' => 'Refund amount greater than original transaction',
528
573
  'V6152' => 'Original transaction already refunded for total amount',
529
- 'V6153' => 'Card type not support by merchant',
574
+ 'V6153' => 'Card type not support by merchant'
530
575
  }
531
576
  end
532
577
  end
@@ -3,40 +3,35 @@ module ActiveMerchant #:nodoc:
3
3
  class ExactGateway < Gateway
4
4
  self.live_url = self.test_url = 'https://secure2.e-xact.com/vplug-in/transaction/rpc-enc/service.asmx'
5
5
 
6
- API_VERSION = "8.5"
6
+ API_VERSION = '8.5'
7
7
 
8
- TEST_LOGINS = [ {:login => "A00049-01", :password => "test1"},
9
- {:login => "A00427-01", :password => "testus"} ]
10
-
11
- TRANSACTIONS = { :sale => "00",
12
- :authorization => "01",
13
- :capture => "32",
14
- :credit => "34" }
8
+ TEST_LOGINS = [{ login: 'A00049-01', password: 'test1' },
9
+ { login: 'A00427-01', password: 'testus' }]
15
10
 
11
+ TRANSACTIONS = { sale: '00',
12
+ authorization: '01',
13
+ capture: '32',
14
+ credit: '34' }
16
15
 
17
16
  ENVELOPE_NAMESPACES = { 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
18
17
  'xmlns:env' => 'http://schemas.xmlsoap.org/soap/envelope/',
19
- 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
20
- }
18
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' }
21
19
 
22
- SEND_AND_COMMIT_ATTRIBUTES = { 'xmlns:n1' => "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Request",
23
- 'env:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/'
24
- }
20
+ SEND_AND_COMMIT_ATTRIBUTES = { 'xmlns:n1' => 'http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Request',
21
+ 'env:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/' }
25
22
 
26
23
  SEND_AND_COMMIT_SOURCE_ATTRIBUTES = { 'xmlns:n2' => 'http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes',
27
- 'xsi:type' => 'n2:Transaction'
28
- }
24
+ 'xsi:type' => 'n2:Transaction' }
29
25
 
30
- POST_HEADERS = { 'soapAction' => "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/SendAndCommit",
31
- 'Content-Type' => 'text/xml'
32
- }
26
+ POST_HEADERS = { 'soapAction' => 'http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/SendAndCommit',
27
+ 'Content-Type' => 'text/xml' }
33
28
 
34
- SUCCESS = "true"
29
+ SUCCESS = 'true'
35
30
 
36
- SENSITIVE_FIELDS = [ :verification_str2, :expiry_date, :card_number ]
31
+ SENSITIVE_FIELDS = %i[verification_str2 expiry_date card_number]
37
32
 
38
- self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :discover]
39
- self.supported_countries = ['CA', 'US']
33
+ self.supported_countries = %w[CA US]
34
+ self.supported_cardtypes = %i[visa master american_express jcb discover]
40
35
  self.homepage_url = 'http://www.e-xact.com'
41
36
  self.display_name = 'E-xact'
42
37
 
@@ -161,19 +156,17 @@ module ActiveMerchant #:nodoc:
161
156
  end
162
157
 
163
158
  def commit(action, request)
164
- response = parse(ssl_post(self.live_url, build_request(action, request), POST_HEADERS))
165
-
166
- Response.new(successful?(response), message_from(response), response,
167
- :test => test?,
168
- :authorization => authorization_from(response),
169
- :avs_result => { :code => response[:avs] },
170
- :cvv_result => response[:cvv2]
171
- )
159
+ response = parse(ssl_post(self.live_url, build_request(action, request), POST_HEADERS))
172
160
 
161
+ Response.new(successful?(response), message_from(response), response,
162
+ test: test?,
163
+ authorization: authorization_from(response),
164
+ avs_result: { code: response[:avs] },
165
+ cvv_result: response[:cvv2])
173
166
  rescue ResponseError => e
174
167
  case e.response.code
175
168
  when '401'
176
- return Response.new(false, "Invalid Login: #{e.response.body}", {}, :test => test?)
169
+ return Response.new(false, "Invalid Login: #{e.response.body}", {}, test: test?)
177
170
  else
178
171
  raise
179
172
  end
@@ -185,9 +178,9 @@ module ActiveMerchant #:nodoc:
185
178
 
186
179
  def authorization_from(response)
187
180
  if response[:authorization_num] && response[:transaction_tag]
188
- "#{response[:authorization_num]};#{response[:transaction_tag]}"
181
+ "#{response[:authorization_num]};#{response[:transaction_tag]}"
189
182
  else
190
- ''
183
+ ''
191
184
  end
192
185
  end
193
186
 
@@ -207,13 +200,13 @@ module ActiveMerchant #:nodoc:
207
200
  response = {}
208
201
  xml = REXML::Document.new(xml)
209
202
 
210
- if root = REXML::XPath.first(xml, "//types:TransactionResult")
203
+ if root = REXML::XPath.first(xml, '//types:TransactionResult')
211
204
  parse_elements(response, root)
212
- elsif root = REXML::XPath.first(xml, "//soap:Fault")
205
+ elsif root = REXML::XPath.first(xml, '//soap:Fault')
213
206
  parse_elements(response, root)
214
207
  end
215
208
 
216
- response.delete_if{ |k,v| SENSITIVE_FIELDS.include?(k) }
209
+ response.delete_if { |k, _v| SENSITIVE_FIELDS.include?(k) }
217
210
  end
218
211
 
219
212
  def parse_elements(response, root)
@@ -224,4 +217,3 @@ module ActiveMerchant #:nodoc:
224
217
  end
225
218
  end
226
219
  end
227
-
@@ -5,17 +5,17 @@ module ActiveMerchant
5
5
 
6
6
  self.supported_countries = %w(AU CA CN FR DE GI IL MT MU MX NL NZ PA PH RU SG KR ES KN GB US)
7
7
  self.default_currency = 'USD'
8
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club]
8
+ self.supported_cardtypes = %i[visa master american_express discover jcb diners_club]
9
9
 
10
10
  self.homepage_url = 'http://www.ezic.com/'
11
11
  self.display_name = 'Ezic'
12
12
 
13
- def initialize(options={})
13
+ def initialize(options = {})
14
14
  requires!(options, :account_id)
15
15
  super
16
16
  end
17
17
 
18
- def purchase(money, payment, options={})
18
+ def purchase(money, payment, options = {})
19
19
  post = {}
20
20
 
21
21
  add_account_id(post)
@@ -23,10 +23,10 @@ module ActiveMerchant
23
23
  add_payment(post, payment)
24
24
  add_customer_data(post, options)
25
25
 
26
- commit("S", post)
26
+ commit('S', post)
27
27
  end
28
28
 
29
- def authorize(money, payment, options={})
29
+ def authorize(money, payment, options = {})
30
30
  post = {}
31
31
 
32
32
  add_account_id(post)
@@ -34,10 +34,10 @@ module ActiveMerchant
34
34
  add_payment(post, payment)
35
35
  add_customer_data(post, options)
36
36
 
37
- commit("A", post)
37
+ commit('A', post)
38
38
  end
39
39
 
40
- def capture(money, authorization, options={})
40
+ def capture(money, authorization, options = {})
41
41
  post = {}
42
42
 
43
43
  add_account_id(post)
@@ -45,10 +45,10 @@ module ActiveMerchant
45
45
  add_authorization(post, authorization)
46
46
  add_pay_type(post)
47
47
 
48
- commit("D", post)
48
+ commit('D', post)
49
49
  end
50
50
 
51
- def refund(money, authorization, options={})
51
+ def refund(money, authorization, options = {})
52
52
  post = {}
53
53
 
54
54
  add_account_id(post)
@@ -56,20 +56,20 @@ module ActiveMerchant
56
56
  add_authorization(post, authorization)
57
57
  add_pay_type(post)
58
58
 
59
- commit("R", post)
59
+ commit('R', post)
60
60
  end
61
61
 
62
- def void(authorization, options={})
62
+ def void(authorization, options = {})
63
63
  post = {}
64
64
 
65
65
  add_account_id(post)
66
66
  add_authorization(post, authorization)
67
67
  add_pay_type(post)
68
68
 
69
- commit("U", post)
69
+ commit('U', post)
70
70
  end
71
71
 
72
- def verify(credit_card, options={})
72
+ def verify(credit_card, options = {})
73
73
  MultiResponse.run(:use_first_response) do |r|
74
74
  r.process { authorize(100, credit_card, options) }
75
75
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -143,7 +143,7 @@ module ActiveMerchant
143
143
  end
144
144
 
145
145
  def add_pay_type(post)
146
- post[:pay_type] = "C"
146
+ post[:pay_type] = 'C'
147
147
  end
148
148
 
149
149
  def parse(body)
@@ -160,8 +160,8 @@ module ActiveMerchant
160
160
  message_from(response),
161
161
  response,
162
162
  authorization: authorization_from(response),
163
- avs_result: AVSResult.new(code: response["avs_code"]),
164
- cvv_result: CVVResult.new(response["cvv2_code"]),
163
+ avs_result: AVSResult.new(code: response['avs_code']),
164
+ cvv_result: CVVResult.new(response['cvv2_code']),
165
165
  test: test?
166
166
  )
167
167
  rescue ResponseError => e
@@ -170,27 +170,26 @@ module ActiveMerchant
170
170
  end
171
171
 
172
172
  def success_from(response)
173
- response["status_code"] == "1" || response["status_code"] == "T"
173
+ response['status_code'] == '1' || response['status_code'] == 'T'
174
174
  end
175
175
 
176
176
  def message_from(response)
177
- response["auth_msg"]
177
+ response['auth_msg']
178
178
  end
179
179
 
180
180
  def authorization_from(response)
181
- response["trans_id"]
181
+ response['trans_id']
182
182
  end
183
183
 
184
184
  def post_data(parameters = {})
185
- parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
185
+ parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
186
186
  end
187
187
 
188
188
  def headers
189
189
  {
190
- "User-Agent" => "ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
190
+ 'User-Agent' => "ActiveMerchantBindings/#{ActiveMerchant::VERSION}"
191
191
  }
192
192
  end
193
193
  end
194
-
195
194
  end
196
195
  end