activemerchant 1.45.0 → 1.126.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (288) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG +2167 -2
  3. data/CONTRIBUTORS +57 -0
  4. data/README.md +62 -41
  5. data/lib/active_merchant/billing/avs_result.rb +25 -28
  6. data/lib/active_merchant/billing/base.rb +11 -35
  7. data/lib/active_merchant/billing/check.rb +28 -24
  8. data/lib/active_merchant/billing/compatibility.rb +10 -12
  9. data/lib/active_merchant/billing/credit_card.rb +141 -69
  10. data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
  11. data/lib/active_merchant/billing/credit_card_methods.rb +348 -52
  12. data/lib/active_merchant/billing/cvv_result.rb +0 -1
  13. data/lib/active_merchant/billing/gateway.rb +125 -61
  14. data/lib/active_merchant/billing/gateways/adyen.rb +633 -127
  15. data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
  16. data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
  17. data/lib/active_merchant/billing/gateways/authorize_net.rb +883 -195
  18. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
  19. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -103
  20. data/lib/active_merchant/billing/gateways/axcessms.rb +179 -0
  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 +24 -13
  25. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
  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 +143 -62
  29. data/lib/active_merchant/billing/gateways/beanstream.rb +45 -13
  30. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +13 -10
  31. data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -506
  32. data/lib/active_merchant/billing/gateways/blue_snap.rb +623 -0
  33. data/lib/active_merchant/billing/gateways/bogus.rb +82 -36
  34. data/lib/active_merchant/billing/gateways/borgun.rb +61 -40
  35. data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
  36. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +21 -2
  37. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
  38. data/lib/active_merchant/billing/gateways/braintree.rb +3 -3
  39. data/lib/active_merchant/billing/gateways/braintree_blue.rb +592 -203
  40. data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -4
  41. data/lib/active_merchant/billing/gateways/bridge_pay.rb +116 -61
  42. data/lib/active_merchant/billing/gateways/cams.rb +230 -0
  43. data/lib/active_merchant/billing/gateways/card_connect.rb +320 -0
  44. data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
  45. data/lib/active_merchant/billing/gateways/card_stream.rb +248 -97
  46. data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
  47. data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
  48. data/lib/active_merchant/billing/gateways/cashnet.rb +70 -26
  49. data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
  50. data/lib/active_merchant/billing/gateways/cecabank.rb +73 -53
  51. data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
  52. data/lib/active_merchant/billing/gateways/checkout.rb +32 -33
  53. data/lib/active_merchant/billing/gateways/checkout_v2.rb +340 -0
  54. data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
  55. data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
  56. data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
  57. data/lib/active_merchant/billing/gateways/conekta.rb +55 -34
  58. data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
  59. data/lib/active_merchant/billing/gateways/credorax.rb +506 -0
  60. data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
  61. data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
  62. data/lib/active_merchant/billing/gateways/cyber_source.rb +637 -221
  63. data/lib/active_merchant/billing/gateways/d_local.rb +303 -0
  64. data/lib/active_merchant/billing/gateways/data_cash.rb +57 -355
  65. data/lib/active_merchant/billing/gateways/decidir.rb +347 -0
  66. data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
  67. data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
  68. data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
  69. data/lib/active_merchant/billing/gateways/ebanx.rb +334 -0
  70. data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
  71. data/lib/active_merchant/billing/gateways/elavon.rb +377 -250
  72. data/lib/active_merchant/billing/gateways/element.rb +386 -0
  73. data/lib/active_merchant/billing/gateways/epay.rb +92 -71
  74. data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
  75. data/lib/active_merchant/billing/gateways/eway.rb +85 -73
  76. data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
  77. data/lib/active_merchant/billing/gateways/eway_rapid.rb +134 -80
  78. data/lib/active_merchant/billing/gateways/exact.rb +37 -36
  79. data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
  80. data/lib/active_merchant/billing/gateways/fat_zebra.rb +124 -74
  81. data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
  82. data/lib/active_merchant/billing/gateways/finansbank.rb +4 -5
  83. data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
  84. data/lib/active_merchant/billing/gateways/first_pay.rb +45 -23
  85. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +184 -87
  86. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
  87. data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
  88. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
  89. data/lib/active_merchant/billing/gateways/forte.rb +286 -0
  90. data/lib/active_merchant/billing/gateways/garanti.rb +31 -32
  91. data/lib/active_merchant/billing/gateways/global_collect.rb +507 -0
  92. data/lib/active_merchant/billing/gateways/global_transport.rb +25 -15
  93. data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
  94. data/lib/active_merchant/billing/gateways/hps.rb +252 -68
  95. data/lib/active_merchant/billing/gateways/iats_payments.rb +99 -38
  96. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
  97. data/lib/active_merchant/billing/gateways/inspire.rb +48 -48
  98. data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
  99. data/lib/active_merchant/billing/gateways/ipg.rb +415 -0
  100. data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
  101. data/lib/active_merchant/billing/gateways/iridium.rb +254 -244
  102. data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
  103. data/lib/active_merchant/billing/gateways/iveri.rb +254 -0
  104. data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
  105. data/lib/active_merchant/billing/gateways/jetpay.rb +200 -80
  106. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
  107. data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
  108. data/lib/active_merchant/billing/gateways/kushki.rb +277 -0
  109. data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
  110. data/lib/active_merchant/billing/gateways/linkpoint.rb +95 -85
  111. data/lib/active_merchant/billing/gateways/litle.rb +371 -94
  112. data/lib/active_merchant/billing/gateways/mastercard.rb +293 -0
  113. data/lib/active_merchant/billing/gateways/maxipago.rb +146 -123
  114. data/lib/active_merchant/billing/gateways/mercado_pago.rb +331 -0
  115. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +47 -23
  116. data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
  117. data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
  118. data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
  119. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +60 -44
  120. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +76 -23
  121. data/lib/active_merchant/billing/gateways/mercury.rb +73 -54
  122. data/lib/active_merchant/billing/gateways/metrics_global.rb +33 -43
  123. data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
  124. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
  125. data/lib/active_merchant/billing/gateways/migs.rb +101 -37
  126. data/lib/active_merchant/billing/gateways/mit.rb +260 -0
  127. data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
  128. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +30 -34
  129. data/lib/active_merchant/billing/gateways/moka.rb +290 -0
  130. data/lib/active_merchant/billing/gateways/monei.rb +422 -0
  131. data/lib/active_merchant/billing/gateways/moneris.rb +236 -72
  132. data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
  133. data/lib/active_merchant/billing/gateways/mundipagg.rb +363 -0
  134. data/lib/active_merchant/billing/gateways/nab_transact.rb +87 -68
  135. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
  136. data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
  137. data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
  138. data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
  139. data/lib/active_merchant/billing/gateways/netbilling.rb +82 -43
  140. data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
  141. data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
  142. data/lib/active_merchant/billing/gateways/nmi.rb +279 -174
  143. data/lib/active_merchant/billing/gateways/ogone.rb +96 -50
  144. data/lib/active_merchant/billing/gateways/omise.rb +323 -0
  145. data/lib/active_merchant/billing/gateways/openpay.rb +58 -23
  146. data/lib/active_merchant/billing/gateways/opp.rb +394 -0
  147. data/lib/active_merchant/billing/gateways/optimal_payment.rb +87 -69
  148. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
  149. data/lib/active_merchant/billing/gateways/orbital.rb +771 -328
  150. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +31 -32
  151. data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
  152. data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
  153. data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
  154. data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
  155. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +84 -68
  156. data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
  157. data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
  158. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
  159. data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
  160. data/lib/active_merchant/billing/gateways/pay_trace.rb +404 -0
  161. data/lib/active_merchant/billing/gateways/paybox_direct.rb +85 -49
  162. data/lib/active_merchant/billing/gateways/payeezy.rb +458 -0
  163. data/lib/active_merchant/billing/gateways/payex.rb +39 -42
  164. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +67 -41
  165. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
  166. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
  167. data/lib/active_merchant/billing/gateways/payflow.rb +215 -46
  168. data/lib/active_merchant/billing/gateways/payflow_express.rb +64 -68
  169. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
  170. data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
  171. data/lib/active_merchant/billing/gateways/payment_express.rb +78 -58
  172. data/lib/active_merchant/billing/gateways/paymentez.rb +353 -0
  173. data/lib/active_merchant/billing/gateways/paymill.rb +163 -75
  174. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -7
  175. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
  176. data/lib/active_merchant/billing/gateways/paypal.rb +37 -18
  177. data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
  178. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +5 -5
  179. data/lib/active_merchant/billing/gateways/paypal_express.rb +12 -6
  180. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
  181. data/lib/active_merchant/billing/gateways/paysafe.rb +412 -0
  182. data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
  183. data/lib/active_merchant/billing/gateways/paystation.rb +96 -91
  184. data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
  185. data/lib/active_merchant/billing/gateways/payu_latam.rb +479 -0
  186. data/lib/active_merchant/billing/gateways/payway.rb +27 -27
  187. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
  188. data/lib/active_merchant/billing/gateways/pin.rb +113 -37
  189. data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
  190. data/lib/active_merchant/billing/gateways/priority.rb +369 -0
  191. data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
  192. data/lib/active_merchant/billing/gateways/psigate.rb +55 -44
  193. data/lib/active_merchant/billing/gateways/psl_card.rb +32 -40
  194. data/lib/active_merchant/billing/gateways/qbms.rb +86 -76
  195. data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
  196. data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
  197. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
  198. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
  199. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
  200. data/lib/active_merchant/billing/gateways/quickpay.rb +10 -353
  201. data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
  202. data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
  203. data/lib/active_merchant/billing/gateways/realex.rb +154 -52
  204. data/lib/active_merchant/billing/gateways/redsys.rb +488 -161
  205. data/lib/active_merchant/billing/gateways/s5.rb +247 -0
  206. data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
  207. data/lib/active_merchant/billing/gateways/sage.rb +404 -133
  208. data/lib/active_merchant/billing/gateways/sage_pay.rb +145 -109
  209. data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
  210. data/lib/active_merchant/billing/gateways/secure_net.rb +62 -54
  211. data/lib/active_merchant/billing/gateways/secure_pay.rb +32 -42
  212. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +36 -27
  213. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
  214. data/lib/active_merchant/billing/gateways/securion_pay.rb +265 -0
  215. data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
  216. data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -54
  217. data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
  218. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
  219. data/lib/active_merchant/billing/gateways/spreedly_core.rb +108 -43
  220. data/lib/active_merchant/billing/gateways/stripe.rb +536 -120
  221. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +516 -0
  222. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +19 -25
  223. data/lib/active_merchant/billing/gateways/telr.rb +273 -0
  224. data/lib/active_merchant/billing/gateways/tns.rb +16 -217
  225. data/lib/active_merchant/billing/gateways/trans_first.rb +148 -34
  226. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
  227. data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
  228. data/lib/active_merchant/billing/gateways/transax.rb +6 -8
  229. data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
  230. data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
  231. data/lib/active_merchant/billing/gateways/trust_commerce.rb +162 -89
  232. data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
  233. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +332 -236
  234. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +185 -72
  235. data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
  236. data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
  237. data/lib/active_merchant/billing/gateways/viaklix.rb +19 -31
  238. data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
  239. data/lib/active_merchant/billing/gateways/vpos.rb +220 -0
  240. data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
  241. data/lib/active_merchant/billing/gateways/wepay.rb +108 -62
  242. data/lib/active_merchant/billing/gateways/wirecard.rb +52 -43
  243. data/lib/active_merchant/billing/gateways/wompi.rb +193 -0
  244. data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
  245. data/lib/active_merchant/billing/gateways/worldpay.rb +725 -121
  246. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
  247. data/lib/active_merchant/billing/gateways/worldpay_us.rb +79 -39
  248. data/lib/active_merchant/billing/gateways.rb +8 -11
  249. data/lib/active_merchant/billing/model.rb +2 -2
  250. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
  251. data/lib/active_merchant/billing/payment_token.rb +1 -1
  252. data/lib/active_merchant/billing/rails.rb +1 -1
  253. data/lib/active_merchant/billing/response.rb +19 -13
  254. data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
  255. data/lib/active_merchant/billing.rb +3 -0
  256. data/lib/active_merchant/connection.rb +196 -0
  257. data/lib/active_merchant/country.rb +13 -8
  258. data/lib/active_merchant/errors.rb +6 -0
  259. data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
  260. data/lib/active_merchant/network_connection_retries.rb +78 -0
  261. data/lib/active_merchant/post_data.rb +26 -0
  262. data/lib/active_merchant/posts_data.rb +92 -0
  263. data/lib/active_merchant/version.rb +1 -1
  264. data/lib/active_merchant.rb +14 -59
  265. data/lib/activemerchant.rb +1 -1
  266. data/lib/certs/cacert.pem +3214 -0
  267. data/lib/support/gateway_support.rb +8 -10
  268. data/lib/support/outbound_hosts.rb +13 -10
  269. data/lib/support/ssl_verify.rb +9 -14
  270. data/lib/support/ssl_version.rb +86 -0
  271. metadata +136 -94
  272. checksums.yaml.gz.sig +0 -1
  273. data/lib/active_merchant/billing/gateways/app55.rb +0 -176
  274. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
  275. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
  276. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
  277. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
  278. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
  279. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
  280. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -291
  281. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -87
  282. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
  283. data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
  284. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
  285. data/lib/active_merchant/billing/gateways/vindicia.rb +0 -385
  286. data/lib/active_merchant/offsite_payments_shim.rb +0 -19
  287. data.tar.gz.sig +0 -0
  288. metadata.gz.sig +0 -0
