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
@@ -17,11 +17,11 @@ module ActiveMerchant
17
17
  self.default_currency = 'GBP'
18
18
 
19
19
  self.supported_countries = ['GB']
20
- # Visa Credit, Visa Debit, Mastercard, Maestro, Solo, Electron,
20
+ # Visa Credit, Visa Debit, Mastercard, Maestro, Electron,
21
21
  # American Express, Diners Club, JCB, International Maestro,
22
22
  # Style, Clydesdale Financial Services, Other
23
23
 
24
- self.supported_cardtypes = [ :visa, :master, :american_express, :diners_club, :jcb, :switch, :solo, :maestro ]
24
+ self.supported_cardtypes = %i[visa master american_express diners_club jcb maestro]
25
25
  self.homepage_url = 'http://www.paymentsolutionsltd.com/'
26
26
  self.display_name = 'PSL Payment Solutions'
27
27
 
@@ -46,38 +46,38 @@ module ActiveMerchant
46
46
  'USD' => 840
47
47
  }
48
48
 
49
- #The terminal used - only for swipe transactions, so hard coded to 32 for online
49
+ # The terminal used - only for swipe transactions, so hard coded to 32 for online
50
50
  EMV_TERMINAL_TYPE = 32
51
51
 
52
- #Different Dispatch types
52
+ # Different Dispatch types
53
53
  DISPATCH_LATER = 'LATER'
54
54
  DISPATCH_NOW = 'NOW'
55
55
 
56
56
  # Return codes
57
57
  APPROVED = '00'
58
58
 
59
- #Nominal amount to authorize for a 'dispatch later' type
60
- #The nominal amount is held straight away, when the goods are ready
61
- #to be dispatched, PSL is informed and the full amount is the
62
- #taken.
59
+ # Nominal amount to authorize for a 'dispatch later' type
60
+ # The nominal amount is held straight away, when the goods are ready
61
+ # to be dispatched, PSL is informed and the full amount is the
62
+ # taken.
63
63
  NOMINAL_AMOUNT = 101
64
64
 
65
65
  AVS_CODE = {
66
- "ALL MATCH" => 'Y',
67
- "SECURITY CODE MATCH ONLY" => 'N',
68
- "ADDRESS MATCH ONLY" => 'Y',
69
- "NO DATA MATCHES" => 'N',
70
- "DATA NOT CHECKED" => 'R',
71
- "SECURITY CHECKS NOT SUPPORTED" => 'X'
66
+ 'ALL MATCH' => 'Y',
67
+ 'SECURITY CODE MATCH ONLY' => 'N',
68
+ 'ADDRESS MATCH ONLY' => 'Y',
69
+ 'NO DATA MATCHES' => 'N',
70
+ 'DATA NOT CHECKED' => 'R',
71
+ 'SECURITY CHECKS NOT SUPPORTED' => 'X'
72
72
  }
73
73
 
74
74
  CVV_CODE = {
75
- "ALL MATCH" => 'M',
76
- "SECURITY CODE MATCH ONLY" => 'M',
77
- "ADDRESS MATCH ONLY" => 'N',
78
- "NO DATA MATCHES" => 'N',
79
- "DATA NOT CHECKED" => 'P',
80
- "SECURITY CHECKS NOT SUPPORTED" => 'X'
75
+ 'ALL MATCH' => 'M',
76
+ 'SECURITY CODE MATCH ONLY' => 'M',
77
+ 'ADDRESS MATCH ONLY' => 'N',
78
+ 'NO DATA MATCHES' => 'N',
79
+ 'DATA NOT CHECKED' => 'P',
80
+ 'SECURITY CHECKS NOT SUPPORTED' => 'X'
81
81
  }
82
82
 
83
83
  # Create a new PslCardGateway
@@ -101,7 +101,7 @@ module ActiveMerchant
101
101
  # -options:
102
102
  #
103
103
  # Returns:
