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
@@ -1,5 +1,5 @@
1
- require File.dirname(__FILE__) + '/smart_ps.rb'
2
- require File.dirname(__FILE__) + '/braintree/braintree_common'
1
+ require 'active_merchant/billing/gateways/smart_ps.rb'
2
+ require 'active_merchant/billing/gateways/braintree/braintree_common'
3
3
 
4
4
  module ActiveMerchant #:nodoc:
5
5
  module Billing #:nodoc:
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
7
7
  include BraintreeCommon
8
8
 
9
9
  self.display_name = 'Braintree (Orange Platform)'
10
- self.supported_countries = ["US"]
10
+ self.supported_countries = ['US']
11
11
 
12
12
  self.live_url = self.test_url = 'https://secure.braintreepaymentgateway.com/api/transact.php'
13
13
 
@@ -17,4 +17,3 @@ module ActiveMerchant #:nodoc:
17
17
  end
18
18
  end
19
19
  end
20
-
@@ -1,48 +1,47 @@
1
- require "nokogiri"
1
+ require 'nokogiri'
2
2
 
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class BridgePayGateway < Gateway
6
- self.display_name = "BridgePay"
7
- self.homepage_url = "http://www.bridgepaynetwork.com/"
6
+ self.display_name = 'BridgePay'
7
+ self.homepage_url = 'http://www.bridgepaynetwork.com/'
8
8
 
9
- self.test_url = "https://gatewaystage.itstgate.com/SmartPayments/transact.asmx/ProcessCreditCard"
10
- self.live_url = "https://gateway.itstgate.com/SmartPayments/transact.asmx/ProcessCreditCard"
9
+ self.test_url = 'https://gatewaystage.itstgate.com/SmartPayments/transact3.asmx'
10
+ self.live_url = 'https://gateway.itstgate.com/SmartPayments/transact3.asmx'
11
11
 
12
- self.supported_countries = ["CA", "US"]
13
- self.default_currency = "USD"
14
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
12
+ self.supported_countries = %w[CA US]
13
+ self.default_currency = 'USD'
14
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
15
15
 
16
-
17
- def initialize(options={})
16
+ def initialize(options = {})
18
17
  requires!(options, :user_name, :password)
19
18
  super
20
19
  end
21
20
 
22
- def purchase(amount, creditcard, options={})
23
- post = post_required_fields("Sale")
21
+ def purchase(amount, payment_method, options = {})
22
+ post = initialize_required_fields('Sale')
24
23
 
25
24
  # Allow the same amount in multiple transactions.
26
- post[:ExtData] = "<Force>T</Force>"
25
+ post[:ExtData] = '<Force>T</Force>'
27
26
  add_invoice(post, amount, options)
28
- add_creditcard(post, creditcard)
27
+ add_payment_method(post, payment_method)
29
28
  add_customer_data(post, options)
30
29
 
31
30
  commit(post)
32
31
  end
33
32
 
34
- def authorize(amount, creditcard, options={})
35
- post = post_required_fields("Auth")
33
+ def authorize(amount, payment_method, options = {})
34
+ post = initialize_required_fields('Auth')
36
35
 
37
36
  add_invoice(post, amount, options)
38
- add_creditcard(post, creditcard)
37
+ add_payment_method(post, payment_method)
39
38
  add_customer_data(post, options)
40
39
 
41
40
  commit(post)
42
41
  end
43
42
 
44
- def capture(amount, authorization, options={})
45
- post = post_required_fields("Force")
43
+ def capture(amount, authorization, options = {})
44
+ post = initialize_required_fields('Force')
46
45
 
47
46
  add_invoice(post, amount, options)
48
47
  add_reference(post, authorization)
@@ -51,8 +50,8 @@ module ActiveMerchant #:nodoc:
51
50
  commit(post)
52
51
  end
53
52
 
54
- def refund(amount, authorization, options={})
55
- post = post_required_fields("Return")
53
+ def refund(amount, authorization, options = {})
54
+ post = initialize_required_fields('Return')
56
55
 
57
56
  add_invoice(post, amount, options)
58
57
  add_reference(post, authorization)
@@ -60,8 +59,8 @@ module ActiveMerchant #:nodoc:
60
59
  commit(post)
61
60
  end
62
61
 
63
- def void(authorization, options={})
64
- post = post_required_fields("Void")
62
+ def void(authorization, options = {})
63
+ post = initialize_required_fields('Void')
65
64
 