@@ -6,22 +6,25 @@ module ActiveMerchant #:nodoc:
6
6
  self.live_na_url = 'https://www.iatspayments.com/NetGate'
7
7
  self.live_uk_url = 'https://www.uk.iatspayments.com/NetGate'
8
8
 
9
- self.supported_countries = %w(AU BR CA CH DE DK ES FI FR GR HK IE IT NL NO PT SE SG TR GB US)
9
+ self.supported_countries = %w(AU BR CA CH DE DK ES FI FR GR HK IE IT NL NO PT SE SG TR GB US TH ID PH BE)
10
10
  self.default_currency = 'USD'
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
11
+ self.supported_cardtypes = %i[visa master american_express discover]
12
12
 
13
13
  self.homepage_url = 'http://home.iatspayments.com/'
14
14
  self.display_name = 'iATS Payments'
15
15
 
16
16
  ACTIONS = {
17
- purchase: "ProcessCreditCardV1",
18
- refund: "ProcessCreditCardRefundWithTransactionIdV1",
19
- store: "CreateCreditCardCustomerCodeV1",
20
- unstore: "DeleteCustomerCodeV1"
17
+ purchase: 'ProcessCreditCard',
18
+ purchase_check: 'ProcessACHEFT',
19
+ purchase_customer_code: 'ProcessCreditCardWithCustomerCode',
20
+ refund: 'ProcessCreditCardRefundWithTransactionId',
21
+ refund_check: 'ProcessACHEFTRefundWithTransactionId',
22
+ store: 'CreateCreditCardCustomerCode',
23
+ unstore: 'DeleteCustomerCode'
21
24
  }