104
- # -ActiveRecord::Billing::Response object
104
+ # -ActiveMerchant::Billing::Response object
105
105
  #
106
106
  def purchase(money, credit_card, options = {})
107
107
  post = {}
@@ -129,7 +129,7 @@ module ActiveMerchant
129
129
  # -options:
130
130
  #
131
131
  # Returns:
132
- # -ActiveRecord::Billing::Response object
132
+ # -ActiveMerchant::Billing::Response object
133
133
  #
134
134
  def authorize(money, credit_card, options = {})
135
135
  post = {}
@@ -153,7 +153,7 @@ module ActiveMerchant
153
153
  # -options:
154
154
  #
155
155
  # Returns:
156
- # -ActiveRecord::Billing::Response object
156
+ # -ActiveMerchant::Billing::Response object
157
157
  #
158
158
  def capture(money, authorization, options = {})
159
159
  post = {}
@@ -174,12 +174,6 @@ module ActiveMerchant
174
174
  post[:ExpMonth] = credit_card.month
175
175
  post[:ExpYear] = credit_card.year
176
176
 
177
- if requires_start_date_or_issue_number?(credit_card)
178
- post[:IssueNumber] = credit_card.issue_number unless credit_card.issue_number.blank?
179
- post[:StartMonth] = credit_card.start_month unless credit_card.start_month.blank?
180
- post[:StartYear] = credit_card.start_year unless credit_card.start_year.blank?
181
- end
182
-
183
177
  # CV2 check
184
178
  post[:AVSCV2Check] = credit_card.verification_value? ? 'YES' : 'NO'
185
179
  post[:CV2] = credit_card.verification_value if credit_card.verification_value?
@@ -189,7 +183,7 @@ module ActiveMerchant
189
183
  address = options[:billing_address] || options[:address]
190
184
  return if address.nil?
191
185
 
192
- post[:QAAddress] = [:address1, :address2, :city, :state].collect{|a| address[a]}.reject{|a| a.blank?}.join(' ')
186
+ post[:QAAddress] = %i[address1 address2 city state].collect { |a| address[a] }.reject(&:blank?).join(' ')
193
187
  post[:QAPostcode] = address[:zip]
194
188
  end
195
189
 
@@ -217,7 +211,7 @@ module ActiveMerchant
217
211
 
218
212
  def add_purchase_details(post)
219
213
  post[:EchoAmount] = 'YES'
220
- post[:SCBI] = 'YES' # Return information about the transaction
214
+ post[:SCBI] = 'YES' # Return information about the transaction
221
215
  post[:MessageType] = MESSAGE_TYPE
222
216
  end
223
217
 
@@ -246,10 +240,9 @@ module ActiveMerchant
246
240
  # -a hash with all of the values returned in the PSL response
247
241
  #
248
242
  def parse(body)
249
-
250
243
  fields = {}
251
244
  for line in body.split('&')
252
- key, value = *line.scan( %r{^(\w+)\=(.*)$} ).flatten
245
+ key, value = *line.scan(%r{^(\w+)\=(.*)$}).flatten
253
246
  fields[key] = CGI.unescape(value)
254
247
  end
255
248
  fields.symbolize_keys
@@ -264,14 +257,13 @@ module ActiveMerchant
264
257
  # - ActiveMerchant::Billing::Response object
265
258
  #
266
259
  def commit(request)
267
- response = parse( ssl_post(self.live_url, post_data(request)) )
260
+ response = parse(ssl_post(self.live_url, post_data(request)))
268
261
 
269
262
  Response.new(response[:ResponseCode] == APPROVED, response[:Message], response,
270
- :test => test?,
271
- :authorization => response[:CrossReference],
272
- :cvv_result => CVV_CODE[response[:AVSCV2Check]],
273
- :avs_result => { :code => AVS_CODE[response[:AVSCV2Check]] }
274
- )
263
+ test: test?,
264
+ authorization: response[:CrossReference],
265
+ cvv_result: CVV_CODE[response[:AVSCV2Check]],
266
+ avs_result: { code: AVS_CODE[response[:AVSCV2Check]] })
275
267
  end