66
65
  add_reference(post, authorization)
67
66
 
@@ -75,28 +74,80 @@ module ActiveMerchant #:nodoc:
75
74
  end
76
75
  end
77
76
 
77
+ def store(creditcard, options = {})
78
+ post = initialize_required_fields('')
79
+ post[:transaction] = 'Create'
80
+ post[:CardNumber] = creditcard.number
81
+ post[:CustomerPaymentInfoKey] = ''
82
+ post[:token] = ''
83
+ add_payment_method(post, creditcard)
84
+
85
+ commit(post)
86
+ end
87
+
88
+ def supports_scrubbing?
89
+ true
90
+ end
91
+
92
+ def scrub(transcript)
93
+ transcript.
94
+ gsub(%r((&?CardNum=)[^&]*)i, '\1[FILTERED]').
95
+ gsub(%r((&?CVNum=)[^&]*)i, '\1[FILTERED]').
96
+ gsub(%r((&?Password=)[^&]*)i, '\1[FILTERED]').
97
+ gsub(%r((&?TransitNum=)[^&]*)i, '\1[FILTERED]').
98
+ gsub(%r((&?AccountNum=)[^&]*)i, '\1[FILTERED]')
99
+ end
100
+
78
101
  private
79
102
 
80
- def post_required_fields(transaction_type)
103
+ def add_payment_method(post, payment_method)
104
+ if payment_method.respond_to? :brand
105
+ post[:NameOnCard] = payment_method.name if payment_method.name
106
+ post[:ExpDate] = expdate(payment_method)
107
+ post[:CardNum] = payment_method.number
108
+ post[:CVNum] = payment_method.verification_value
109
+ elsif payment_method.is_a?(String)
110
+ add_token(post, payment_method)
111
+ else
112
+ post[:CheckNum] = payment_method.number
113
+ post[:TransitNum] = payment_method.routing_number
114
+ post[:AccountNum] = payment_method.account_number
115
+ post[:NameOnCheck] = payment_method.name
116
+ post[:ExtData] = "<AccountType>#{payment_method.account_type.capitalize}</AccountType>" if payment_method.account_type
117
+ end
118
+ end
119
+
120
+ def add_token(post, payment_method)
121
+ payment_method = payment_method.split('|')
122
+ post[:ExtData] = "<Force>T</Force><CardVault><Transaction>Read</Transaction><CustomerPaymentInfoKey>#{payment_method[1]}</CustomerPaymentInfoKey><Token>#{payment_method[0]}</Token><ExpDate>#{payment_method[2]}</ExpDate></CardVault>"
123
+ end
124
+
125
+ def initialize_required_fields(transaction_type)
81
126
  post = {}
82
127
  post[:TransType] = transaction_type
83
- post[:Amount] = ""
84
- post[:PNRef] = ""
85
- post[:InvNum] = ""
86
- post[:CardNum] = ""
87
- post[:ExpDate] = ""
88
- post[:MagData] = ""
89
- post[:NameOnCard] = ""
90
- post[:Zip] = ""
91
- post[:Street] = ""
92
- post[:CVNum] = ""
93
- post[:MagData] = ""
94
- post[:ExtData] = ""
128
+ post[:Amount] = ''
129
+ post[:PNRef] = ''
130
+ post[:InvNum] = ''
131
+ post[:CardNum] = ''
132
+ post[:ExpDate] = ''
133
+ post[:MagData] = ''
134
+ post[:NameOnCard] = ''
135
+ post[:Zip] = ''
136
+ post[:Street] = ''
137
+ post[:CVNum] = ''
138
+ post[:MagData] = ''
139
+ post[:ExtData] = ''
140
+ post[:MICR] = ''
141
+ post[:DL] = ''
142
+ post[:SS] = ''
143
+ post[:DOB] = ''
144
+ post[:StateCode] = ''
145
+ post[:CheckType] = ''
95
146
  post
96
147
  end
97
148
 
98
149
  def add_customer_data(post, options)
99
- if(billing_address = (options[:billing_address] || options[:address]))
150
+ if (billing_address = (options[:billing_address] || options[:address]))
100
151
  post[:Street] = billing_address[:address1]
101
152
  post[:Zip] = billing_address[:zip]
102
153
  end
@@ -107,13 +158,6 @@ module ActiveMerchant #:nodoc:
107
158
  post[:InvNum] = options[:order_id]
108
159
  end
109
160
 