22
25
 
23
- def initialize(options={})
24
- if(options[:login])
26
+ def initialize(options = {})
27
+ if options[:login]
25
28
  ActiveMerchant.deprecated("The 'login' option is deprecated in favor of 'agent_code' and will be removed in a future version.")
26
29
  options[:agent_code] = options[:login]
27
30
  end
@@ -32,25 +35,27 @@ module ActiveMerchant #:nodoc:
32
35
  super
33
36
  end
34
37
 
35
- def purchase(money, payment, options={})
38
+ def purchase(money, payment, options = {})
36
39
  post = {}
37
40
  add_invoice(post, money, options)
38
41
  add_payment(post, payment)
39
42
  add_address(post, options)
40
43
  add_ip(post, options)
41
44
  add_description(post, options)
45
+ add_customer_details(post, options)
42
46
 
43
- commit(:purchase, post)
47
+ commit(determine_purchase_type(payment), post)
44
48
  end
45
49
 
46
- def refund(money, authorization, options={})
50
+ def refund(money, authorization, options = {})
47
51
  post = {}
48
- post[:transaction_id] = authorization
52
+ transaction_id, payment_type = split_authorization(authorization)
53
+ post[:transaction_id] = transaction_id
49
54
  add_invoice(post, -money, options)
50
55
  add_ip(post, options)