276
268
 
277
269
  # Put the passed data into a format that can be submitted to PSL
@@ -296,7 +288,7 @@ module ActiveMerchant
296
288
 
297
289
  post.collect { |key, value|
298
290
  "#{key}=#{CGI.escape(value.to_s.tr('&=', ' '))}"
299
- }.join("&")
291
+ }.join('&')
300
292
  end
301
293
  end
302
294
  end
@@ -5,22 +5,22 @@ module ActiveMerchant #:nodoc:
5
5
 
6
6
  class_attribute :test_url, :live_url
7
7
 
8
- self.test_url = "https://webmerchantaccount.ptc.quickbooks.com/j/AppGateway"
9
- self.live_url = "https://webmerchantaccount.quickbooks.com/j/AppGateway"
8
+ self.test_url = 'https://webmerchantaccount.ptc.quickbooks.com/j/AppGateway'
9
+ self.live_url = 'https://webmerchantaccount.quickbooks.com/j/AppGateway'
10
10
 
11
11
  self.homepage_url = 'http://payments.intuit.com/'
12
12
  self.display_name = 'QuickBooks Merchant Services'
13
13
  self.default_currency = 'USD'
14
- self.supported_cardtypes = [ :visa, :master, :discover, :american_express, :diners_club, :jcb ]
15
- self.supported_countries = [ 'US' ]
14
+ self.supported_cardtypes = %i[visa master discover american_express diners_club jcb]
15
+ self.supported_countries = ['US']
16
16
 
17
17
  TYPES = {
18
- :authorize => 'CustomerCreditCardAuth',
19
- :capture => 'CustomerCreditCardCapture',
20
- :purchase => 'CustomerCreditCardCharge',
21
- :refund => 'CustomerCreditCardTxnVoidOrRefund',
22
- :void => 'CustomerCreditCardTxnVoid',
23
- :query => 'MerchantAccountQuery',
18
+ authorize: 'CustomerCreditCardAuth',
19
+ capture: 'CustomerCreditCardCapture',
20
+ purchase: 'CustomerCreditCardCharge',
21
+ refund: 'CustomerCreditCardTxnVoidOrRefund',
22
+ void: 'CustomerCreditCardTxnVoid',
23
+ query: 'MerchantAccountQuery'
24
24
  }
25
25
 
26
26
  # Creates a new QbmsGateway
@@ -51,7 +51,7 @@ module ActiveMerchant #:nodoc:
51
51
  # * <tt>options</tt> -- A hash of optional parameters.
52
52
  #
53
53
  def authorize(money, creditcard, options = {})
54
- commit(:authorize, money, options.merge(:credit_card => creditcard))
54
+ commit(:authorize, money, options.merge(credit_card: creditcard))
55
55
  end
56
56
 
57
57
  # Perform a purchase, which is essentially an authorization and capture in a single operation.
@@ -63,7 +63,7 @@ module ActiveMerchant #:nodoc:
63
63
  # * <tt>options</tt> -- A hash of optional parameters.
64
64
  #
65
65
  def purchase(money, creditcard, options = {})
66
- commit(:purchase, money, options.merge(:credit_card => creditcard))
66
+ commit(:purchase, money, options.merge(credit_card: creditcard))
67
67
  end
68
68
 
69
69
  # Captures the funds from an authorized transaction.
@@ -74,7 +74,7 @@ module ActiveMerchant #:nodoc:
74
74
  # * <tt>authorization</tt> -- The authorization returned from the previous authorize request.
75
75
  #
76
76
  def capture(money, authorization, options = {})
77
- commit(:capture, money, options.merge(:transaction_id => authorization))
77
+ commit(:capture, money, options.merge(transaction_id: authorization))
78
78
  end
79
79
 
80
80
  # Void a previous transaction