110
- def add_creditcard(post, creditcard)
111
- post[:NameOnCard] = creditcard.name if creditcard.name
112
- post[:ExpDate] = expdate(creditcard)
113
- post[:CardNum] = creditcard.number
114
- post[:CVNum] = creditcard.verification_value
115
- end
116
-
117
161
  def expdate(creditcard)
118
162
  "#{format(creditcard.month, :two_digits)}#{format(creditcard.year, :two_digits)}"
119
163
  end
@@ -122,8 +166,8 @@ module ActiveMerchant #:nodoc:
122
166
  response = {}
123
167
 
124
168
  doc = Nokogiri::XML(xml)
125
- doc.root.xpath("*").each do |node|
126
- if (node.elements.size == 0)
169
+ doc.root&.xpath('*')&.each do |node|
170
+ if node.elements.size == 0
127
171
  response[node.name.downcase.to_sym] = node.text
128
172
  else
129
173
  node.elements.each do |childnode|
@@ -131,18 +175,17 @@ module ActiveMerchant #:nodoc:
131
175
  response[name.to_sym] = childnode.text
132
176
  end
133
177
  end
134
- end unless doc.root.nil?
178
+ end
135
179
 
136
180
  response
137
181
  end
138
182
 
139
183
  def commit(parameters)
140
- url = (test? ? test_url : live_url)
141
184
  data = post_data(parameters)
142
- raw = parse(ssl_post(url, data))
185
+ raw = parse(ssl_post(url(parameters), data))
143
186
 
144
187
  Response.new(
145
- success_from(raw[:respmsg]),
188
+ success_from(raw),
146
189
  message_from(raw),
147
190
  raw,
148
191
  authorization: authorization_from(raw),
@@ -150,25 +193,37 @@ module ActiveMerchant #:nodoc:
150
193
  )
151
194
  end
152
195
 
153
- def success_from(result)
154
- case result
155
- when "Approved"
156
- true
196
+ def url(params)
197
+ if params[:transaction]
198
+ "#{base_url}/ManageCardVault"
157
199
  else
158
- false
200
+ action = params[:TransitNum] ? 'ProcessCheck' : 'ProcessCreditCard'
201
+ "#{base_url}/#{action}"
159
202
  end
160
203
  end
161
204
 
205
+ def base_url
206
+ test? ? test_url : live_url
207
+ end
208
+
209
+ def success_from(response)
210
+ response[:result] == '0'
211
+ end
212
+
162
213
  def message_from(response)
163
- response[:respmsg]
214
+ response[:respmsg] || response[:message]
164
215
  end
165
216
 
166
217
  def authorization_from(response)
167
- [response[:authcode], response[:pnref]].join("|")
218
+ if response[:token]
219
+ [response[:token], response[:customerpaymentinfokey], response[:expdate]].join('|')
220
+ else
221
+ [response[:authcode], response[:pnref]].join('|')
222
+ end
168
223
  end
169
224
 
170
225
  def split_authorization(authorization)
171
- authcode, pnref = authorization.split("|")
226
+ authcode, pnref = authorization.split('|')
172
227
  [authcode, pnref]
173
228
  end
174
229
 
@@ -180,9 +235,9 @@ module ActiveMerchant #:nodoc:
180
235
 
181
236
  def post_data(post)