51
56
  add_description(post, options)
52
57
 
53
- commit(:refund, post)
58
+ commit((payment_type == 'check' ? :refund_check : :refund), post)
54
59
  end
55
60
 
56
61
  def store(credit_card, options = {})
@@ -72,19 +77,45 @@ module ActiveMerchant #:nodoc:
72
77
  commit(:unstore, post)
73
78
  end
74
79
 
80
+ def supports_scrubbing?
81
+ true
82
+ end
83
+
84
+ def scrub(transcript)
85
+ transcript.
86
+ gsub(%r((<agentCode>).+(</agentCode>)), '\1[FILTERED]\2').
87
+ gsub(%r((<password>).+(</password>)), '\1[FILTERED]\2').
88
+ gsub(%r((<creditCardNum>).+(</creditCardNum>)), '\1[FILTERED]\2').
89
+ gsub(%r((<cvv2>).+(</cvv2>)), '\1[FILTERED]\2').
90
+ gsub(%r((<accountNum>).+(</accountNum>)), '\1[FILTERED]\2')
91
+ end
92
+
75
93
  private
76
94
 
95
+ def determine_purchase_type(payment)
96
+ if payment.is_a?(String)
97
+ :purchase_customer_code
98
+ elsif payment.is_a?(Check)
99
+ :purchase_check
100
+ else
101
+ :purchase
102
+ end
103
+ end
104
+
77
105
  def add_ip(post, options)
78
106
  post[:customer_ip_address] = options[:ip] if options.has_key?(:ip)
79
107
  end
80
108
 
81
109
  def add_address(post, options)
82
110
  billing_address = options[:billing_address] || options[:address]
83
- if(billing_address)
111
+ if billing_address
84
112
  post[:address] = billing_address[:address1]
85
113
  post[:city] = billing_address[:city]
86
114
  post[:state] = billing_address[:state]
87
115
  post[:zip_code] = billing_address[:zip]
116
+ post[:phone] = billing_address[:phone] if billing_address[:phone]
117
+ post[:email] = billing_address[:email] if billing_address[:email]
118
+ post[:country] = billing_address[:country] if billing_address[:country]
88
119
  end
89
120
  end
90
121
 
@@ -98,6 +129,16 @@ module ActiveMerchant #:nodoc:
98
129
  end
99
130
 
100
131
  def add_payment(post, payment)