@@ -84,7 +84,7 @@ module ActiveMerchant #:nodoc:
84
84
  # * <tt>authorization</tt> - The authorization returned from the previous authorize request.
85
85
  #
86
86
  def void(authorization, options = {})
87
- commit(:void, nil, options.merge(:transaction_id => authorization))
87
+ commit(:void, nil, options.merge(transaction_id: authorization))
88
88
  end
89
89
 
90
90
  # Credit an account.
@@ -101,11 +101,11 @@ module ActiveMerchant #:nodoc:
101
101
  #
102
102
  def credit(money, identification, options = {})
103
103
  ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
104
- refund(money, identification, options = {})
104
+ refund(money, identification, {})
105
105
  end
106
106
 
107
107
  def refund(money, identification, options = {})
108
- commit(:refund, money, options.merge(:transaction_id => identification))
108
+ commit(:refund, money, options.merge(transaction_id: identification))
109
109
  end
110
110
 
111
111
  # Query the merchant account status
@@ -113,6 +113,17 @@ module ActiveMerchant #:nodoc:
113
113
  commit(:query, nil, {})
114
114
  end
115
115
 
116
+ def supports_scrubbing?
117
+ true
118
+ end
119
+
120
+ def scrub(transcript)
121
+ transcript.
122
+ gsub(%r((<ConnectionTicket>)[^<]*(</ConnectionTicket>))i, '\1[FILTERED]\2').
123
+ gsub(%r((<CreditCardNumber>)[^<]*(</CreditCardNumber>))i, '\1[FILTERED]\2').
124
+ gsub(%r((<CardSecurityCode>)[^<]*(</CardSecurityCode>))i, '\1[FILTERED]\2')
125
+ end
126
+
116
127
  private
117
128
 
118
129
  def hosted?
@@ -127,17 +138,16 @@ module ActiveMerchant #:nodoc:
127
138
 
128
139
  req = build_request(type, money, parameters)
129
140
 
130
- data = ssl_post(url, req, "Content-Type" => "application/x-qbmsxml")
141
+ data = ssl_post(url, req, 'Content-Type' => 'application/x-qbmsxml')
131
142
  response = parse(type, data)
132
143
  message = (response[:status_message] || '').strip
133
144
 
134
145
  Response.new(success?(response), message, response,
135
- :test => test?,
136
- :authorization => response[:credit_card_trans_id],
137
- :fraud_review => fraud_review?(response),
138
- :avs_result => { :code => avs_result(response) },
139
- :cvv_result => cvv_result(response)
140
- )
146
+ test: test?,
147
+ authorization: response[:credit_card_trans_id],
148
+ fraud_review: fraud_review?(response),
149
+ avs_result: { code: avs_result(response) },
150
+ cvv_result: cvv_result(response))
141
151
  end
142
152
 
143
153
  def success?(response)
@@ -152,20 +162,20 @@ module ActiveMerchant #:nodoc:
152
162
  xml = REXML::Document.new(body)
153
163
 
154
164
  signon = REXML::XPath.first(xml, "//SignonMsgsRs/#{hosted? ? 'SignonAppCertRs' : 'SignonDesktopRs'}")
155
- status_code = signon.attributes["statusCode"].to_i
165
+ status_code = signon.attributes['statusCode'].to_i
156
166
 
157
167
  if status_code != 0
158
168
  return {
159
- :status_code => status_code,
160
- :status_message => signon.attributes["statusMessage"],
169
+ status_code: status_code,
170
+ status_message: signon.attributes['statusMessage']
161
171
  }
162
172
  end
163
173
 
164
174
  response = REXML::XPath.first(xml, "//QBMSXMLMsgsRs/#{type}Rs")
165
175
 
166
176
  results = {
167
- :status_code => response.attributes["statusCode"].to_i,
168
- :status_message => response.attributes["statusMessage"],
177
+ status_code: response.attributes['statusCode'].to_i,
178
+ status_message: response.attributes['statusMessage']
169
179
  }
170
180
 