182
237
  {
183
- :UserName => @options[:user_name],
184
- :Password => @options[:password]
185
- }.merge(post).collect{|k,v| "#{k}=#{CGI.escape(v.to_s)}"}.join("&")
238
+ UserName: @options[:user_name],
239
+ Password: @options[:password]
240
+ }.merge(post).collect { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
186
241
  end
187
242
  end
188
243
  end
@@ -0,0 +1,230 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class CamsGateway < Gateway
4
+ self.live_url = 'https://secure.centralams.com/gw/api/transact.php'
5
+
6
+ self.supported_countries = ['US']
7
+ self.default_currency = 'USD'
8
+ self.supported_cardtypes = %i[visa master american_express discover]
9
+
10
+ self.homepage_url = 'https://www.centralams.com/'
11
+ self.display_name = 'CAMS: Central Account Management System'
12
+
13
+ STANDARD_ERROR_CODE_MAPPING = {
14
+ '200' => STANDARD_ERROR_CODE[:card_declined],
15
+ '201' => STANDARD_ERROR_CODE[:card_declined],
16
+ '202' => STANDARD_ERROR_CODE[:card_declined],
17
+ '203' => STANDARD_ERROR_CODE[:card_declined],
18
+ '204' => STANDARD_ERROR_CODE[:card_declined],
19
+ '220' => STANDARD_ERROR_CODE[:card_declined],
20
+ '221' => STANDARD_ERROR_CODE[:card_declined],
21
+ '222' => STANDARD_ERROR_CODE[:incorrect_number],
22
+ '223' => STANDARD_ERROR_CODE[:expired_card],
23
+ '224' => STANDARD_ERROR_CODE[:invalid_expiry_date],
24
+ '225' => STANDARD_ERROR_CODE[:invalid_cvc],
25
+ '240' => STANDARD_ERROR_CODE[:call_issuer],
26
+ '250' => STANDARD_ERROR_CODE[:pickup_card],
27
+ '251' => STANDARD_ERROR_CODE[:pickup_card],
28
+ '252' => STANDARD_ERROR_CODE[:pickup_card],
29
+ '253' => STANDARD_ERROR_CODE[:pickup_card],
30
+ '260' => STANDARD_ERROR_CODE[:card_declined],
31
+ '261' => STANDARD_ERROR_CODE[:card_declined],
32
+ '262' => STANDARD_ERROR_CODE[:card_declined],
33
+ '263' => STANDARD_ERROR_CODE[:processing_error],
34
+ '264' => STANDARD_ERROR_CODE[:card_declined],
35
+ '300' => STANDARD_ERROR_CODE[:card_declined],
36
+ '400' => STANDARD_ERROR_CODE[:processing_error],
37
+ '410' => STANDARD_ERROR_CODE[:processing_error],
38
+ '411' => STANDARD_ERROR_CODE[:processing_error],
39
+ '420' => STANDARD_ERROR_CODE[:processing_error],
40
+ '421' => STANDARD_ERROR_CODE[:processing_error],
41
+ '430' => STANDARD_ERROR_CODE[:processing_error],
42
+ '440' => STANDARD_ERROR_CODE[:processing_error],
43
+ '441' => STANDARD_ERROR_CODE[:processing_error],
44
+ '460' => STANDARD_ERROR_CODE[:invalid_number],
45
+ '461' => STANDARD_ERROR_CODE[:processing_error],
46
+ '801' => STANDARD_ERROR_CODE[:processing_error],
47
+ '811' => STANDARD_ERROR_CODE[:processing_error],
48
+ '812' => STANDARD_ERROR_CODE[:processing_error],
49
+ '813' => STANDARD_ERROR_CODE[:processing_error],
50
+ '814' => STANDARD_ERROR_CODE[:processing_error],
51
+ '815' => STANDARD_ERROR_CODE[:processing_error],
52
+ '823' => STANDARD_ERROR_CODE[:processing_error],
53
+ '824' => STANDARD_ERROR_CODE[:processing_error],
54
+ '881' => STANDARD_ERROR_CODE[:processing_error],
55
+ '882' => STANDARD_ERROR_CODE[:processing_error],
56
+ '883' => STANDARD_ERROR_CODE[:processing_error],
57
+ '884' => STANDARD_ERROR_CODE[:card_declined],
58
+ '885' => STANDARD_ERROR_CODE[:card_declined],
59
+ '886' => STANDARD_ERROR_CODE[:card_declined],
60
+ '887' => STANDARD_ERROR_CODE[:processing_error],
61
+ '888' => STANDARD_ERROR_CODE[:processing_error],
62
+ '889' => STANDARD_ERROR_CODE[:processing_error],
63
+ '890' => STANDARD_ERROR_CODE[:processing_error],
64
+ '891' => STANDARD_ERROR_CODE[:incorrect_cvc],
65
+ '892' => STANDARD_ERROR_CODE[:incorrect_cvc],
66
+ '893' => STANDARD_ERROR_CODE[:processing_error],
67
+ '894' => STANDARD_ERROR_CODE[:processing_error]
68
+ }
69
+
70
+ def initialize(options = {})
71
+ requires!(options, :username, :password)
72
+ super
73
+ end
74
+
75
+ def purchase(money, payment, options = {})
76
+ post = {}
77
+ add_invoice(post, money, options)
78
+
79
+ if payment.respond_to?(:number)
80
+ add_payment(post, payment)
81
+ add_address(post, payment, options)
82
+ elsif payment.kind_of?(String)
83
+ post[:transactionid] = split_authorization(payment)[0]
84
+ end
85
+
86
+ commit('sale', post)
87
+ end
88
+
89
+ def authorize(money, payment, options = {})
90
+ post = {}
91
+ add_invoice(post, money, options)
92
+ add_payment(post, payment)
93
+ add_address(post, payment, options)
94
+
95
+ commit('auth', post)
96
+ end
97
+
98
+ def capture(money, authorization, options = {})
99
+ post = {}
100
+ add_reference(post, authorization)
101
+ add_invoice(post, money, options)
102
+
103
+ commit('capture', post)
104
+ end
105
+
106
+ def refund(money, authorization, options = {})
107
+ post = {}
108
+ add_reference(post, authorization)
109
+ add_invoice(post, money, options)
110
+ commit('refund', post)
111
+ end
112
+
113
+ def void(authorization, options = {})
114
+ post = {}
115
+ add_reference(post, authorization)
116
+ commit('void', post)
117
+ end
118
+
119
+ def verify(credit_card, options = {})
120
+ post = {}
121
+ add_invoice(post, 0, options)
122
+ add_payment(post, credit_card)
123
+ add_address(post, credit_card, options)
124
+ commit('verify', post)
125
+ end
126
+
127
+ def supports_scrubbing?
128
+ true
129
+ end
130
+
131
+ def scrub(transcript)
132
+ %w(ccnumber cvv password).each do |field|
133
+ transcript = transcript.gsub(%r((#{field}=)[^&]+), '\1[FILTERED]\2')
134
+ end
135
+
136
+ transcript
137
+ end
138
+
139
+ private
140
+
141
+ def add_address(post, creditcard, options = {})
142
+ post[:firstname] = creditcard.first_name
143
+ post[:lastname] = creditcard.last_name
144
+
145
+ return unless options[:billing_address]
146
+
147
+ address = options[:billing_address]
148
+ post[:address1] = address[:address1]
149
+ post[:address2] = address[:address2]
150
+ post[:city] = address[:city]
151
+ post[:state] = address[:state]
152
+ post[:zip] = address[:zip]
153
+ post[:country] = address[:country]
154
+ post[:phone] = address[:phone]
155
+ end
156
+
157
+ def add_reference(post, authorization)
158
+ transaction_id, authcode = split_authorization(authorization)
159
+ post['transactionid'] = transaction_id
160
+ post['authcode'] = authcode
161
+ end
162
+
163
+ def add_invoice(post, money, options)
164
+ post[:amount] = amount(money)
165
+ post[:currency] = (options[:currency] || default_currency)
166
+ end
167
+
168
+ def add_payment(post, payment)
169
+ post[:ccnumber] = payment.number
170
+ post[:ccexp] = "#{payment.month.to_s.rjust(2, '0')}#{payment.year.to_s[-2..-1]}"
171
+ post[:cvv] = payment.verification_value
172
+ end
173
+
174
+ def parse(body)
175
+ kvs = body.split('&')
176
+
177
+ kvs.inject({}) { |h, kv|
178
+ k, v = kv.split('=')
179
+ h[k] = v
180
+ h
181
+ }
182
+ end
183
+
184
+ def commit(action, parameters)
185
+ url = live_url
186
+ parameters[:type] = action
187
+
188
+ response_body = ssl_post(url, post_data(parameters))
189
+ response = parse(response_body)
190
+
191
+ Response.new(
192
+ success_from(response),
193
+ message_from(response),
194
+ response,
195
+ authorization: authorization_from(response),
196
+ test: test?,
197
+ error_code: error_code_from(response)
198
+ )
199
+ end
200
+
201
+ def success_from(response)
202
+ response['response_code'] == '100'
203
+ end
204
+
205
+ def message_from(response)
206
+ response['responsetext']
207
+ end
208
+
209
+ def authorization_from(response)
210
+ [response['transactionid'], response['authcode']].join('#')
211
+ end
212
+
213
+ def split_authorization(authorization)
214
+ transaction_id, authcode = authorization.split('#')
215
+ [transaction_id, authcode]
216
+ end
217
+
218
+ def post_data(parameters = {})
219
+ parameters[:password] = @options[:password]
220
+ parameters[:username] = @options[:username]
221
+
222
+ parameters.collect { |k, v| "#{k}=#{v}" }.join('&')
223
+ end
224
+
225
+ def error_code_from(response)
226
+ STANDARD_ERROR_CODE_MAPPING[response['response_code']]
227
+ end
228
+ end
229
+ end
230
+ end