132
+ if payment.is_a?(String)
133
+ post[:customer_code] = payment
134
+ elsif payment.is_a?(Check)
135
+ add_check(post, payment)
136
+ else
137
+ add_credit_card(post, payment)
138
+ end
139
+ end
140
+
141
+ def add_credit_card(post, payment)
101
142
  post[:first_name] = payment.first_name
102
143
  post[:last_name] = payment.last_name
103
144
  post[:credit_card_num] = payment.number
@@ -106,6 +147,13 @@ module ActiveMerchant #:nodoc:
106
147
  post[:mop] = creditcard_brand(payment.brand)
107
148
  end
108
149
 
150
+ def add_check(post, payment)
151
+ post[:first_name] = payment.first_name
152
+ post[:last_name] = payment.last_name
153
+ post[:account_num] = "#{payment.routing_number}#{payment.account_number}"
154
+ post[:account_type] = payment.account_type.upcase
155
+ end
156
+
109
157
  def add_store_defaults(post)
110
158
  post[:recurring] = false
111
159
  post[:begin_date] = Time.now.xmlschema
@@ -113,20 +161,24 @@ module ActiveMerchant #:nodoc:
113
161
  post[:amount] = 0
114
162
  end
115
163
 
164
+ def add_customer_details(post, options)
165
+ post[:email] = options[:email] if options[:email]
166
+ end
167
+
116
168
  def expdate(creditcard)
117
- year = sprintf("%.4i", creditcard.year)
118
- month = sprintf("%.2i", creditcard.month)
169
+ year = sprintf('%.4i', creditcard.year)
170
+ month = sprintf('%.2i', creditcard.month)
119
171
 
120
172
  "#{month}/#{year[-2..-1]}"
121
173
  end
122
174
 
123
175
  def creditcard_brand(brand)
124
176
  case brand
125
- when "visa" then "VISA"
126
- when "master" then "MC"
127
- when "discover" then "DSC"
128
- when "american_express" then "AMX"
129
- when "maestro" then "MAESTR"
177
+ when 'visa' then 'VISA'
178
+ when 'master' then 'MC'
179
+ when 'discover' then 'DSC'
180
+ when 'american_express' then 'AMX'
181
+ when 'maestro' then 'MAESTR'
130
182
  else
131
183
  raise "Unhandled credit card brand #{brand}"
132
184
  end
@@ -134,7 +186,7 @@ module ActiveMerchant #:nodoc:
134
186
 
135
187
  def commit(action, parameters)
136
188
  response = parse(ssl_post(url(action), post_data(action, parameters),
137
- { 'Content-Type' => 'application/soap+xml; charset=utf-8'}))
189
+ { 'Content-Type' => 'application/soap+xml; charset=utf-8' }))
138
190
 