171
181
  response.elements.each do |e|
@@ -184,21 +194,21 @@ module ActiveMerchant #:nodoc:
184
194
  end
185
195
 
186
196
  def build_request(type, money, parameters = {})
187
- xml = Builder::XmlMarkup.new(:indent => 0)
197
+ xml = Builder::XmlMarkup.new(indent: 0)
188
198
 
189
- xml.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')
190
- xml.instruct!(:qbmsxml, :version => API_VERSION)
199
+ xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
200
+ xml.instruct!(:qbmsxml, version: API_VERSION)
191
201
 
192
- xml.tag!("QBMSXML") do
193
- xml.tag!("SignonMsgsRq") do
194
- xml.tag!(hosted? ? "SignonAppCertRq" : "SignonDesktopRq") do
195
- xml.tag!("ClientDateTime", Time.now.xmlschema)
196
- xml.tag!("ApplicationLogin", @options[:login])
197
- xml.tag!("ConnectionTicket", @options[:ticket])
202
+ xml.tag!('QBMSXML') do
203
+ xml.tag!('SignonMsgsRq') do
204
+ xml.tag!(hosted? ? 'SignonAppCertRq' : 'SignonDesktopRq') do
205
+ xml.tag!('ClientDateTime', Time.now.xmlschema)
206
+ xml.tag!('ApplicationLogin', @options[:login])
207
+ xml.tag!('ConnectionTicket', @options[:ticket])
198
208
  end
199
209
  end
200
210
 
201
- xml.tag!("QBMSXMLMsgsRq") do
211
+ xml.tag!('QBMSXMLMsgsRq') do
202
212
  xml.tag!("#{type}Rq") do
203
213
  method("build_#{type}").call(xml, money, parameters)
204
214
  end
@@ -212,47 +222,47 @@ module ActiveMerchant #:nodoc:
212
222
  cc = parameters[:credit_card]
213
223
  name = "#{cc.first_name} #{cc.last_name}"[0...30]
214
224
 
215
- xml.tag!("TransRequestID", parameters[:trans_request_id])
216
- xml.tag!("CreditCardNumber", cc.number)
217
- xml.tag!("ExpirationMonth", cc.month)
218
- xml.tag!("ExpirationYear", cc.year)
219
- xml.tag!("IsECommerce", "true")
220
- xml.tag!("Amount", amount(money))
221
- xml.tag!("NameOnCard", name)
225
+ xml.tag!('TransRequestID', parameters[:trans_request_id])
226
+ xml.tag!('CreditCardNumber', cc.number)
227
+ xml.tag!('ExpirationMonth', cc.month)
228
+ xml.tag!('ExpirationYear', cc.year)
229
+ xml.tag!('IsECommerce', 'true')
230
+ xml.tag!('Amount', amount(money))
231
+ xml.tag!('NameOnCard', name)
222
232
  add_address(xml, parameters)
223
- xml.tag!("CardSecurityCode", cc.verification_value) if cc.verification_value?
233
+ xml.tag!('CardSecurityCode', cc.verification_value) if cc.verification_value?
224
234
  end
225
235
 
226
236
  def build_CustomerCreditCardCapture(xml, money, parameters)
227
- xml.tag!("TransRequestID", parameters[:trans_request_id])
228
- xml.tag!("CreditCardTransID", parameters[:transaction_id])
229
- xml.tag!("Amount", amount(money))
237
+ xml.tag!('TransRequestID', parameters[:trans_request_id])
238
+ xml.tag!('CreditCardTransID', parameters[:transaction_id])
239
+ xml.tag!('Amount', amount(money))
230
240
  end
231
241
 
232
242
  def build_CustomerCreditCardCharge(xml, money, parameters)
233
243
  cc = parameters[:credit_card]
234
244
  name = "#{cc.first_name} #{cc.last_name}"[0...30]
235
245
 