139
191
  Response.new(
140
192
  success_from(response),
@@ -147,10 +199,13 @@ module ActiveMerchant #:nodoc:
147
199
 
148
200
  def endpoints
149
201
  {
150
- purchase: "ProcessLink.asmx",
151
- refund: "ProcessLink.asmx",
152
- store: "CustomerLink.asmx",
153
- unstore: "CustomerLink.asmx"
202
+ purchase: 'ProcessLinkv3.asmx',
203
+ purchase_check: 'ProcessLinkv3.asmx',
204
+ purchase_customer_code: 'ProcessLinkv3.asmx',
205
+ refund: 'ProcessLinkv3.asmx',
206
+ refund_check: 'ProcessLinkv3.asmx',
207
+ store: 'CustomerLinkv3.asmx',
208
+ unstore: 'CustomerLinkv3.asmx'
154
209
  }
155
210
  end
156
211
 
@@ -178,13 +233,13 @@ module ActiveMerchant #:nodoc:
178
233
  def hashify_xml!(xml, response)
179
234
  xml = REXML::Document.new(xml)
180
235
 
181
- xml.elements.each("//IATSRESPONSE/*") do |node|
236
+ xml.elements.each('//IATSRESPONSE/*') do |node|
182
237
  recursively_parse_element(node, response)
183
238
  end
184
239
  end
185
240
 
186
241
  def recursively_parse_element(node, response)
187
- if(node.has_elements?)
242
+ if node.has_elements?
188
243
  node.elements.each { |n| recursively_parse_element(n, response) }
189
244
  else
190
245
  response[dexmlize_param_name(node.name)] = (node.text ? node.text.strip : nil)
@@ -192,17 +247,17 @@ module ActiveMerchant #:nodoc:
192
247
  end
193
248
 
194
249
  def successful_result_message?(response)
195
- response[:authorization_result].start_with?('OK')
250
+ response[:authorization_result] ? response[:authorization_result].start_with?('OK') : false
196
251
  end
197
252
 
198
253
  def success_from(response)
199
- response[:status] == "Success" && successful_result_message?(response)
254
+ response[:status] == 'Success' && successful_result_message?(response)
200
255
  end
201
256
 
202
257
  def message_from(response)
203
- if(!successful_result_message?(response))
258
+ if !successful_result_message?(response) && response[:authorization_result]
204
259
  return response[:authorization_result].strip
205
- elsif(response[:status] == 'Failure')
260
+ elsif response[:status] == 'Failure'
206
261
  return response[:errors]
207
262
  else
208
263
  response[:status]
@@ -210,27 +265,33 @@ module ActiveMerchant #:nodoc:
210
265
  end
211
266
 
212
267
  def authorization_from(action, response)
213
- if [:store, :unstore].include?(action)
268
+ if %i[store unstore].include?(action)
214
269
  response[:customercode]
270
+ elsif [:purchase_check].include?(action)
271
+ response[:transaction_id] ? "#{response[:transaction_id]}|check" : nil
215
272
  else
216
273
  response[:transaction_id]
217
274
  end
218
275
  end
219
276
 
277
+ def split_authorization(authorization)
278
+ authorization.split('|')
279
+ end
280
+
220
281
  def envelope_namespaces
221
282
  {
222
- "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
223
- "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema",
224
- "xmlns:soap12" => "http://www.w3.org/2003/05/soap-envelope"
283
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
284
+ 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
285
+ 'xmlns:soap12' => 'http://www.w3.org/2003/05/soap-envelope'
225
286
  }
226
287
  end
227
288
 
228
289
  def post_data(action, parameters = {})
229
290
  xml = Builder::XmlMarkup.new
230
- xml.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')
291
+ xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
231
292
  xml.tag! 'soap12:Envelope', envelope_namespaces do
232
293
  xml.tag! 'soap12:Body' do
233
- xml.tag! ACTIONS[action], { "xmlns" => "https://www.iatspayments.com/NetGate/" } do
294
+ xml.tag! ACTIONS[action], { 'xmlns' => 'https://www.iatspayments.com/NetGate/' } do
234
295
  xml.tag!('agentCode', @options[:agent_code])
235
296
  xml.tag!('password', @options[:password])
236
297
  parameters.each do |name, value|
@@ -0,0 +1,15 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class InContextPaypalExpressGateway < PaypalExpressGateway
4
+ self.test_redirect_url = 'https://www.sandbox.paypal.com/checkoutnow'
5
+ self.live_redirect_url = 'https://www.paypal.com/checkoutnow'
6
+
7
+ def redirect_url_for(token, options = {})
8
+ options = { review: true }.update(options)
9
+ url = "#{redirect_url}?token=#{token}"
10
+ url += '&useraction=commit' unless options[:review]
11
+ url
12
+ end
13
+ end
14
+ end
15
+ end
@@ -5,7 +5,7 @@ module ActiveMerchant #:nodoc:
5
5
  self.live_url = self.test_url = 'https://secure.inspiregateway.net/api/transact.php'
6
6
 
7
7
  self.supported_countries = ['US']
8
- self.supported_cardtypes = [:visa, :master, :american_express]
8
+ self.supported_cardtypes = %i[visa master american_express]
9
9
  self.homepage_url = 'http://www.inspiregateway.com'
10
10
  self.display_name = 'Inspire Commerce'
11
11
 
@@ -17,7 +17,7 @@ module ActiveMerchant #:nodoc:
17
17
  # ==== Options
18
18
  #
19
19
  # * <tt>:login</tt> -- The Inspire Username.
20
- # * <tt>:password</tt> -- The Inspire Passowrd.
20
+ # * <tt>:password</tt> -- The Inspire Password.
21
21
  # See the Inspire Integration Guide for details. (default: +false+)
22
22
  def initialize(options = {})
23
23
  requires!(options, :login, :password)
@@ -33,7 +33,7 @@ module ActiveMerchant #:nodoc:
33
33
  def authorize(money, creditcard, options = {})
34
34
  post = {}
35
35
  add_invoice(post, options)
36
- add_payment_source(post, creditcard,options)
36
+ add_payment_source(post, creditcard, options)
37
37
  add_address(post, creditcard, options)
38
38
  add_customer_data(post, options)
39
39
 
@@ -51,23 +51,29 @@ module ActiveMerchant #:nodoc:
51
51
  end
52
52
 
53
53
  def capture(money, authorization, options = {})
54
- post ={}
54
+ post = {}
55
55
  post[:transactionid] = authorization
56
56
  commit('capture', money, post)
57
57
  end
58
58
 
59
59
  def void(authorization, options = {})
60
- post ={}
60
+ post = {}
61
61
  post[:transactionid] = authorization
62
62
  commit('void', nil, post)
63
63
  end
64
64
 
65
+ def refund(money, authorization, options = {})
66
+ post = {}
67
+ post[:transactionid] = authorization
68
+ commit('refund', money, post)
69
+ end
70
+
65
71
  # Update the values (such as CC expiration) stored at
66
72
  # InspireGateway. The CC number must be supplied in the
67
73
  # CreditCard object.
68
74
  def update(vault_id, creditcard, options = {})
69
75
  post = {}
70
- post[:customer_vault] = "update_customer"
76
+ post[:customer_vault] = 'update_customer'
71
77
  add_customer_vault_id(post, vault_id)
72
78
  add_creditcard(post, creditcard, options)
73
79
  add_address(post, creditcard, options)
@@ -78,7 +84,7 @@ module ActiveMerchant #:nodoc:
78
84
 
79
85
  def delete(vault_id)
80
86
  post = {}
81
- post[:customer_vault] = "delete_customer"
87
+ post[:customer_vault] = 'delete_customer'
82
88
  add_customer_vault_id(post, vault_id)
83
89
  commit(nil, nil, post)
84
90
  end
@@ -87,32 +93,29 @@ module ActiveMerchant #:nodoc:
87
93
  # store and unstore need to be defined
88
94
  def store(creditcard, options = {})
89
95
  billing_id = options.delete(:billing_id).to_s || true
90
- authorize(100, creditcard, options.merge(:store => billing_id))
96
+ authorize(100, creditcard, options.merge(store: billing_id))
91
97
  end
92
98
 
93
- alias_method :unstore, :delete
99
+ alias unstore delete
94
100
 
95
101
  private
102
+
96
103
  def add_customer_data(post, options)
97
- if options.has_key? :email
98
- post[:email] = options[:email]
99
- end
104
+ post[:email] = options[:email] if options.has_key? :email
100
105
 
101
- if options.has_key? :ip
102
- post[:ipaddress] = options[:ip]
103
- end
106
+ post[:ipaddress] = options[:ip] if options.has_key? :ip
104
107
  end
105
108
 
106
109
  def add_address(post, creditcard, options)
107
110
  if address = options[:billing_address] || options[:address]
108
111
  post[:address1] = address[:address1].to_s
109
112
  post[:address2] = address[:address2].to_s unless address[:address2].blank?
110
- post[:company] = address[:company].to_s
111
- post[:phone] = address[:phone].to_s
112
- post[:zip] = address[:zip].to_s
113
- post[:city] = address[:city].to_s
114
- post[:country] = address[:country].to_s
115
- post[:state] = address[:state].blank? ? 'n/a' : address[:state]
113
+ post[:company] = address[:company].to_s
114
+ post[:phone] = address[:phone].to_s
115
+ post[:zip] = address[:zip].to_s
116
+ post[:city] = address[:city].to_s
117
+ post[:country] = address[:country].to_s
118
+ post[:state] = address[:state].blank? ? 'n/a' : address[:state]
116
119
  end
117
120
  end
118
121
 
@@ -121,7 +124,7 @@ module ActiveMerchant #:nodoc:
121
124
  post[:orderdescription] = options[:description]
122
125
  end
123
126
 
124
- def add_payment_source(params, source, options={})
127
+ def add_payment_source(params, source, options = {})
125
128
  case determine_funding_source(source)
126
129
  when :vault then add_customer_vault_id(params, source)
127
130
  when :credit_card then add_creditcard(params, source, options)
@@ -129,18 +132,18 @@ module ActiveMerchant #:nodoc:
129
132
  end
130
133
  end
131
134
 
132
- def add_customer_vault_id(params,vault_id)
135
+ def add_customer_vault_id(params, vault_id)
133
136
  params[:customer_vault_id] = vault_id
134
137
  end
135
138
 
136
- def add_creditcard(post, creditcard,options)
139
+ def add_creditcard(post, creditcard, options)
137
140
  if options[:store]
138
- post[:customer_vault] = "add_customer"
141
+ post[:customer_vault] = 'add_customer'
139
142
  post[:customer_vault_id] = options[:store] unless options[:store] == true
140
143
  end
141
- post[:ccnumber] = creditcard.number
144
+ post[:ccnumber] = creditcard.number
142
145
  post[:cvv] = creditcard.verification_value if creditcard.verification_value?
143
- post[:ccexp] = expdate(creditcard)
146
+ post[:ccexp] = expdate(creditcard)
144
147
  post[:firstname] = creditcard.first_name
145
148
  post[:lastname] = creditcard.last_name
146
149
  end
@@ -157,7 +160,7 @@ module ActiveMerchant #:nodoc:
157
160
  def parse(body)
158
161
  results = {}
159
162
  body.split(/&/).each do |pair|
160
- key,val = pair.split(/=/)
163
+ key, val = pair.split(%r{=})
161
164
  results[key] = val
162
165
  end
163
166
 
@@ -165,49 +168,46 @@ module ActiveMerchant #:nodoc:
165
168
  end
166
169
 
167
170
  def commit(action, money, parameters)
168
- parameters[:amount] = amount(money) if money
171
+ parameters[:amount] = amount(money) if money
169
172
 
170
- response = parse( ssl_post(self.live_url, post_data(action,parameters)) )
171
-
172
- Response.new(response["response"] == "1", message_from(response), response,
173
- :authorization => response["transactionid"],
174
- :test => test?,
175
- :cvv_result => response["cvvresponse"],
176
- :avs_result => { :code => response["avsresponse"] }
177
- )
173
+ response = parse(ssl_post(self.live_url, post_data(action, parameters)))
178
174
 
175
+ Response.new(response['response'] == '1', message_from(response), response,
176
+ authorization: response['transactionid'],
177
+ test: test?,
178
+ cvv_result: response['cvvresponse'],
179
+ avs_result: { code: response['avsresponse'] })
179
180
  end
180
181
 
181
182
  def message_from(response)
182
- case response["responsetext"]
183
- when "SUCCESS","Approved"
184
- "This transaction has been approved"
185
- when "DECLINE"
186
- "This transaction has been declined"
183
+ case response['responsetext']
184
+ when 'SUCCESS', 'Approved'
185
+ 'This transaction has been approved'
186
+ when 'DECLINE'
187
+ 'This transaction has been declined'
187
188
  else
188
- response["responsetext"]
189
+ response['responsetext']
189
190
  end
190
191
  end
191
192
 
192
193
  def post_data(action, parameters = {})
193
194
  post = {}
194
- post[:username] = @options[:login]
195
+ post[:username] = @options[:login]
195
196
  post[:password] = @options[:password]
196
197
  post[:type] = action if action
197
198
 
198
- request = post.merge(parameters).map {|key,value| "#{key}=#{CGI.escape(value.to_s)}"}.join("&")
199
+ request = post.merge(parameters).map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
199
200
  request
200
201
  end
201
202
 
202
203
  def determine_funding_source(source)
203
204
  case
204
205
  when source.is_a?(String) then :vault
205
- when CreditCard.card_companies.keys.include?(card_brand(source)) then :credit_card
206
+ when CreditCard.card_companies.include?(card_brand(source)) then :credit_card
206
207
  when card_brand(source) == 'check' then :check
207
- else raise ArgumentError, "Unsupported funding source provided"
208
+ else raise ArgumentError, 'Unsupported funding source provided'
208
209
  end
209
210
  end
210
211
  end
211
212
  end
212
213
  end
213
-
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
  self.money_format = :dollars
9
9
  self.default_currency = 'USD'
10
10
  # The card types supported by the payment gateway
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
11
+ self.supported_cardtypes = %i[visa master american_express discover]
12
12
 
13
13
  # The homepage URL of the gateway
14
14
  self.homepage_url = 'http://www.instapayllc.com'
@@ -16,8 +16,8 @@ module ActiveMerchant #:nodoc:
16
16
  # The name of the gateway
17
17
  self.display_name = 'InstaPay'
18
18
 
19
- SUCCESS = "Accepted"
20
- SUCCESS_MESSAGE = "The transaction has been approved"
19
+ SUCCESS = 'Accepted'
20
+ SUCCESS_MESSAGE = 'The transaction has been approved'
21
21
 
22
22
  def initialize(options = {})
23
23
  requires!(options, :login)
@@ -66,7 +66,7 @@ module ActiveMerchant #:nodoc:
66
66
 
67
67
  def add_customer_data(post, options)
68
68
  post[:ci_email] = options[:email]
69
- post["ci_IP Address"] = options[:ip]
69
+ post['ci_IP Address'] = options[:ip]
70
70
  end
71
71
 
72
72
  def add_address(post, options)
@@ -140,24 +140,20 @@ module ActiveMerchant #:nodoc:
140
140
  data = ssl_post self.live_url, post_data(action, parameters)
141
141
  response = parse(data)
142
142
 
143
- Response.new(response[:success] , response[:message], response,
144
- :authorization => response[:transaction_id],
145
- :avs_result => { :code => response[:avs_result] },
146
- :cvv_result => response[:cvv_result]
147
- )
143
+ Response.new(response[:success], response[:message], response,
144
+ authorization: response[:transaction_id],
145
+ avs_result: { code: response[:avs_result] },
146
+ cvv_result: response[:cvv_result])
148
147
  end
149
148
 
150
149
  def post_data(action, parameters = {})
151
150
  post = {}
152
151
  post[:acctid] = @options[:login]
153
- if(@options[:password])
154
- post[:merchantpin] = @options[:password]
155
- end
152
+ post[:merchantpin] = @options[:password] if @options[:password]
156
153
  post[:action] = action
157
- request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
154
+ request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
158
155
  request
159
156
  end
160
157
  end
161
158
  end
162
159
  end
163
-