236
- xml.tag!("TransRequestID", parameters[:trans_request_id])
237
- xml.tag!("CreditCardNumber", cc.number)
238
- xml.tag!("ExpirationMonth", cc.month)
239
- xml.tag!("ExpirationYear", cc.year)
240
- xml.tag!("IsECommerce", "true")
241
- xml.tag!("Amount", amount(money))
242
- xml.tag!("NameOnCard", name)
246
+ xml.tag!('TransRequestID', parameters[:trans_request_id])
247
+ xml.tag!('CreditCardNumber', cc.number)
248
+ xml.tag!('ExpirationMonth', cc.month)
249
+ xml.tag!('ExpirationYear', cc.year)
250
+ xml.tag!('IsECommerce', 'true')
251
+ xml.tag!('Amount', amount(money))
252
+ xml.tag!('NameOnCard', name)
243
253
  add_address(xml, parameters)
244
- xml.tag!("CardSecurityCode", cc.verification_value) if cc.verification_value?
254
+ xml.tag!('CardSecurityCode', cc.verification_value) if cc.verification_value?
245
255
  end
246
256
 
247
257
  def build_CustomerCreditCardTxnVoidOrRefund(xml, money, parameters)
248
- xml.tag!("TransRequestID", parameters[:trans_request_id])
249
- xml.tag!("CreditCardTransID", parameters[:transaction_id])
250
- xml.tag!("Amount", amount(money))
258
+ xml.tag!('TransRequestID', parameters[:trans_request_id])
259
+ xml.tag!('CreditCardTransID', parameters[:transaction_id])
260
+ xml.tag!('Amount', amount(money))
251
261
  end
252
262
 
253
263
  def build_CustomerCreditCardTxnVoid(xml, money, parameters)
254
- xml.tag!("TransRequestID", parameters[:trans_request_id])
255
- xml.tag!("CreditCardTransID", parameters[:transaction_id])
264
+ xml.tag!('TransRequestID', parameters[:trans_request_id])
265
+ xml.tag!('CreditCardTransID', parameters[:transaction_id])
256
266
  end
257
267
 
258
268
  # Called reflectively by build_request
@@ -261,30 +271,30 @@ module ActiveMerchant #:nodoc:
261
271
 
262
272
  def add_address(xml, parameters)
263
273
  if address = parameters[:billing_address] || parameters[:address]
264
- xml.tag!("CreditCardAddress", (address[:address1] || "")[0...30])
265
- xml.tag!("CreditCardPostalCode", (address[:zip] || "")[0...9])
274
+ xml.tag!('CreditCardAddress', (address[:address1] || '')[0...30])
275
+ xml.tag!('CreditCardPostalCode', (address[:zip] || '')[0...9])
266
276
  end
267
277
  end
268
278
 
269
279
  def cvv_result(response)
270
280
  case response[:card_security_code_match]
271
- when "Pass" then 'M'
272
- when "Fail" then 'N'
273
- when "NotAvailable" then 'P'
281
+ when 'Pass' then 'M'
282
+ when 'Fail' then 'N'
283
+ when 'NotAvailable' then 'P'
274
284
  end
275
285
  end
276
286
 
277
287
  def avs_result(response)
278
288
  case "#{response[:avs_street]}|#{response[:avs_zip]}"
279
- when "Pass|Pass" then "D"
280
- when "Pass|Fail" then "A"
281
- when "Pass|NotAvailable" then "B"
282
- when "Fail|Pass" then "Z"
283
- when "Fail|Fail" then "C"
284
- when "Fail|NotAvailable" then "N"
285
- when "NotAvailable|Pass" then "P"
286
- when "NotAvailable|Fail" then "N"
287
- when "NotAvailable|NotAvailable" then "U"
289
+ when 'Pass|Pass' then 'D'
290
+ when 'Pass|Fail' then 'A'
291
+ when 'Pass|NotAvailable' then 'B'
292
+ when 'Fail|Pass' then 'Z'
293
+ when 'Fail|Fail' then 'C'
294
+ when 'Fail|NotAvailable' then 'N'
295
+ when 'NotAvailable|Pass' then 'P'
296
+ when 'NotAvailable|Fail' then 'N'
297
+ when 'NotAvailable|NotAvailable' then 'U'
288
298
  end
289
299
  end
290
300
  end
@@ -13,7 +13,7 @@ module ActiveMerchant #:nodoc:
13
13
  self.live_url = self.test_url = 'https://secure.quantumgateway.com/cgi/xml_requester.php'
14
14
 
15
15
  # visa, master, american_express, discover
16
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
16
+ self.supported_cardtypes = %i[visa master american_express discover]
17
17
  self.supported_countries = ['US']
18
18
  self.default_currency = 'USD'
19
19
  self.money_format = :dollars
@@ -44,7 +44,7 @@ module ActiveMerchant #:nodoc:
44
44
  #
45
45
  def authorize(money, creditcard, options = {})
46
46
  setup_address_hash(options)
47
- commit(build_auth_request(money, creditcard, options), options )
47
+ commit(build_auth_request(money, creditcard, options), options)
48
48
  end
49
49
 
50
50
  # Capture an authorization that has previously been requested
@@ -81,7 +81,7 @@ module ActiveMerchant #:nodoc:
81
81
 
82
82
  def build_auth_request(money, creditcard, options)
83
83
  xml = Builder::XmlMarkup.new
84
- add_common_credit_card_info(xml,'AUTH_ONLY')
84
+ add_common_credit_card_info(xml, 'AUTH_ONLY')
85
85
  add_purchase_data(xml, money)
86
86
  add_creditcard(xml, creditcard)
87
87
  add_address(xml, creditcard, options[:billing_address], options)
@@ -94,15 +94,15 @@ module ActiveMerchant #:nodoc:
94
94
 
95
95
  def build_capture_request(money, authorization, options)
96
96
  xml = Builder::XmlMarkup.new
97
- add_common_credit_card_info(xml,'PREVIOUS_SALE')
98
- transaction_id, _ = authorization_parts_from(authorization)
97
+ add_common_credit_card_info(xml, 'PREVIOUS_SALE')
98
+ transaction_id, = authorization_parts_from(authorization)
99
99
  add_transaction_id(xml, transaction_id)
100
100
  xml.target!
101
101
  end
102
102
 
103
103
  def build_purchase_request(money, creditcard, options)
104
104
  xml = Builder::XmlMarkup.new
105
- add_common_credit_card_info(xml, @options[:ignore_avs] || @options[:ignore_cvv] ? 'SALES' : 'AUTH_CAPTURE')
105
+ add_common_credit_card_info(xml, @options[:ignore_avs] || @options[:ignore_cvv] ? 'SALES' : 'AUTH_CAPTURE')
106
106
  add_address(xml, creditcard, options[:billing_address], options)
107
107
  add_purchase_data(xml, money)
108
108
  add_creditcard(xml, creditcard)
@@ -115,15 +115,15 @@ module ActiveMerchant #:nodoc:
115
115
 
116
116
  def build_void_request(authorization, options)
117
117
  xml = Builder::XmlMarkup.new
118
- add_common_credit_card_info(xml,'VOID')
119
- transaction_id, _ = authorization_parts_from(authorization)
118
+ add_common_credit_card_info(xml, 'VOID')
119
+ transaction_id, = authorization_parts_from(authorization)
120
120
  add_transaction_id(xml, transaction_id)
121
121
  xml.target!
122
122
  end
123
123
 
124
124
  def build_credit_request(money, authorization, options)
125
125
  xml = Builder::XmlMarkup.new
126
- add_common_credit_card_info(xml,'RETURN')
126
+ add_common_credit_card_info(xml, 'RETURN')
127
127
  add_purchase_data(xml, money)
128
128
  transaction_id, cc = authorization_parts_from(authorization)
129
129
  add_transaction_id(xml, transaction_id)
@@ -182,7 +182,7 @@ module ActiveMerchant #:nodoc:
182
182
  xml.tag! 'CreditCardNumber', creditcard.number
183
183
  xml.tag! 'ExpireMonth', format(creditcard.month, :two_digits)
184
184
  xml.tag! 'ExpireYear', format(creditcard.year, :four_digits)
185
- xml.tag!('CVV2', creditcard.verification_value) unless (@options[:ignore_cvv] || creditcard.verification_value.blank? )
185
+ xml.tag!('CVV2', creditcard.verification_value) unless @options[:ignore_cvv] || creditcard.verification_value.blank?
186
186
  end
187
187
 
188
188
  # Where we actually build the full SOAP request using builder
@@ -206,7 +206,7 @@ module ActiveMerchant #:nodoc:
206
206
  headers = { 'Content-Type' => 'text/xml' }
207
207
  response = parse(ssl_post(self.live_url, build_request(request, options), headers))
208
208
 
209
- success = response[:request_status] == "Success"
209
+ success = response[:request_status] == 'Success'
210
210
  message = response[:request_message]
211
211
 
212
212
  if success # => checking for connectivity success first
@@ -216,11 +216,10 @@ module ActiveMerchant #:nodoc:
216
216
  end
217
217
 
218
218
  Response.new(success, message, response,
219
- :test => test?,
220
- :authorization => authorization,
221
- :avs_result => { :code => response[:AVSResponseCode] },
222
- :cvv_result => response[:CVV2ResponseCode]
223
- )
219
+ test: test?,
220
+ authorization: authorization,
221
+ avs_result: { code: response[:AVSResponseCode] },
222
+ cvv_result: response[:CVV2ResponseCode])
224
223
  end
225
224
 
226
225
  # Parse the SOAP response
@@ -231,19 +230,19 @@ module ActiveMerchant #:nodoc:
231
230
  begin
232
231
  xml = REXML::Document.new(xml)
233
232
 
234
- root = REXML::XPath.first(xml, "//QGWRequest/ResponseSummary")
233
+ root = REXML::XPath.first(xml, '//QGWRequest/ResponseSummary')
235
234
  parse_element(reply, root)
236
235
  reply[:request_status] = reply[:Status]
237
236
  reply[:request_message] = "#{reply[:Status]}: #{reply[:StatusDescription]}"
238
237
 
239
- if root = REXML::XPath.first(xml, "//QGWRequest/Result")
238
+ if root = REXML::XPath.first(xml, '//QGWRequest/Result')
240
239
  root.elements.to_a.each do |node|
241
240
  parse_element(reply, node)
242
241
  end
243
242
  end
244
243
  rescue Exception
245
244
  reply[:request_status] = 'Failure'
246
- reply[:request_message] = "Failure: There was a problem parsing the response XML"
245
+ reply[:request_message] = 'Failure: There was a problem parsing the response XML'
247
246
  end
248
247
 
249
248
  return reply
@@ -251,10 +250,10 @@ module ActiveMerchant #:nodoc:
251
250
 
252
251
  def parse_element(reply, node)
253
252
  if node.has_elements?
254
- node.elements.each{|e| parse_element(reply, e) }
253
+ node.elements.each { |e| parse_element(reply, e) }
255
254
  else
256
- if node.parent.name =~ /item/
257
- parent = node.parent.name + (node.parent.attributes["id"] ? "_" + node.parent.attributes["id"] : '')
255
+ if /item/.match?(node.parent.name)
256
+ parent = node.parent.name + (node.parent.attributes['id'] ? '_' + node.parent.attributes['id'] : '')
258
257
  reply[(parent + '_' + node.name).to_sym] = node.text
259
258
  else
260
259
  reply[node.name.to_sym] = node.text
@@ -270,7 +269,6 @@ module ActiveMerchant #:nodoc:
270
269
  def authorization_parts_from(authorization)
271
270
  authorization.split(/;/)
272
271
  end
273
-
274
272
  end
275
273
  end
276
274
  end